Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebank
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
This commit is contained in:
commit
eba361ae36
@ -861,7 +861,7 @@ fn expected_fn_found_fn_mut_call(&self, err: &mut Diagnostic, sp: Span, act: &st
|
||||
let arg_pos = args
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, arg)| arg.span == self.body.span)
|
||||
.filter(|(_, arg)| arg.hir_id == closure_id)
|
||||
.map(|(pos, _)| pos)
|
||||
.next();
|
||||
let def_id = hir.local_def_id(item_id);
|
||||
@ -903,9 +903,7 @@ fn expected_fn_found_fn_mut_call(&self, err: &mut Diagnostic, sp: Span, act: &st
|
||||
if let Some(span) = arg {
|
||||
err.span_label(span, "change this to accept `FnMut` instead of `Fn`");
|
||||
err.span_label(func.span, "expects `Fn` instead of `FnMut`");
|
||||
if self.infcx.tcx.sess.source_map().is_multiline(self.body.span) {
|
||||
err.span_label(self.body.span, "in this closure");
|
||||
}
|
||||
err.span_label(self.body.span, "in this closure");
|
||||
look_at_return = false;
|
||||
}
|
||||
}
|
||||
|
@ -1021,6 +1021,7 @@ fn named_span(item_span: Span, ident: Ident, generics: Option<&Generics<'_>>) ->
|
||||
_ => named_span(item.span, item.ident, None),
|
||||
},
|
||||
Node::Ctor(_) => return self.opt_span(self.get_parent_node(hir_id)),
|
||||
Node::Expr(Expr { kind: ExprKind::Closure { fn_decl_span, .. }, .. }) => *fn_decl_span,
|
||||
_ => self.span_with_body(hir_id),
|
||||
};
|
||||
Some(span)
|
||||
|
@ -747,14 +747,13 @@ fn perform_2229_migration_anaysis(
|
||||
let (migration_string, migrated_variables_concat) =
|
||||
migration_suggestion_for_2229(self.tcx, &need_migrations);
|
||||
|
||||
let local_def_id = closure_def_id.expect_local();
|
||||
let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id);
|
||||
let closure_span = self.tcx.hir().span(closure_hir_id);
|
||||
let closure_head_span = self.tcx.sess.source_map().guess_head_span(closure_span);
|
||||
let closure_hir_id =
|
||||
self.tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local());
|
||||
let closure_head_span = self.tcx.def_span(closure_def_id);
|
||||
self.tcx.struct_span_lint_hir(
|
||||
lint::builtin::RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
|
||||
closure_hir_id,
|
||||
closure_head_span,
|
||||
closure_head_span,
|
||||
|lint| {
|
||||
let mut diagnostics_builder = lint.build(
|
||||
&reasons.migration_message(),
|
||||
@ -827,12 +826,13 @@ fn perform_2229_migration_anaysis(
|
||||
migrated_variables_concat
|
||||
);
|
||||
|
||||
let closure_span = self.tcx.hir().span_with_body(closure_hir_id);
|
||||
let mut closure_body_span = {
|
||||
// If the body was entirely expanded from a macro
|
||||
// invocation, i.e. the body is not contained inside the
|
||||
// closure span, then we walk up the expansion until we
|
||||
// find the span before the expansion.
|
||||
let s = self.tcx.hir().span(body_id.hir_id);
|
||||
let s = self.tcx.hir().span_with_body(body_id.hir_id);
|
||||
s.find_ancestor_inside(closure_span).unwrap_or(s)
|
||||
};
|
||||
|
||||
|
@ -27,11 +27,11 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> {
|
||||
// CHECK-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: )
|
||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant1", scope: [[GEN]],
|
||||
// CHECK-SAME: file: [[FILE]], line: 18,
|
||||
// CHECK-SAME: file: [[FILE]], line: 14,
|
||||
// CHECK-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: )
|
||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant2", scope: [[GEN]],
|
||||
// CHECK-SAME: file: [[FILE]], line: 18,
|
||||
// CHECK-SAME: file: [[FILE]], line: 14,
|
||||
// CHECK-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: )
|
||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "variant3", scope: [[GEN]],
|
||||
|
@ -33,11 +33,11 @@ fn generator_test() -> impl Generator<Yield = i32, Return = ()> {
|
||||
// CHECK-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: )
|
||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "1", scope: [[VARIANT]],
|
||||
// CHECK-SAME: file: [[FILE]], line: 18,
|
||||
// CHECK-SAME: file: [[FILE]], line: 14,
|
||||
// CHECK-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: )
|
||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "2", scope: [[VARIANT]],
|
||||
// CHECK-SAME: file: [[FILE]], line: 18,
|
||||
// CHECK-SAME: file: [[FILE]], line: 14,
|
||||
// CHECK-NOT: flags: DIFlagArtificial
|
||||
// CHECK-SAME: )
|
||||
// CHECK: {{!.*}} = !DIDerivedType(tag: DW_TAG_member, name: "3", scope: [[VARIANT]],
|
||||
|
@ -14,22 +14,22 @@
|
||||
},
|
||||
} */
|
||||
|
||||
fn main::{closure#0}(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:10:15: 13:6]) -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
let mut _2: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
fn main::{closure#0}(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:10:15: 10:17]) -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
let mut _2: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
let _3: std::string::String; // in scope 0 at $DIR/generator-drop-cleanup.rs:11:13: 11:15
|
||||
let _4: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:12:9: 12:14
|
||||
let mut _5: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:12:9: 12:14
|
||||
let mut _6: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:10:18: 10:18
|
||||
let mut _7: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
let mut _8: u32; // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
let mut _7: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
let mut _8: u32; // in scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
scope 1 {
|
||||
debug _s => (((*_1) as variant#3).0: std::string::String); // in scope 1 at $DIR/generator-drop-cleanup.rs:11:13: 11:15
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_8 = discriminant((*_1)); // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
switchInt(move _8) -> [0_u32: bb7, 3_u32: bb10, otherwise: bb11]; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
_8 = discriminant((*_1)); // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
switchInt(move _8) -> [0_u32: bb7, 3_u32: bb10, otherwise: bb11]; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
@ -44,11 +44,11 @@ fn main::{closure#0}(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:10:15: 1
|
||||
}
|
||||
|
||||
bb3: {
|
||||
return; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
return; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
}
|
||||
|
||||
bb4 (cleanup): {
|
||||
resume; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
resume; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
}
|
||||
|
||||
bb5 (cleanup): {
|
||||
@ -57,11 +57,11 @@ fn main::{closure#0}(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:10:15: 1
|
||||
}
|
||||
|
||||
bb6: {
|
||||
return; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
return; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
}
|
||||
|
||||
bb7: {
|
||||
goto -> bb9; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
goto -> bb9; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
}
|
||||
|
||||
bb8: {
|
||||
@ -69,16 +69,16 @@ fn main::{closure#0}(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:10:15: 1
|
||||
}
|
||||
|
||||
bb9: {
|
||||
goto -> bb6; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
goto -> bb6; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
}
|
||||
|
||||
bb10: {
|
||||
StorageLive(_4); // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
StorageLive(_5); // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
goto -> bb1; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
StorageLive(_4); // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
StorageLive(_5); // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
goto -> bb1; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
}
|
||||
|
||||
bb11: {
|
||||
return; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 13:6
|
||||
return; // scope 0 at $DIR/generator-drop-cleanup.rs:10:15: 10:17
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// MIR for `main::{closure#0}` before StateTransform
|
||||
|
||||
fn main::{closure#0}(_1: [generator@$DIR/generator-storage-dead-unwind.rs:22:16: 28:6], _2: ()) -> ()
|
||||
fn main::{closure#0}(_1: [generator@$DIR/generator-storage-dead-unwind.rs:22:16: 22:18], _2: ()) -> ()
|
||||
yields ()
|
||||
{
|
||||
let mut _0: (); // return place in scope 0 at $DIR/generator-storage-dead-unwind.rs:22:19: 22:19
|
||||
@ -66,7 +66,7 @@ yields ()
|
||||
}
|
||||
|
||||
bb4: {
|
||||
return; // scope 0 at $DIR/generator-storage-dead-unwind.rs:28:6: 28:6
|
||||
return; // scope 0 at $DIR/generator-storage-dead-unwind.rs:22:18: 22:18
|
||||
}
|
||||
|
||||
bb5: {
|
||||
@ -82,7 +82,7 @@ yields ()
|
||||
}
|
||||
|
||||
bb7: {
|
||||
generator_drop; // scope 0 at $DIR/generator-storage-dead-unwind.rs:22:16: 28:6
|
||||
generator_drop; // scope 0 at $DIR/generator-storage-dead-unwind.rs:22:16: 22:18
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
@ -104,7 +104,7 @@ yields ()
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
resume; // scope 0 at $DIR/generator-storage-dead-unwind.rs:22:16: 28:6
|
||||
resume; // scope 0 at $DIR/generator-storage-dead-unwind.rs:22:16: 22:18
|
||||
}
|
||||
|
||||
bb12 (cleanup): {
|
||||
|
@ -14,31 +14,31 @@
|
||||
},
|
||||
} */
|
||||
|
||||
fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator-tiny.rs:19:16: 25:6]>, _2: u8) -> GeneratorState<(), ()> {
|
||||
fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator-tiny.rs:19:16: 19:24]>, _2: u8) -> GeneratorState<(), ()> {
|
||||
debug _x => _10; // in scope 0 at $DIR/generator-tiny.rs:19:17: 19:19
|
||||
let mut _0: std::ops::GeneratorState<(), ()>; // return place in scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
let mut _0: std::ops::GeneratorState<(), ()>; // return place in scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
let _3: HasDrop; // in scope 0 at $DIR/generator-tiny.rs:20:13: 20:15
|
||||
let mut _4: !; // in scope 0 at $DIR/generator-tiny.rs:21:9: 24:10
|
||||
let mut _5: (); // in scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
let mut _5: (); // in scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
let _6: u8; // in scope 0 at $DIR/generator-tiny.rs:22:13: 22:18
|
||||
let mut _7: (); // in scope 0 at $DIR/generator-tiny.rs:22:13: 22:18
|
||||
let _8: (); // in scope 0 at $DIR/generator-tiny.rs:23:13: 23:21
|
||||
let mut _9: (); // in scope 0 at $DIR/generator-tiny.rs:19:25: 19:25
|
||||
let _10: u8; // in scope 0 at $DIR/generator-tiny.rs:19:17: 19:19
|
||||
let mut _11: u32; // in scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
let mut _11: u32; // in scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
scope 1 {
|
||||
debug _d => (((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 25:6])) as variant#3).0: HasDrop); // in scope 1 at $DIR/generator-tiny.rs:20:13: 20:15
|
||||
debug _d => (((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 19:24])) as variant#3).0: HasDrop); // in scope 1 at $DIR/generator-tiny.rs:20:13: 20:15
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_11 = discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 25:6]))); // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
switchInt(move _11) -> [0_u32: bb1, 3_u32: bb5, otherwise: bb6]; // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
_11 = discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 19:24]))); // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
switchInt(move _11) -> [0_u32: bb1, 3_u32: bb5, otherwise: bb6]; // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_10 = move _2; // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
_10 = move _2; // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
nop; // scope 0 at $DIR/generator-tiny.rs:20:13: 20:15
|
||||
Deinit((((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 25:6])) as variant#3).0: HasDrop)); // scope 0 at $DIR/generator-tiny.rs:20:18: 20:25
|
||||
Deinit((((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 19:24])) as variant#3).0: HasDrop)); // scope 0 at $DIR/generator-tiny.rs:20:18: 20:25
|
||||
StorageLive(_4); // scope 1 at $DIR/generator-tiny.rs:21:9: 24:10
|
||||
goto -> bb2; // scope 1 at $DIR/generator-tiny.rs:21:9: 24:10
|
||||
}
|
||||
@ -50,7 +50,7 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator-tiny.rs:19:16: 25:6]
|
||||
Deinit(_0); // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18
|
||||
((_0 as Yielded).0: ()) = move _7; // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18
|
||||
discriminant(_0) = 0; // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18
|
||||
discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 25:6]))) = 3; // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18
|
||||
discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:19:16: 19:24]))) = 3; // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18
|
||||
return; // scope 1 at $DIR/generator-tiny.rs:22:13: 22:18
|
||||
}
|
||||
|
||||
@ -71,14 +71,14 @@ fn main::{closure#0}(_1: Pin<&mut [generator@$DIR/generator-tiny.rs:19:16: 25:6]
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageLive(_4); // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
StorageLive(_6); // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
StorageLive(_7); // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
_6 = move _2; // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
goto -> bb3; // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
StorageLive(_4); // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
StorageLive(_6); // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
StorageLive(_7); // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
_6 = move _2; // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
goto -> bb3; // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
}
|
||||
|
||||
bb6: {
|
||||
unreachable; // scope 0 at $DIR/generator-tiny.rs:19:16: 25:6
|
||||
unreachable; // scope 0 at $DIR/generator-tiny.rs:19:16: 19:24
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
|
||||
debug t => (*((*_6).1: &T)); // in scope 2 at $DIR/inline-closure-captures.rs:10:17: 10:18
|
||||
let mut _10: i32; // in scope 2 at $DIR/inline-closure-captures.rs:11:19: 11:20
|
||||
let mut _11: T; // in scope 2 at $DIR/inline-closure-captures.rs:11:22: 11:23
|
||||
let mut _12: &i32; // in scope 2 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
let mut _13: &T; // in scope 2 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
let mut _12: &i32; // in scope 2 at $DIR/inline-closure-captures.rs:11:13: 11:17
|
||||
let mut _13: &T; // in scope 2 at $DIR/inline-closure-captures.rs:11:13: 11:17
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,8 +33,8 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
|
||||
Deinit(_3); // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
(_3.0: &i32) = move _4; // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
(_3.1: &T) = move _5; // scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
StorageDead(_5); // scope 0 at $DIR/inline-closure-captures.rs:11:23: 11:24
|
||||
StorageDead(_4); // scope 0 at $DIR/inline-closure-captures.rs:11:23: 11:24
|
||||
StorageDead(_5); // scope 0 at $DIR/inline-closure-captures.rs:11:16: 11:17
|
||||
StorageDead(_4); // scope 0 at $DIR/inline-closure-captures.rs:11:16: 11:17
|
||||
StorageLive(_6); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:6
|
||||
_6 = &_3; // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:6
|
||||
StorageLive(_7); // scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
|
||||
|
@ -4,22 +4,22 @@
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/inline-generator.rs:8:11: 8:11
|
||||
let _1: std::ops::GeneratorState<i32, bool>; // in scope 0 at $DIR/inline-generator.rs:9:9: 9:11
|
||||
let mut _2: std::pin::Pin<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>; // in scope 0 at $DIR/inline-generator.rs:9:14: 9:32
|
||||
let mut _3: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 0 at $DIR/inline-generator.rs:9:23: 9:31
|
||||
let mut _4: [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 0 at $DIR/inline-generator.rs:9:28: 9:31
|
||||
let mut _2: std::pin::Pin<&mut [generator@$DIR/inline-generator.rs:15:5: 15:8]>; // in scope 0 at $DIR/inline-generator.rs:9:14: 9:32
|
||||
let mut _3: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline-generator.rs:9:23: 9:31
|
||||
let mut _4: [generator@$DIR/inline-generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline-generator.rs:9:28: 9:31
|
||||
+ let mut _7: bool; // in scope 0 at $DIR/inline-generator.rs:9:14: 9:46
|
||||
scope 1 {
|
||||
debug _r => _1; // in scope 1 at $DIR/inline-generator.rs:9:9: 9:11
|
||||
}
|
||||
+ scope 2 (inlined g) { // at $DIR/inline-generator.rs:9:28: 9:31
|
||||
+ }
|
||||
+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>::new) { // at $DIR/inline-generator.rs:9:14: 9:32
|
||||
+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:8]>::new) { // at $DIR/inline-generator.rs:9:14: 9:32
|
||||
+ debug pointer => _3; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ let mut _5: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ let mut _5: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ scope 4 {
|
||||
+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>::new_unchecked) { // at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:8]>::new_unchecked) { // at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ debug pointer => _5; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ let mut _6: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ let mut _6: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@ -29,10 +29,10 @@
|
||||
+ let mut _9: bool; // in scope 6 at $DIR/inline-generator.rs:15:20: 15:21
|
||||
+ let mut _10: bool; // in scope 6 at $DIR/inline-generator.rs:15:9: 15:9
|
||||
+ let _11: bool; // in scope 6 at $DIR/inline-generator.rs:15:6: 15:7
|
||||
+ let mut _12: u32; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ let mut _13: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ let mut _14: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ let mut _15: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ let mut _12: u32; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ let mut _13: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ let mut _14: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ let mut _15: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ }
|
||||
|
||||
bb0: {
|
||||
@ -50,11 +50,11 @@
|
||||
+ Deinit(_4); // scope 2 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ discriminant(_4) = 0; // scope 2 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
_3 = &mut _4; // scope 0 at $DIR/inline-generator.rs:9:23: 9:31
|
||||
- _2 = Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>::new(move _3) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:9:14: 9:32
|
||||
- _2 = Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:8]>::new(move _3) -> [return: bb2, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:9:14: 9:32
|
||||
- // mir::Constant
|
||||
- // + span: $DIR/inline-generator.rs:9:14: 9:22
|
||||
- // + user_ty: UserType(0)
|
||||
- // + literal: Const { ty: fn(&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]) -> Pin<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]> {Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>::new}, val: Value(Scalar(<ZST>)) }
|
||||
- // + literal: Const { ty: fn(&mut [generator@$DIR/inline-generator.rs:15:5: 15:8]) -> Pin<&mut [generator@$DIR/inline-generator.rs:15:5: 15:8]> {Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:8]>::new}, val: Value(Scalar(<ZST>)) }
|
||||
- }
|
||||
-
|
||||
- bb2: {
|
||||
@ -63,24 +63,24 @@
|
||||
+ StorageLive(_6); // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ _6 = move _5; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ Deinit(_2); // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]) = move _6; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]) = move _6; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ StorageDead(_6); // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
+ StorageDead(_5); // scope 4 at $SRC_DIR/core/src/pin.rs:LL:COL
|
||||
StorageDead(_3); // scope 0 at $DIR/inline-generator.rs:9:31: 9:32
|
||||
- _1 = <[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
|
||||
- _1 = <[generator@$DIR/inline-generator.rs:15:5: 15:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
|
||||
- // mir::Constant
|
||||
- // + span: $DIR/inline-generator.rs:9:33: 9:39
|
||||
- // + literal: Const { ty: for<'r> fn(Pin<&'r mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>, bool) -> GeneratorState<<[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::Yield, <[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::Return> {<[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::resume}, val: Value(Scalar(<ZST>)) }
|
||||
- // + literal: Const { ty: for<'r> fn(Pin<&'r mut [generator@$DIR/inline-generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline-generator.rs:15:5: 15:8] as Generator<bool>>::Yield, <[generator@$DIR/inline-generator.rs:15:5: 15:8] as Generator<bool>>::Return> {<[generator@$DIR/inline-generator.rs:15:5: 15:8] as Generator<bool>>::resume}, val: Value(Scalar(<ZST>)) }
|
||||
+ StorageLive(_7); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
|
||||
+ _7 = const false; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
|
||||
+ StorageLive(_10); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
|
||||
+ StorageLive(_11); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
|
||||
+ StorageLive(_12); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
|
||||
+ StorageLive(_13); // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ _13 = move (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]); // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ _12 = discriminant((*_13)); // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ StorageDead(_13); // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ switchInt(move _12) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ StorageLive(_13); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ _13 = move (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ _12 = discriminant((*_13)); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ StorageDead(_13); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ switchInt(move _12) -> [0_u32: bb3, 1_u32: bb8, 3_u32: bb7, otherwise: bb9]; // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
}
|
||||
|
||||
- bb3: {
|
||||
@ -102,7 +102,7 @@
|
||||
+ }
|
||||
+
|
||||
+ bb3: {
|
||||
+ _11 = move _7; // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ _11 = move _7; // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ StorageLive(_8); // scope 6 at $DIR/inline-generator.rs:15:17: 15:39
|
||||
+ StorageLive(_9); // scope 6 at $DIR/inline-generator.rs:15:20: 15:21
|
||||
+ _9 = _11; // scope 6 at $DIR/inline-generator.rs:15:20: 15:21
|
||||
@ -125,32 +125,32 @@
|
||||
+ ((_1 as Yielded).0: i32) = move _8; // scope 6 at $DIR/inline-generator.rs:15:11: 15:39
|
||||
+ discriminant(_1) = 0; // scope 6 at $DIR/inline-generator.rs:15:11: 15:39
|
||||
+ StorageLive(_14); // scope 6 at $DIR/inline-generator.rs:15:11: 15:39
|
||||
+ _14 = move (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]); // scope 6 at $DIR/inline-generator.rs:15:11: 15:39
|
||||
+ _14 = move (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline-generator.rs:15:11: 15:39
|
||||
+ discriminant((*_14)) = 3; // scope 6 at $DIR/inline-generator.rs:15:11: 15:39
|
||||
+ StorageDead(_14); // scope 6 at $DIR/inline-generator.rs:15:11: 15:39
|
||||
+ goto -> bb1; // scope 0 at $DIR/inline-generator.rs:15:11: 15:39
|
||||
+ }
|
||||
+
|
||||
+ bb7: {
|
||||
+ StorageLive(_8); // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ _10 = move _7; // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ StorageLive(_8); // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ _10 = move _7; // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ StorageDead(_8); // scope 6 at $DIR/inline-generator.rs:15:38: 15:39
|
||||
+ Deinit(_1); // scope 6 at $DIR/inline-generator.rs:15:41: 15:41
|
||||
+ ((_1 as Complete).0: bool) = move _10; // scope 6 at $DIR/inline-generator.rs:15:41: 15:41
|
||||
+ discriminant(_1) = 1; // scope 6 at $DIR/inline-generator.rs:15:41: 15:41
|
||||
+ StorageLive(_15); // scope 6 at $DIR/inline-generator.rs:15:41: 15:41
|
||||
+ _15 = move (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:41]); // scope 6 at $DIR/inline-generator.rs:15:41: 15:41
|
||||
+ discriminant((*_15)) = 1; // scope 6 at $DIR/inline-generator.rs:15:41: 15:41
|
||||
+ StorageDead(_15); // scope 6 at $DIR/inline-generator.rs:15:41: 15:41
|
||||
+ goto -> bb1; // scope 0 at $DIR/inline-generator.rs:15:41: 15:41
|
||||
+ Deinit(_1); // scope 6 at $DIR/inline-generator.rs:15:8: 15:8
|
||||
+ ((_1 as Complete).0: bool) = move _10; // scope 6 at $DIR/inline-generator.rs:15:8: 15:8
|
||||
+ discriminant(_1) = 1; // scope 6 at $DIR/inline-generator.rs:15:8: 15:8
|
||||
+ StorageLive(_15); // scope 6 at $DIR/inline-generator.rs:15:8: 15:8
|
||||
+ _15 = move (_2.0: &mut [generator@$DIR/inline-generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline-generator.rs:15:8: 15:8
|
||||
+ discriminant((*_15)) = 1; // scope 6 at $DIR/inline-generator.rs:15:8: 15:8
|
||||
+ StorageDead(_15); // scope 6 at $DIR/inline-generator.rs:15:8: 15:8
|
||||
+ goto -> bb1; // scope 0 at $DIR/inline-generator.rs:15:8: 15:8
|
||||
+ }
|
||||
+
|
||||
+ bb8: {
|
||||
+ assert(const false, "generator resumed after completion") -> [success: bb8, unwind: bb2]; // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ assert(const false, "generator resumed after completion") -> [success: bb8, unwind: bb2]; // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
+ }
|
||||
+
|
||||
+ bb9: {
|
||||
+ unreachable; // scope 6 at $DIR/inline-generator.rs:15:5: 15:41
|
||||
+ unreachable; // scope 6 at $DIR/inline-generator.rs:15:5: 15:8
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/issue-76997-inline-scopes-parenting.rs:4:11: 4:11
|
||||
let _1: [closure@$DIR/issue-76997-inline-scopes-parenting.rs:5:13: 5:33]; // in scope 0 at $DIR/issue-76997-inline-scopes-parenting.rs:5:9: 5:10
|
||||
let mut _2: &[closure@$DIR/issue-76997-inline-scopes-parenting.rs:5:13: 5:33]; // in scope 0 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:6
|
||||
let _1: [closure@$DIR/issue-76997-inline-scopes-parenting.rs:5:13: 5:16]; // in scope 0 at $DIR/issue-76997-inline-scopes-parenting.rs:5:9: 5:10
|
||||
let mut _2: &[closure@$DIR/issue-76997-inline-scopes-parenting.rs:5:13: 5:16]; // in scope 0 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:6
|
||||
let mut _3: ((),); // in scope 0 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
|
||||
let mut _4: (); // in scope 0 at $DIR/issue-76997-inline-scopes-parenting.rs:6:7: 6:9
|
||||
let mut _5: (); // in scope 0 at $DIR/issue-76997-inline-scopes-parenting.rs:6:5: 6:10
|
||||
|
@ -9,14 +9,14 @@ fn main::{closure#0}(_1: &[closure@main::{closure#0}], _2: &i32) -> &i32 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
Retag([fn entry] _1); // scope 0 at $DIR/retag.rs:40:31: 43:6
|
||||
Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:40:31: 43:6
|
||||
Retag([fn entry] _1); // scope 0 at $DIR/retag.rs:40:31: 40:48
|
||||
Retag([fn entry] _2); // scope 0 at $DIR/retag.rs:40:31: 40:48
|
||||
StorageLive(_3); // scope 0 at $DIR/retag.rs:41:13: 41:15
|
||||
_3 = _2; // scope 0 at $DIR/retag.rs:41:18: 41:19
|
||||
Retag(_3); // scope 0 at $DIR/retag.rs:41:18: 41:19
|
||||
_0 = _2; // scope 1 at $DIR/retag.rs:42:9: 42:10
|
||||
Retag(_0); // scope 1 at $DIR/retag.rs:42:9: 42:10
|
||||
StorageDead(_3); // scope 0 at $DIR/retag.rs:43:5: 43:6
|
||||
return; // scope 0 at $DIR/retag.rs:43:6: 43:6
|
||||
return; // scope 0 at $DIR/retag.rs:40:48: 40:48
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ fn main() -> () {
|
||||
// ]
|
||||
Retag(_14); // scope 1 at $DIR/retag.rs:40:31: 43:6
|
||||
_13 = move _14 as for<'r> fn(&'r i32) -> &'r i32 (Pointer(ClosureFnPointer(Normal))); // scope 1 at $DIR/retag.rs:40:31: 43:6
|
||||
StorageDead(_14); // scope 1 at $DIR/retag.rs:43:5: 43:6
|
||||
StorageDead(_14); // scope 1 at $DIR/retag.rs:40:47: 40:48
|
||||
StorageLive(_15); // scope 6 at $DIR/retag.rs:44:9: 44:11
|
||||
StorageLive(_16); // scope 6 at $DIR/retag.rs:44:14: 44:15
|
||||
_16 = _13; // scope 6 at $DIR/retag.rs:44:14: 44:15
|
||||
|
@ -37,7 +37,7 @@
|
||||
37| 0| countdown = 10;
|
||||
38| 0| }
|
||||
39| 0| "alt string 2".to_owned()
|
||||
40| 0| };
|
||||
40| | };
|
||||
41| 1| println!(
|
||||
42| 1| "The string or alt: {}"
|
||||
43| 1| ,
|
||||
@ -79,7 +79,7 @@
|
||||
79| 0| countdown = 10;
|
||||
80| 1| }
|
||||
81| 1| "alt string 4".to_owned()
|
||||
82| 1| };
|
||||
82| | };
|
||||
83| 1| println!(
|
||||
84| 1| "The string or alt: {}"
|
||||
85| 1| ,
|
||||
@ -101,7 +101,7 @@
|
||||
101| 0| countdown = 10;
|
||||
102| 5| }
|
||||
103| 5| format!("'{}'", val)
|
||||
104| 5| };
|
||||
104| | };
|
||||
105| 1| println!(
|
||||
106| 1| "Repeated, quoted string: {:?}"
|
||||
107| 1| ,
|
||||
@ -125,7 +125,7 @@
|
||||
125| 0| countdown = 10;
|
||||
126| 0| }
|
||||
127| 0| "closure should be unused".to_owned()
|
||||
128| 0| };
|
||||
128| | };
|
||||
129| |
|
||||
130| 1| let mut countdown = 10;
|
||||
131| 1| let _short_unused_closure = | _unused_arg: u8 | countdown += 1;
|
||||
@ -177,7 +177,7 @@
|
||||
173| 0| println!(
|
||||
174| 0| "not called: {}",
|
||||
175| 0| if is_true { "check" } else { "me" }
|
||||
176| 0| )
|
||||
176| | )
|
||||
177| | ;
|
||||
178| |
|
||||
179| 1| let short_used_not_covered_closure_line_break_block_embedded_branch =
|
||||
@ -187,7 +187,7 @@
|
||||
183| 0| "not called: {}",
|
||||
184| 0| if is_true { "check" } else { "me" }
|
||||
185| | )
|
||||
186| 0| }
|
||||
186| | }
|
||||
187| | ;
|
||||
188| |
|
||||
189| 1| let short_used_covered_closure_line_break_no_block_embedded_branch =
|
||||
@ -196,7 +196,7 @@
|
||||
192| 1| "not called: {}",
|
||||
193| 1| if is_true { "check" } else { "me" }
|
||||
^0
|
||||
194| 1| )
|
||||
194| | )
|
||||
195| | ;
|
||||
196| |
|
||||
197| 1| let short_used_covered_closure_line_break_block_embedded_branch =
|
||||
@ -207,7 +207,7 @@
|
||||
202| 1| if is_true { "check" } else { "me" }
|
||||
^0
|
||||
203| | )
|
||||
204| 1| }
|
||||
204| | }
|
||||
205| | ;
|
||||
206| |
|
||||
207| 1| if is_false {
|
||||
|
@ -18,7 +18,7 @@
|
||||
17| 1| let mut generator = || {
|
||||
18| 1| yield get_u32(is_true);
|
||||
19| 1| return "foo";
|
||||
20| 1| };
|
||||
20| | };
|
||||
21| |
|
||||
22| 1| match Pin::new(&mut generator).resume(()) {
|
||||
23| 1| GeneratorState::Yielded(Ok(1)) => {}
|
||||
|
@ -8,7 +8,7 @@
|
||||
8| 1| let mut generator = || {
|
||||
9| 1| yield 1;
|
||||
10| 1| return "foo"
|
||||
11| 1| };
|
||||
11| | };
|
||||
12| |
|
||||
13| 1| match Pin::new(&mut generator).resume(()) {
|
||||
14| 1| GeneratorState::Yielded(1) => {}
|
||||
@ -24,7 +24,7 @@
|
||||
24| 1| yield 2;
|
||||
25| 0| yield 3;
|
||||
26| 0| return "foo"
|
||||
27| 0| };
|
||||
27| | };
|
||||
28| |
|
||||
29| 1| match Pin::new(&mut generator).resume(()) {
|
||||
30| 1| GeneratorState::Yielded(1) => {}
|
||||
|
@ -22,7 +22,7 @@ LL | asm!("{:v}", in(vreg) SimdNonCopy(0.0, 0.0, 0.0, 0.0));
|
||||
|
|
||||
= note: `SimdNonCopy` does not implement the Copy trait
|
||||
|
||||
error: cannot use value of type `[closure@$DIR/type-check-2.rs:41:28: 41:38]` for inline assembly
|
||||
error: cannot use value of type `[closure@$DIR/type-check-2.rs:41:28: 41:36]` for inline assembly
|
||||
--> $DIR/type-check-2.rs:41:28
|
||||
|
|
||||
LL | asm!("{}", in(reg) |x: i32| x);
|
||||
|
@ -30,7 +30,7 @@ LL | asm!("{}", in(xmm_reg) SimdNonCopy(0.0, 0.0, 0.0, 0.0));
|
||||
|
|
||||
= note: `SimdNonCopy` does not implement the Copy trait
|
||||
|
||||
error: cannot use value of type `[closure@$DIR/type-check-2.rs:52:28: 52:38]` for inline assembly
|
||||
error: cannot use value of type `[closure@$DIR/type-check-2.rs:52:28: 52:36]` for inline assembly
|
||||
--> $DIR/type-check-2.rs:52:28
|
||||
|
|
||||
LL | asm!("{}", in(reg) |x: i32| x);
|
||||
|
@ -9,11 +9,8 @@ LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
|
||||
note: required because it's used within this closure
|
||||
--> $DIR/issue-70935-complex-spans.rs:25:13
|
||||
|
|
||||
LL | baz(|| async{
|
||||
| _____________^
|
||||
LL | | foo(tx.clone());
|
||||
LL | | }).await;
|
||||
| |_________^
|
||||
LL | baz(|| async{
|
||||
| ^^
|
||||
note: required because it's used within this `async fn` body
|
||||
--> $DIR/issue-70935-complex-spans.rs:9:67
|
||||
|
|
||||
|
@ -14,7 +14,7 @@ LL | | foo(tx.clone());
|
||||
LL | | }).await;
|
||||
| | - ^^^^^^ await occurs here, with the value maybe used later
|
||||
| |_________|
|
||||
| has type `[closure@$DIR/issue-70935-complex-spans.rs:25:13: 27:10]` which is not `Send`
|
||||
| has type `[closure@$DIR/issue-70935-complex-spans.rs:25:13: 25:15]` which is not `Send`
|
||||
note: the value is later dropped here
|
||||
--> $DIR/issue-70935-complex-spans.rs:27:17
|
||||
|
|
||||
|
@ -24,15 +24,15 @@ LL | fn main() {
|
||||
LL | (|_| 2333).await;
|
||||
| ^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
|
||||
error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
|
||||
--> $DIR/issue-62009-1.rs:12:15
|
||||
|
|
||||
LL | (|_| 2333).await;
|
||||
| ^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
|
||||
| ^^^^^^ `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
|
||||
= note: [closure@$DIR/issue-62009-1.rs:12:5: 12:15] must be a future or must implement `IntoFuture` to be awaited
|
||||
= note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
|
||||
= help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
|
||||
= note: [closure@$DIR/issue-62009-1.rs:12:6: 12:9] must be a future or must implement `IntoFuture` to be awaited
|
||||
= note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
|
||||
help: remove the `.await`
|
||||
|
|
||||
LL - (|_| 2333).await;
|
||||
|
@ -7,7 +7,7 @@ LL | |y| x + y
|
||||
| ^^^^^^^^^ expected `()`, found closure
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14]`
|
||||
found closure `[closure@$DIR/issue-20862.rs:2:5: 2:8]`
|
||||
|
||||
error[E0618]: expected function, found `()`
|
||||
--> $DIR/issue-20862.rs:7:13
|
||||
|
@ -1,15 +1,13 @@
|
||||
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/borrow-immutable-upvar-mutation-impl-trait.rs:11:9
|
||||
|
|
||||
LL | fn bar() -> impl Fn() -> usize {
|
||||
| --- ------------------ change this to return `FnMut` instead of `Fn`
|
||||
LL | let mut x = 0;
|
||||
LL | / move || {
|
||||
LL | | x += 1;
|
||||
| | ^^^^^^ cannot assign
|
||||
LL | | x
|
||||
LL | | }
|
||||
| |_____- in this closure
|
||||
LL | fn bar() -> impl Fn() -> usize {
|
||||
| --- ------------------ change this to return `FnMut` instead of `Fn`
|
||||
LL | let mut x = 0;
|
||||
LL | move || {
|
||||
| ------- in this closure
|
||||
LL | x += 1;
|
||||
| ^^^^^^ cannot assign
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,8 +5,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | let _f = to_fn(|| x = 42);
|
||||
| ----- ^^^^^^ cannot assign
|
||||
| |
|
||||
| ----- -- ^^^^^^ cannot assign
|
||||
| | |
|
||||
| | in this closure
|
||||
| expects `Fn` instead of `FnMut`
|
||||
|
||||
error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
|
||||
@ -16,8 +17,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | let _g = to_fn(|| set(&mut y));
|
||||
| ----- ^^^^^^ cannot borrow as mutable
|
||||
| |
|
||||
| ----- -- ^^^^^^ cannot borrow as mutable
|
||||
| | |
|
||||
| | in this closure
|
||||
| expects `Fn` instead of `FnMut`
|
||||
|
||||
error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
|
||||
@ -27,8 +29,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | to_fn(|| z = 42);
|
||||
| ----- ^^^^^^ cannot assign
|
||||
| |
|
||||
| ----- -- ^^^^^^ cannot assign
|
||||
| | |
|
||||
| | in this closure
|
||||
| expects `Fn` instead of `FnMut`
|
||||
|
||||
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
||||
@ -38,8 +41,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | let _f = to_fn(move || x = 42);
|
||||
| ----- ^^^^^^ cannot assign
|
||||
| |
|
||||
| ----- ------- ^^^^^^ cannot assign
|
||||
| | |
|
||||
| | in this closure
|
||||
| expects `Fn` instead of `FnMut`
|
||||
|
||||
error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
|
||||
@ -49,8 +53,9 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | let _g = to_fn(move || set(&mut y));
|
||||
| ----- ^^^^^^ cannot borrow as mutable
|
||||
| |
|
||||
| ----- ------- ^^^^^^ cannot borrow as mutable
|
||||
| | |
|
||||
| | in this closure
|
||||
| expects `Fn` instead of `FnMut`
|
||||
|
||||
error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
|
||||
@ -60,23 +65,21 @@ LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | to_fn(move || z = 42);
|
||||
| ----- ^^^^^^ cannot assign
|
||||
| |
|
||||
| ----- ------- ^^^^^^ cannot assign
|
||||
| | |
|
||||
| | in this closure
|
||||
| expects `Fn` instead of `FnMut`
|
||||
|
||||
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/borrow-immutable-upvar-mutation.rs:53:9
|
||||
|
|
||||
LL | fn foo() -> Box<dyn Fn() -> usize> {
|
||||
| --- ---------------------- change this to return `FnMut` instead of `Fn`
|
||||
LL | let mut x = 0;
|
||||
LL | Box::new(move || {
|
||||
| ______________-
|
||||
LL | | x += 1;
|
||||
| | ^^^^^^ cannot assign
|
||||
LL | | x
|
||||
LL | | })
|
||||
| |_____- in this closure
|
||||
LL | fn foo() -> Box<dyn Fn() -> usize> {
|
||||
| --- ---------------------- change this to return `FnMut` instead of `Fn`
|
||||
LL | let mut x = 0;
|
||||
LL | Box::new(move || {
|
||||
| ------- in this closure
|
||||
LL | x += 1;
|
||||
| ^^^^^^ cannot assign
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
@ -29,32 +29,28 @@ LL | f();
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:29:17
|
||||
|
|
||||
LL | fn make_fn<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn make_fn<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | let f = make_fn(|| {
|
||||
| _____________-------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | let y = &raw mut x;
|
||||
| | ^^^^^^^^^^ cannot borrow as mutable
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | let f = make_fn(|| {
|
||||
| ------- -- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
LL | let y = &raw mut x;
|
||||
| ^^^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/borrow-raw-address-of-mutability.rs:37:17
|
||||
|
|
||||
LL | fn make_fn<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn make_fn<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | let f = make_fn(move || {
|
||||
| _____________-------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | let y = &raw mut x;
|
||||
| | ^^^^^^^^^^ cannot borrow as mutable
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | let f = make_fn(move || {
|
||||
| ------- ------- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
LL | let y = &raw mut x;
|
||||
| ^^^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -4,9 +4,8 @@ error[E0507]: cannot move out of `x`, a captured variable in an `Fn` closure
|
||||
LL | let x = Box::new(0);
|
||||
| - captured outer variable
|
||||
LL | Box::new(|| x)
|
||||
| ---^
|
||||
| | |
|
||||
| | move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
|
||||
| -- ^ move occurs because `x` has type `Box<i32>`, which does not implement the `Copy` trait
|
||||
| |
|
||||
| captured by this `Fn` closure
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -1,18 +1,16 @@
|
||||
error[E0507]: cannot move out of `bar`, a captured variable in an `FnMut` closure
|
||||
--> $DIR/borrowck-move-by-capture.rs:9:29
|
||||
|
|
||||
LL | let bar: Box<_> = Box::new(3);
|
||||
| --- captured outer variable
|
||||
LL | let _g = to_fn_mut(|| {
|
||||
| ________________________-
|
||||
LL | | let _h = to_fn_once(move || -> isize { *bar });
|
||||
| | ^^^^^^^^^^^^^^^^ ----
|
||||
| | | |
|
||||
| | | variable moved due to use in closure
|
||||
| | | move occurs because `bar` has type `Box<isize>`, which does not implement the `Copy` trait
|
||||
| | move out of `bar` occurs here
|
||||
LL | | });
|
||||
| |_____- captured by this `FnMut` closure
|
||||
LL | let bar: Box<_> = Box::new(3);
|
||||
| --- captured outer variable
|
||||
LL | let _g = to_fn_mut(|| {
|
||||
| -- captured by this `FnMut` closure
|
||||
LL | let _h = to_fn_once(move || -> isize { *bar });
|
||||
| ^^^^^^^^^^^^^^^^ ----
|
||||
| | |
|
||||
| | variable moved due to use in closure
|
||||
| | move occurs because `bar` has type `Box<isize>`, which does not implement the `Copy` trait
|
||||
| move out of `bar` occurs here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -4,7 +4,7 @@ error: lifetime may not live long enough
|
||||
LL | let _action = move || {
|
||||
| -------
|
||||
| | |
|
||||
| | return type of closure `[closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:15]` contains a lifetime `'2`
|
||||
| | return type of closure `[closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:11]` contains a lifetime `'2`
|
||||
| lifetime `'1` represents this closure's body
|
||||
LL | || f() // The `nested` closure
|
||||
| ^^^^^^ returning this value requires that `'1` must outlive `'2`
|
||||
|
@ -8,7 +8,7 @@ LL | panic!()
|
||||
| ^^^^^^^^
|
||||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/issue-81899.rs:12:5
|
||||
| inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
| inside `f::<[closure@$DIR/issue-81899.rs:4:31: 4:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
@ -1,21 +1,17 @@
|
||||
error[E0507]: cannot move out of `val`, a captured variable in an `FnMut` closure
|
||||
--> $DIR/issue-87456-point-to-closure.rs:10:28
|
||||
|
|
||||
LL | let val = String::new();
|
||||
| --- captured outer variable
|
||||
LL | let val = String::new();
|
||||
| --- captured outer variable
|
||||
LL |
|
||||
LL | take_mut(|| {
|
||||
| ______________-
|
||||
LL | |
|
||||
LL | | let _foo: String = val;
|
||||
| | ^^^
|
||||
| | |
|
||||
| | move occurs because `val` has type `String`, which does not implement the `Copy` trait
|
||||
| | help: consider borrowing here: `&val`
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | })
|
||||
| |_____- captured by this `FnMut` closure
|
||||
LL | take_mut(|| {
|
||||
| -- captured by this `FnMut` closure
|
||||
LL |
|
||||
LL | let _foo: String = val;
|
||||
| ^^^
|
||||
| |
|
||||
| move occurs because `val` has type `String`, which does not implement the `Copy` trait
|
||||
| help: consider borrowing here: `&val`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,7 +8,7 @@ LL | panic!()
|
||||
| ^^^^^^^^
|
||||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:11:5
|
||||
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:28]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
@ -8,7 +8,7 @@ LL | panic!()
|
||||
| ^^^^^^^^
|
||||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:11:5
|
||||
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34]>` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
@ -119,146 +119,112 @@ LL | &mut (*f()).0;
|
||||
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/mutability-errors.rs:40:9
|
||||
|
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | fn_ref(|| {
|
||||
| _____------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | x = (1,);
|
||||
| | ^^^^^^^^ cannot assign
|
||||
LL | | x.0 = 1;
|
||||
LL | | &mut x;
|
||||
LL | | &mut x.0;
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | fn_ref(|| {
|
||||
| ------ -- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
LL | x = (1,);
|
||||
| ^^^^^^^^ cannot assign
|
||||
|
||||
error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
|
||||
--> $DIR/mutability-errors.rs:41:9
|
||||
|
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | fn_ref(|| {
|
||||
| _____------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | x = (1,);
|
||||
LL | | x.0 = 1;
|
||||
| | ^^^^^^^ cannot assign
|
||||
LL | | &mut x;
|
||||
LL | | &mut x.0;
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | fn_ref(|| {
|
||||
| ------ -- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
LL | x = (1,);
|
||||
LL | x.0 = 1;
|
||||
| ^^^^^^^ cannot assign
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/mutability-errors.rs:42:9
|
||||
|
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | fn_ref(|| {
|
||||
| _____------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | x = (1,);
|
||||
LL | | x.0 = 1;
|
||||
LL | | &mut x;
|
||||
| | ^^^^^^ cannot borrow as mutable
|
||||
LL | | &mut x.0;
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | fn_ref(|| {
|
||||
| ------ -- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
...
|
||||
LL | &mut x;
|
||||
| ^^^^^^ cannot borrow as mutable
|
||||
|
||||
error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
|
||||
--> $DIR/mutability-errors.rs:43:9
|
||||
|
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | fn_ref(|| {
|
||||
| _____------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | x = (1,);
|
||||
LL | | x.0 = 1;
|
||||
LL | | &mut x;
|
||||
LL | | &mut x.0;
|
||||
| | ^^^^^^^^ cannot borrow as mutable
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | fn_ref(|| {
|
||||
| ------ -- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
...
|
||||
LL | &mut x.0;
|
||||
| ^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/mutability-errors.rs:46:9
|
||||
|
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | fn_ref(move || {
|
||||
| _____------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | x = (1,);
|
||||
| | ^^^^^^^^ cannot assign
|
||||
LL | | x.0 = 1;
|
||||
LL | | &mut x;
|
||||
LL | | &mut x.0;
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | fn_ref(move || {
|
||||
| ------ ------- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
LL | x = (1,);
|
||||
| ^^^^^^^^ cannot assign
|
||||
|
||||
error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables
|
||||
--> $DIR/mutability-errors.rs:47:9
|
||||
|
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | fn_ref(move || {
|
||||
| _____------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | x = (1,);
|
||||
LL | | x.0 = 1;
|
||||
| | ^^^^^^^ cannot assign
|
||||
LL | | &mut x;
|
||||
LL | | &mut x.0;
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | fn_ref(move || {
|
||||
| ------ ------- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
LL | x = (1,);
|
||||
LL | x.0 = 1;
|
||||
| ^^^^^^^ cannot assign
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/mutability-errors.rs:48:9
|
||||
|
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | fn_ref(move || {
|
||||
| _____------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | x = (1,);
|
||||
LL | | x.0 = 1;
|
||||
LL | | &mut x;
|
||||
| | ^^^^^^ cannot borrow as mutable
|
||||
LL | | &mut x.0;
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | fn_ref(move || {
|
||||
| ------ ------- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
...
|
||||
LL | &mut x;
|
||||
| ^^^^^^ cannot borrow as mutable
|
||||
|
||||
error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables
|
||||
--> $DIR/mutability-errors.rs:49:9
|
||||
|
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | fn_ref(move || {
|
||||
| _____------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | x = (1,);
|
||||
LL | | x.0 = 1;
|
||||
LL | | &mut x;
|
||||
LL | | &mut x.0;
|
||||
| | ^^^^^^^^ cannot borrow as mutable
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | fn_ref(move || {
|
||||
| ------ ------- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
...
|
||||
LL | &mut x.0;
|
||||
| ^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
|
||||
--> $DIR/mutability-errors.rs:54:5
|
||||
|
@ -1,17 +1,14 @@
|
||||
error[E0507]: cannot move out of `y`, a captured variable in an `Fn` closure
|
||||
--> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:11:9
|
||||
|
|
||||
LL | let y = vec![format!("World")];
|
||||
| - captured outer variable
|
||||
LL | call(|| {
|
||||
| __________-
|
||||
LL | | y.into_iter();
|
||||
| | ^ ----------- `y` moved due to this method call
|
||||
| | |
|
||||
| | move occurs because `y` has type `Vec<String>`, which does not implement the `Copy` trait
|
||||
LL | |
|
||||
LL | | });
|
||||
| |_____- captured by this `Fn` closure
|
||||
LL | let y = vec![format!("World")];
|
||||
| - captured outer variable
|
||||
LL | call(|| {
|
||||
| -- captured by this `Fn` closure
|
||||
LL | y.into_iter();
|
||||
| ^ ----------- `y` moved due to this method call
|
||||
| |
|
||||
| move occurs because `y` has type `Vec<String>`, which does not implement the `Copy` trait
|
||||
|
|
||||
note: this function takes ownership of the receiver `self`, which moves `y`
|
||||
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
|
||||
|
@ -2,7 +2,7 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
|
||||
--> $DIR/auto_traits.rs:22:19
|
||||
|
|
||||
LL | thread::spawn(move || unsafe {
|
||||
| ^^^^^^^^^^^^^^ in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr` is not fully captured and `fptr.0` does not implement `Send`
|
||||
| ^^^^^^^ in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr` is not fully captured and `fptr.0` does not implement `Send`
|
||||
...
|
||||
LL | *fptr.0 = 20;
|
||||
| ------- in Rust 2018, this closure captures all of `fptr`, but in Rust 2021, it will only capture `fptr.0`
|
||||
@ -26,7 +26,7 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
|
||||
--> $DIR/auto_traits.rs:42:19
|
||||
|
|
||||
LL | thread::spawn(move || unsafe {
|
||||
| ^^^^^^^^^^^^^^
|
||||
| ^^^^^^^
|
||||
| |
|
||||
| in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr` is not fully captured and `fptr.0.0` does not implement `Send`
|
||||
| in Rust 2018, this closure implements `Sync` as `fptr` implements `Sync`, but in Rust 2021, this closure will no longer implement `Sync` because `fptr` is not fully captured and `fptr.0.0` does not implement `Sync`
|
||||
|
@ -2,14 +2,10 @@ warning: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/closure-body-macro-fragment.rs:16:17
|
||||
|
|
||||
LL | let f = || $body;
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | | f();
|
||||
LL | | }};
|
||||
| | - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure
|
||||
LL | | ($body:block) => {{
|
||||
LL | | m!(@ $body);
|
||||
| |__________________^
|
||||
| ^^
|
||||
...
|
||||
LL | }};
|
||||
| - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure
|
||||
...
|
||||
LL | / m!({
|
||||
LL | |
|
||||
|
@ -2,9 +2,7 @@ error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/macro.rs:19:13
|
||||
|
|
||||
LL | let _ = || dbg!(a.0);
|
||||
| ^^^^^^^^---^
|
||||
| |
|
||||
| in Rust 2018, this closure captures all of `a`, but in Rust 2021, it will only capture `a.0`
|
||||
| ^^ --- in Rust 2018, this closure captures all of `a`, but in Rust 2021, it will only capture `a.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `a` is dropped here, but in Rust 2021, only `a.0` will be dropped here as part of the closure
|
||||
|
@ -26,9 +26,7 @@ error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/migrations_rustfix.rs:33:13
|
||||
|
|
||||
LL | let c = || t.0;
|
||||
| ^^^---
|
||||
| |
|
||||
| in Rust 2018, this closure captures all of `t`, but in Rust 2021, it will only capture `t.0`
|
||||
| ^^ --- in Rust 2018, this closure captures all of `t`, but in Rust 2021, it will only capture `t.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `t` is dropped here, but in Rust 2021, only `t.0` will be dropped here as part of the closure
|
||||
|
@ -92,7 +92,7 @@ error: changes to closure capture in Rust 2021 will affect which traits the clos
|
||||
--> $DIR/multi_diagnostics.rs:133:19
|
||||
|
|
||||
LL | thread::spawn(move || unsafe {
|
||||
| ^^^^^^^^^^^^^^
|
||||
| ^^^^^^^
|
||||
| |
|
||||
| in Rust 2018, this closure implements `Send` as `fptr1` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` because `fptr1` is not fully captured and `fptr1.0.0` does not implement `Send`
|
||||
| in Rust 2018, this closure implements `Sync` as `fptr1` implements `Sync`, but in Rust 2021, this closure will no longer implement `Sync` because `fptr1` is not fully captured and `fptr1.0.0` does not implement `Sync`
|
||||
|
@ -199,9 +199,7 @@ error: changes to closure capture in Rust 2021 will affect drop order
|
||||
--> $DIR/significant_drop.rs:201:18
|
||||
|
|
||||
LL | let _c = || tup.0;
|
||||
| ^^^-----
|
||||
| |
|
||||
| in Rust 2018, this closure captures all of `tup`, but in Rust 2021, it will only capture `tup.0`
|
||||
| ^^ ----- in Rust 2018, this closure captures all of `tup`, but in Rust 2021, it will only capture `tup.0`
|
||||
...
|
||||
LL | }
|
||||
| - in Rust 2018, `tup` is dropped here, but in Rust 2021, only `tup.0` will be dropped here as part of the closure
|
||||
|
@ -9,12 +9,8 @@ LL | let t = thread::spawn(|| {
|
||||
note: required because it's used within this closure
|
||||
--> $DIR/closure-move-sync.rs:6:27
|
||||
|
|
||||
LL | let t = thread::spawn(|| {
|
||||
| ___________________________^
|
||||
LL | | recv.recv().unwrap();
|
||||
LL | |
|
||||
LL | | });
|
||||
| |_____^
|
||||
LL | let t = thread::spawn(|| {
|
||||
| ^^
|
||||
note: required by a bound in `spawn`
|
||||
--> $SRC_DIR/std/src/thread/mod.rs:LL:COL
|
||||
|
|
||||
@ -33,7 +29,7 @@ note: required because it's used within this closure
|
||||
--> $DIR/closure-move-sync.rs:18:19
|
||||
|
|
||||
LL | thread::spawn(|| tx.send(()).unwrap());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^
|
||||
note: required by a bound in `spawn`
|
||||
--> $SRC_DIR/std/src/thread/mod.rs:LL:COL
|
||||
|
|
||||
|
@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected fn pointer `fn(u8) -> u8`
|
||||
found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50]`
|
||||
found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:36]`
|
||||
note: closures can only be coerced to `fn` types if they do not capture any variables
|
||||
--> $DIR/closure-no-fn-1.rs:6:39
|
||||
|
|
||||
|
@ -7,7 +7,7 @@ LL | let bar: fn() -> u8 = || { b };
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected fn pointer `fn() -> u8`
|
||||
found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35]`
|
||||
found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:29]`
|
||||
note: closures can only be coerced to `fn` types if they do not capture any variables
|
||||
--> $DIR/closure-no-fn-2.rs:6:32
|
||||
|
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:27: 6:37]` as `fn() -> u8`
|
||||
error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:28: 6:30]` as `fn() -> u8`
|
||||
--> $DIR/closure-no-fn-3.rs:6:27
|
||||
|
|
||||
LL | let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
|
||||
|
@ -12,7 +12,7 @@ LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected fn pointer `fn(usize) -> usize`
|
||||
found closure `[closure@$DIR/closure-no-fn-4.rs:5:18: 5:27]`
|
||||
found closure `[closure@$DIR/closure-no-fn-4.rs:5:18: 5:21]`
|
||||
note: closures can only be coerced to `fn` types if they do not capture any variables
|
||||
--> $DIR/closure-no-fn-4.rs:5:26
|
||||
|
|
||||
|
@ -7,7 +7,7 @@ LL | let bar: fn() -> u8 = || { a; b; c; d; e };
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected fn pointer `fn() -> u8`
|
||||
found closure `[closure@$DIR/closure-no-fn-5.rs:10:27: 10:47]`
|
||||
found closure `[closure@$DIR/closure-no-fn-5.rs:10:27: 10:29]`
|
||||
note: closures can only be coerced to `fn` types if they do not capture any variables
|
||||
--> $DIR/closure-no-fn-5.rs:10:32
|
||||
|
|
||||
|
@ -2,14 +2,14 @@ error[E0308]: mismatched types
|
||||
--> $DIR/closure-reform-bad.rs:11:15
|
||||
|
|
||||
LL | let f = |s: &str| println!("{}{}", s, string);
|
||||
| ------------------------------------- the found closure
|
||||
| --------- the found closure
|
||||
LL | call_bare(f)
|
||||
| --------- ^ expected fn pointer, found closure
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
= note: expected fn pointer `for<'r> fn(&'r str)`
|
||||
found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50]`
|
||||
found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:22]`
|
||||
note: closures can only be coerced to `fn` types if they do not capture any variables
|
||||
--> $DIR/closure-reform-bad.rs:10:43
|
||||
|
|
||||
|
@ -2,9 +2,8 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closur
|
||||
--> $DIR/closure-wrong-kind.rs:10:19
|
||||
|
|
||||
LL | let closure = |_| foo(x);
|
||||
| ^^^^^^^^-^
|
||||
| | |
|
||||
| | closure is `FnOnce` because it moves the variable `x` out of its environment
|
||||
| ^^^ - closure is `FnOnce` because it moves the variable `x` out of its environment
|
||||
| |
|
||||
| this closure implements `FnOnce`, not `Fn`
|
||||
LL | bar(closure);
|
||||
| --- the requirement to implement `Fn` derives from here
|
||||
|
@ -12,7 +12,7 @@ LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected fn item `fn(i32, i32) -> i32 {add}`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:43]`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:22]`
|
||||
|
||||
error[E0308]: `match` arms have incompatible types
|
||||
--> $DIR/closure_cap_coerce_many_fail.rs:18:16
|
||||
@ -23,15 +23,15 @@ LL | | "+" => |a, b| (a + b) as i32,
|
||||
| | ---------------------
|
||||
| | |
|
||||
| | the expected closure
|
||||
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]`
|
||||
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22]`
|
||||
LL | | "-" => |a, b| (a - b + cap) as i32,
|
||||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
||||
LL | | _ => unimplemented!(),
|
||||
LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:43]`
|
||||
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:22]`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:22]`
|
||||
= note: no two closures, even if identical, have the same type
|
||||
= help: consider boxing your closure and/or using it as a trait object
|
||||
|
||||
@ -44,15 +44,15 @@ LL | | "+" => |a, b| (a + b + cap) as i32,
|
||||
| | ---------------------------
|
||||
| | |
|
||||
| | the expected closure
|
||||
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
|
||||
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22]`
|
||||
LL | | "-" => |a, b| (a - b) as i32,
|
||||
| | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
||||
LL | | _ => unimplemented!(),
|
||||
LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:37]`
|
||||
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:22]`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:22]`
|
||||
= note: no two closures, even if identical, have the same type
|
||||
= help: consider boxing your closure and/or using it as a trait object
|
||||
|
||||
@ -65,15 +65,15 @@ LL | | "+" => |a, b| (a + b + cap) as i32,
|
||||
| | ---------------------------
|
||||
| | |
|
||||
| | the expected closure
|
||||
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
|
||||
| | this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22]`
|
||||
LL | | "-" => |a, b| (a - b + cap) as i32,
|
||||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
||||
LL | | _ => unimplemented!(),
|
||||
LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:43]`
|
||||
= note: expected closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:22]`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:22]`
|
||||
= note: no two closures, even if identical, have the same type
|
||||
= help: consider boxing your closure and/or using it as a trait object
|
||||
|
||||
|
@ -2,7 +2,7 @@ error[E0382]: use of moved value: `c`
|
||||
--> $DIR/closure-print-generic-1.rs:17:5
|
||||
|
|
||||
LL | let c = to_fn_once(move || {
|
||||
| - move occurs because `c` has type `[closure@$DIR/closure-print-generic-1.rs:12:24: 14:6]`, which does not implement the `Copy` trait
|
||||
| - move occurs because `c` has type `[closure@$DIR/closure-print-generic-1.rs:12:24: 12:31]`, which does not implement the `Copy` trait
|
||||
...
|
||||
LL | c();
|
||||
| --- `c` moved due to this call
|
||||
|
@ -2,14 +2,14 @@ error[E0308]: mismatched types
|
||||
--> $DIR/closure-print-generic-2.rs:6:22
|
||||
|
|
||||
LL | let c = || println!("{} {}", t, x);
|
||||
| -------------------------- the found closure
|
||||
| -- the found closure
|
||||
LL | let c1: () = c;
|
||||
| -- ^ expected `()`, found closure
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found closure `[closure@$DIR/closure-print-generic-2.rs:5:17: 5:43]`
|
||||
found closure `[closure@$DIR/closure-print-generic-2.rs:5:17: 5:19]`
|
||||
help: use parentheses to call this closure
|
||||
|
|
||||
LL | let c1: () = c();
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/closure-print-generic-trim-off-verbose-2.rs:9:23
|
||||
|
|
||||
LL | let c = || println!("{} {}", t, x);
|
||||
| -------------------------- the found closure
|
||||
| -- the found closure
|
||||
LL | let c1 : () = c;
|
||||
| -- ^ expected `()`, found closure
|
||||
| |
|
||||
|
@ -2,7 +2,7 @@ error[E0308]: mismatched types
|
||||
--> $DIR/closure-print-generic-verbose-2.rs:9:23
|
||||
|
|
||||
LL | let c = || println!("{} {}", t, x);
|
||||
| -------------------------- the found closure
|
||||
| -- the found closure
|
||||
LL | let c1 : () = c;
|
||||
| -- ^ expected `()`, found closure
|
||||
| |
|
||||
|
@ -32,7 +32,7 @@ LL | let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
|
||||
|
|
||||
= note: expected struct `Box<dyn Fn(i32) -> u8>`
|
||||
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>`
|
||||
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:22]>`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:14:13
|
||||
@ -86,7 +86,7 @@ LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _;
|
||||
| ^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
|
||||
|
|
||||
= note: expected reference `&dyn Fn(i32) -> u8`
|
||||
found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]`
|
||||
found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:19]`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-expect-unsized-ascribed.rs:22:13
|
||||
@ -122,7 +122,7 @@ LL | let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure
|
||||
|
|
||||
= note: expected struct `Box<dyn Fn(i32) -> u8>`
|
||||
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>`
|
||||
found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:25]>`
|
||||
|
||||
error: aborting due to 14 previous errors
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0599]: no method named `closure` found for reference `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope
|
||||
error[E0599]: no method named `closure` found for reference `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope
|
||||
--> $DIR/issue-33784.rs:27:7
|
||||
|
|
||||
LL | p.closure();
|
||||
@ -9,7 +9,7 @@ help: to call the function stored in `closure`, surround the field access with p
|
||||
LL | (p.closure)();
|
||||
| + +
|
||||
|
||||
error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope
|
||||
error[E0599]: no method named `fn_ptr` found for reference `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:45]>` in the current scope
|
||||
--> $DIR/issue-33784.rs:29:7
|
||||
|
|
||||
LL | q.fn_ptr();
|
||||
|
@ -6,6 +6,7 @@ pub fn foo() {
|
||||
//~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
||||
//~| NOTE cannot assign
|
||||
//~| NOTE expects `Fn` instead of `FnMut`
|
||||
//~| NOTE in this closure
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -5,8 +5,9 @@ LL | pub fn bar<F: Fn()>(_f: F) {}
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | bar(move || x = 1);
|
||||
| --- ^^^^^ cannot assign
|
||||
| |
|
||||
| --- ------- ^^^^^ cannot assign
|
||||
| | |
|
||||
| | in this closure
|
||||
| expects `Fn` instead of `FnMut`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -10,11 +10,11 @@ error[E0599]: no method named `blablabla` found for struct `Arc<_>` in the curre
|
||||
LL | arc.blablabla();
|
||||
| ^^^^^^^^^ method not found in `Arc<_>`
|
||||
|
||||
error[E0599]: no method named `blablabla` found for struct `Arc<[closure@$DIR/fn-help-with-err.rs:10:36: 10:40]>` in the current scope
|
||||
error[E0599]: no method named `blablabla` found for struct `Arc<[closure@$DIR/fn-help-with-err.rs:10:36: 10:38]>` in the current scope
|
||||
--> $DIR/fn-help-with-err.rs:12:10
|
||||
|
|
||||
LL | arc2.blablabla();
|
||||
| ---- ^^^^^^^^^ method not found in `Arc<[closure@$DIR/fn-help-with-err.rs:10:36: 10:40]>`
|
||||
| ---- ^^^^^^^^^ method not found in `Arc<[closure@$DIR/fn-help-with-err.rs:10:36: 10:38]>`
|
||||
| |
|
||||
| this is a function, perhaps you wish to call it
|
||||
|
||||
|
@ -4,7 +4,7 @@ error: generator cannot be sent between threads safely
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: within `[generator@$DIR/drop-yield-twice.rs:7:17: 12:6]`, the trait `Send` is not implemented for `Foo`
|
||||
= help: within `[generator@$DIR/drop-yield-twice.rs:7:17: 7:19]`, the trait `Send` is not implemented for `Foo`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/drop-yield-twice.rs:9:9
|
||||
|
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6] as Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 19:6]`
|
||||
error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36] as Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:15:34: 15:36]`
|
||||
--> $DIR/generator-yielding-or-returning-itself.rs:15:5
|
||||
|
|
||||
LL | want_cyclic_generator_return(|| {
|
||||
@ -16,7 +16,7 @@ LL | pub fn want_cyclic_generator_return<T>(_: T)
|
||||
LL | where T: Generator<Yield = (), Return = T>
|
||||
| ^^^^^^^^^^ required by this bound in `want_cyclic_generator_return`
|
||||
|
||||
error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 32:6] as Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 32:6]`
|
||||
error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35] as Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:28:33: 28:35]`
|
||||
--> $DIR/generator-yielding-or-returning-itself.rs:28:5
|
||||
|
|
||||
LL | want_cyclic_generator_yield(|| {
|
||||
|
@ -33,11 +33,8 @@ LL | require_send(send_gen);
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/issue-68112.rs:48:5
|
||||
|
|
||||
LL | / || {
|
||||
LL | | yield;
|
||||
LL | | t
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | || {
|
||||
| ^^
|
||||
note: required because it appears within the type `impl Generator<Return = Arc<RefCell<i32>>>`
|
||||
--> $DIR/issue-68112.rs:45:30
|
||||
|
|
||||
@ -52,12 +49,8 @@ LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>>
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/issue-68112.rs:59:20
|
||||
|
|
||||
LL | let send_gen = || {
|
||||
| ____________________^
|
||||
LL | | let _non_send_gen = make_non_send_generator2();
|
||||
LL | | yield;
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let send_gen = || {
|
||||
| ^^
|
||||
note: required by a bound in `require_send`
|
||||
--> $DIR/issue-68112.rs:22:25
|
||||
|
|
||||
|
@ -9,13 +9,8 @@ LL | assert_send(|| {
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/not-send-sync.rs:16:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | | drop(&a);
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^
|
||||
LL | assert_send(|| {
|
||||
| ^^
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/not-send-sync.rs:7:23
|
||||
|
|
||||
@ -28,7 +23,7 @@ error: generator cannot be shared between threads safely
|
||||
LL | assert_sync(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Sync`
|
||||
|
|
||||
= help: within `[generator@$DIR/not-send-sync.rs:9:17: 13:6]`, the trait `Sync` is not implemented for `Cell<i32>`
|
||||
= help: within `[generator@$DIR/not-send-sync.rs:9:17: 9:19]`, the trait `Sync` is not implemented for `Cell<i32>`
|
||||
note: generator is not `Sync` as this value is used across a yield
|
||||
--> $DIR/not-send-sync.rs:12:9
|
||||
|
|
||||
|
@ -4,7 +4,7 @@ error: generator cannot be sent between threads safely
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: within `[generator@$DIR/partial-drop.rs:14:17: 20:6]`, the trait `Send` is not implemented for `Foo`
|
||||
= help: within `[generator@$DIR/partial-drop.rs:14:17: 14:19]`, the trait `Send` is not implemented for `Foo`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/partial-drop.rs:19:9
|
||||
|
|
||||
@ -27,7 +27,7 @@ error: generator cannot be sent between threads safely
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: within `[generator@$DIR/partial-drop.rs:22:17: 30:6]`, the trait `Send` is not implemented for `Foo`
|
||||
= help: within `[generator@$DIR/partial-drop.rs:22:17: 22:19]`, the trait `Send` is not implemented for `Foo`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/partial-drop.rs:29:9
|
||||
|
|
||||
@ -50,7 +50,7 @@ error: generator cannot be sent between threads safely
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: within `[generator@$DIR/partial-drop.rs:32:17: 39:6]`, the trait `Send` is not implemented for `Foo`
|
||||
= help: within `[generator@$DIR/partial-drop.rs:32:17: 32:19]`, the trait `Send` is not implemented for `Foo`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/partial-drop.rs:38:9
|
||||
|
|
||||
|
@ -31,11 +31,8 @@ LL | require_send(send_gen);
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/generator-print-verbose-1.rs:42:5
|
||||
|
|
||||
LL | / || {
|
||||
LL | | yield;
|
||||
LL | | t
|
||||
LL | | }
|
||||
| |_____^
|
||||
LL | || {
|
||||
| ^^
|
||||
note: required because it appears within the type `Opaque(DefId(0:39 ~ generator_print_verbose_1[749a]::make_gen2::{opaque#0}), [std::sync::Arc<std::cell::RefCell<i32>>])`
|
||||
--> $DIR/generator-print-verbose-1.rs:41:30
|
||||
|
|
||||
@ -50,12 +47,8 @@ LL | fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>>
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/generator-print-verbose-1.rs:52:20
|
||||
|
|
||||
LL | let send_gen = || {
|
||||
| ____________________^
|
||||
LL | | let _non_send_gen = make_non_send_generator2();
|
||||
LL | | yield;
|
||||
LL | | };
|
||||
| |_____^
|
||||
LL | let send_gen = || {
|
||||
| ^^
|
||||
note: required by a bound in `require_send`
|
||||
--> $DIR/generator-print-verbose-1.rs:26:25
|
||||
|
|
||||
|
@ -9,13 +9,8 @@ LL | assert_send(|| {
|
||||
note: required because it's used within this generator
|
||||
--> $DIR/generator-print-verbose-2.rs:19:17
|
||||
|
|
||||
LL | assert_send(|| {
|
||||
| _________________^
|
||||
LL | |
|
||||
LL | | drop(&a);
|
||||
LL | | yield;
|
||||
LL | | });
|
||||
| |_____^
|
||||
LL | assert_send(|| {
|
||||
| ^^
|
||||
note: required by a bound in `assert_send`
|
||||
--> $DIR/generator-print-verbose-2.rs:10:23
|
||||
|
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0277]: `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]` cannot be unpinned
|
||||
error[E0277]: `[static generator@$DIR/static-not-unpin.rs:11:25: 11:34]` cannot be unpinned
|
||||
--> $DIR/static-not-unpin.rs:14:18
|
||||
|
|
||||
LL | assert_unpin(generator);
|
||||
| ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6]`
|
||||
| ------------ ^^^^^^^^^ the trait `Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 11:34]`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
|
@ -12,7 +12,7 @@ note: return type inferred to be `Result<{integer}, _>` here
|
||||
LL | return Ok(6);
|
||||
| ^^^^^
|
||||
|
||||
error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 15:6] as Generator>::Return == i32`
|
||||
error[E0271]: type mismatch resolving `<[generator@$DIR/type-mismatch-signature-deduction.rs:7:5: 7:7] as Generator>::Return == i32`
|
||||
--> $DIR/type-mismatch-signature-deduction.rs:5:13
|
||||
|
|
||||
LL | fn foo() -> impl Generator<Return = i32> {
|
||||
|
@ -4,7 +4,7 @@ error: higher-ranked lifetime error
|
||||
LL | v.t(|| {});
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: could not prove `[closure@$DIR/issue-59311.rs:17:9: 17:14] well-formed`
|
||||
= note: could not prove `[closure@$DIR/issue-59311.rs:17:9: 17:11] well-formed`
|
||||
|
||||
error: higher-ranked lifetime error
|
||||
--> $DIR/issue-59311.rs:17:9
|
||||
|
@ -10,7 +10,7 @@ note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-71955.rs:45:24
|
||||
|
|
||||
LL | foo(bar, "string", |s| s.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
| ^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-71955.rs:25:9
|
||||
|
|
||||
@ -29,7 +29,7 @@ note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-71955.rs:45:24
|
||||
|
|
||||
LL | foo(bar, "string", |s| s.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
| ^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-71955.rs:25:44
|
||||
|
|
||||
@ -48,7 +48,7 @@ note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-71955.rs:48:24
|
||||
|
|
||||
LL | foo(baz, "string", |s| s.0.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
| ^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-71955.rs:25:9
|
||||
|
|
||||
@ -67,7 +67,7 @@ note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-71955.rs:48:24
|
||||
|
|
||||
LL | foo(baz, "string", |s| s.0.len() == 5);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
| ^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-71955.rs:25:44
|
||||
|
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:36]>`, but its trait bounds were not satisfied
|
||||
error[E0599]: the method `filterx` exists for struct `Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>`, but its trait bounds were not satisfied
|
||||
--> $DIR/issue-30786.rs:118:22
|
||||
|
|
||||
LL | pub struct Map<S, F> {
|
||||
@ -8,12 +8,12 @@ LL | pub struct Map<S, F> {
|
||||
| doesn't satisfy `_: StreamExt`
|
||||
...
|
||||
LL | let filter = map.filterx(|x: &_| true);
|
||||
| ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:36]>` due to unsatisfied trait bounds
|
||||
| ^^^^^^^ method cannot be called on `Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>` due to unsatisfied trait bounds
|
||||
|
|
||||
note: the following trait bounds were not satisfied:
|
||||
`&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:36]>: Stream`
|
||||
`&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:36]>: Stream`
|
||||
`&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:36]>: Stream`
|
||||
`&'a mut &Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>: Stream`
|
||||
`&'a mut &mut Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>: Stream`
|
||||
`&'a mut Map<Repeat, [closure@$DIR/issue-30786.rs:117:27: 117:34]>: Stream`
|
||||
--> $DIR/issue-30786.rs:96:50
|
||||
|
|
||||
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
|
||||
@ -23,7 +23,7 @@ help: one of the expressions' fields has a method of the same name
|
||||
LL | let filter = map.stream.filterx(|x: &_| true);
|
||||
| +++++++
|
||||
|
||||
error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:42]>`, but its trait bounds were not satisfied
|
||||
error[E0599]: the method `countx` exists for struct `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>`, but its trait bounds were not satisfied
|
||||
--> $DIR/issue-30786.rs:130:24
|
||||
|
|
||||
LL | pub struct Filter<S, F> {
|
||||
@ -33,12 +33,12 @@ LL | pub struct Filter<S, F> {
|
||||
| doesn't satisfy `_: StreamExt`
|
||||
...
|
||||
LL | let count = filter.countx();
|
||||
| ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:42]>` due to unsatisfied trait bounds
|
||||
| ^^^^^^ method cannot be called on `Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>` due to unsatisfied trait bounds
|
||||
|
|
||||
note: the following trait bounds were not satisfied:
|
||||
`&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:42]>: Stream`
|
||||
`&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:42]>: Stream`
|
||||
`&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:42]>: Stream`
|
||||
`&'a mut &Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream`
|
||||
`&'a mut &mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream`
|
||||
`&'a mut Filter<Map<Repeat, for<'r> fn(&'r u64) -> &'r u64 {identity::<u64>}>, [closure@$DIR/issue-30786.rs:129:30: 129:37]>: Stream`
|
||||
--> $DIR/issue-30786.rs:96:50
|
||||
|
|
||||
LL | impl<T> StreamExt for T where for<'a> &'a mut T: Stream {}
|
||||
|
@ -1,8 +1,8 @@
|
||||
error[E0271]: type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
|
||||
error[E0271]: type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
|
||||
--> $DIR/issue-62203-hrtb-ice.rs:38:19
|
||||
|
|
||||
LL | let v = Unit2.m(
|
||||
| ^ type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
|
||||
| ^ type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
|
||||
|
|
||||
note: expected this to be `<_ as Ty<'_>>::V`
|
||||
--> $DIR/issue-62203-hrtb-ice.rs:21:14
|
||||
@ -22,7 +22,7 @@ LL | where
|
||||
LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
|
||||
|
||||
error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39] as FnOnce<((&'r u8,),)>>::Output == Unit3`
|
||||
error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20] as FnOnce<((&'r u8,),)>>::Output == Unit3`
|
||||
--> $DIR/issue-62203-hrtb-ice.rs:40:9
|
||||
|
|
||||
LL | let v = Unit2.m(
|
||||
@ -34,7 +34,7 @@ LL | | f : |x| { drop(x); Unit4 }
|
||||
LL | | });
|
||||
| |_________^ expected struct `Unit3`, found struct `Unit4`
|
||||
|
|
||||
note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]>`
|
||||
note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20]>`
|
||||
--> $DIR/issue-62203-hrtb-ice.rs:17:16
|
||||
|
|
||||
LL | impl<'a, A, T> T0<'a, A> for L<T>
|
||||
|
@ -14,7 +14,7 @@ note: required because it's used within this closure
|
||||
--> $DIR/auto-trait-leak2.rs:10:5
|
||||
|
|
||||
LL | move |x| p.set(x)
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^
|
||||
note: required because it appears within the type `impl Fn(i32)`
|
||||
--> $DIR/auto-trait-leak2.rs:5:16
|
||||
|
|
||||
@ -42,7 +42,7 @@ note: required because it's used within this closure
|
||||
--> $DIR/auto-trait-leak2.rs:38:5
|
||||
|
|
||||
LL | move |x| p.set(x)
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^
|
||||
note: required because it appears within the type `impl Fn(i32)`
|
||||
--> $DIR/auto-trait-leak2.rs:33:15
|
||||
|
|
||||
|
@ -13,7 +13,7 @@ LL | | })
|
||||
| |_____^ expected closure, found a different closure
|
||||
|
|
||||
= note: expected opaque type `Closure`
|
||||
found closure `[closure@$DIR/issue-74282.rs:8:15: 10:6]`
|
||||
found closure `[closure@$DIR/issue-74282.rs:8:15: 8:17]`
|
||||
= note: no two closures, even if identical, have the same type
|
||||
= help: consider boxing your closure and/or using it as a trait object
|
||||
note: tuple struct defined here
|
||||
|
@ -100,7 +100,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
|
||||
--> $DIR/must_outlive_least_region_or_bound.rs:38:5
|
||||
|
|
||||
LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
|
||||
| -- hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:38:5: 38:31]` captures the lifetime `'b` as defined here
|
||||
| -- hidden type `[closure@$DIR/must_outlive_least_region_or_bound.rs:38:5: 38:13]` captures the lifetime `'b` as defined here
|
||||
LL | move |_| println!("{}", y)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo() -> impl Trait<Assoc = Sendable> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Duh` is not implemented for `Sendable`
|
||||
|
|
||||
= help: the trait `Duh` is implemented for `i32`
|
||||
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait.rs:27:5: 27:10]`
|
||||
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait.rs:27:5: 27:7]`
|
||||
--> $DIR/nested-return-type2-tait.rs:14:31
|
||||
|
|
||||
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo() -> Traitable {
|
||||
| ^^^^^^^^^ the trait `Duh` is not implemented for `Sendable`
|
||||
|
|
||||
= help: the trait `Duh` is implemented for `i32`
|
||||
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait2.rs:28:5: 28:10]`
|
||||
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait2.rs:28:5: 28:7]`
|
||||
--> $DIR/nested-return-type2-tait2.rs:14:31
|
||||
|
|
||||
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo() -> Traitable {
|
||||
| ^^^^^^^^^ the trait `Duh` is not implemented for `impl Send`
|
||||
|
|
||||
= help: the trait `Duh` is implemented for `i32`
|
||||
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait3.rs:27:5: 27:10]`
|
||||
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2-tait3.rs:27:5: 27:7]`
|
||||
--> $DIR/nested-return-type2-tait3.rs:14:31
|
||||
|
|
||||
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
|
||||
|
@ -5,7 +5,7 @@ LL | fn foo() -> impl Trait<Assoc = impl Send> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Duh` is not implemented for `impl Send`
|
||||
|
|
||||
= help: the trait `Duh` is implemented for `i32`
|
||||
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2.rs:23:5: 23:10]`
|
||||
note: required because of the requirements on the impl of `Trait` for `[closure@$DIR/nested-return-type2.rs:23:5: 23:7]`
|
||||
--> $DIR/nested-return-type2.rs:12:31
|
||||
|
|
||||
LL | impl<R: Duh, F: FnMut() -> R> Trait for F {
|
||||
|
@ -54,7 +54,7 @@ LL | fn closure_capture() -> impl Sized {
|
||||
LL | / move || {
|
||||
LL | | x;
|
||||
LL | | }
|
||||
| |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 37:6]`
|
||||
| |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 35:12]`
|
||||
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:40:29
|
||||
@ -65,7 +65,7 @@ LL | fn closure_ref_capture() -> impl Sized {
|
||||
LL | / move || {
|
||||
LL | | &x;
|
||||
LL | | }
|
||||
| |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 45:6]`
|
||||
| |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 43:12]`
|
||||
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:48:21
|
||||
@ -74,7 +74,7 @@ LL | fn closure_sig() -> impl Sized {
|
||||
| ^^^^^^^^^^ recursive opaque type
|
||||
LL |
|
||||
LL | || closure_sig()
|
||||
| ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:50:5: 50:21]`
|
||||
| ---------------- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:50:5: 50:7]`
|
||||
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:53:23
|
||||
@ -83,7 +83,7 @@ LL | fn generator_sig() -> impl Sized {
|
||||
| ^^^^^^^^^^ recursive opaque type
|
||||
LL |
|
||||
LL | || generator_sig()
|
||||
| ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:55:5: 55:23]`
|
||||
| ------------------ returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:55:5: 55:7]`
|
||||
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:58:27
|
||||
@ -95,7 +95,7 @@ LL | / move || {
|
||||
LL | | yield;
|
||||
LL | | x;
|
||||
LL | | }
|
||||
| |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 64:6]`
|
||||
| |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 61:12]`
|
||||
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:67:35
|
||||
@ -117,7 +117,7 @@ LL | | let x = generator_hold();
|
||||
LL | | yield;
|
||||
LL | | x;
|
||||
LL | | }
|
||||
| |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:74:5: 78:6]`
|
||||
| |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:74:5: 74:12]`
|
||||
|
||||
error[E0720]: cannot resolve opaque type
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:86:26
|
||||
|
@ -2,7 +2,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
|
||||
--> $DIR/static-return-lifetime-infered.rs:7:9
|
||||
|
|
||||
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
|
||||
| ----- hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:34]>` captures the anonymous lifetime defined here
|
||||
| ----- hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30]>` captures the anonymous lifetime defined here
|
||||
LL | self.x.iter().map(|a| a.0)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
@ -15,7 +15,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
|
||||
--> $DIR/static-return-lifetime-infered.rs:7:9
|
||||
|
|
||||
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
|
||||
| ----- hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:34]>` captures the anonymous lifetime defined here
|
||||
| ----- hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30]>` captures the anonymous lifetime defined here
|
||||
LL | self.x.iter().map(|a| a.0)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
@ -28,7 +28,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
|
||||
--> $DIR/static-return-lifetime-infered.rs:12:9
|
||||
|
|
||||
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
|
||||
| -- hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:12:27: 12:34]>` captures the lifetime `'a` as defined here
|
||||
| -- hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:12:27: 12:30]>` captures the lifetime `'a` as defined here
|
||||
LL | self.x.iter().map(|a| a.0)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
@ -41,7 +41,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
|
||||
--> $DIR/static-return-lifetime-infered.rs:12:9
|
||||
|
|
||||
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
|
||||
| -- hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:12:27: 12:34]>` captures the lifetime `'a` as defined here
|
||||
| -- hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:12:27: 12:30]>` captures the lifetime `'a` as defined here
|
||||
LL | self.x.iter().map(|a| a.0)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
|
@ -11,7 +11,7 @@ note: required because it's used within this closure
|
||||
--> $DIR/interior-mutability.rs:5:18
|
||||
|
|
||||
LL | catch_unwind(|| { x.set(23); });
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
| ^^
|
||||
note: required by a bound in `catch_unwind`
|
||||
--> $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
|
|
||||
|
@ -1,18 +1,18 @@
|
||||
error[E0277]: the trait bound `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]: ~const FnOnce<()>` is not satisfied
|
||||
error[E0277]: the trait bound `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:29]: ~const FnOnce<()>` is not satisfied
|
||||
--> $DIR/const-eval-select-bad.rs:6:27
|
||||
|
|
||||
LL | const_eval_select((), || {}, || {});
|
||||
| ----------------- ^^^^^ expected an `FnOnce<()>` closure, found `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]`
|
||||
| ----------------- ^^^^^ expected an `FnOnce<()>` closure, found `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:29]`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `~const FnOnce<()>` is not implemented for `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]`
|
||||
note: the trait `FnOnce<()>` is implemented for `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]`, but that implementation is not `const`
|
||||
= help: the trait `~const FnOnce<()>` is not implemented for `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:29]`
|
||||
note: the trait `FnOnce<()>` is implemented for `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:29]`, but that implementation is not `const`
|
||||
--> $DIR/const-eval-select-bad.rs:6:27
|
||||
|
|
||||
LL | const_eval_select((), || {}, || {});
|
||||
| ^^^^^
|
||||
= note: wrap the `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:32]` in a closure with no arguments: `|| { /* code */ }`
|
||||
= note: wrap the `[closure@$DIR/const-eval-select-bad.rs:6:27: 6:29]` in a closure with no arguments: `|| { /* code */ }`
|
||||
note: required by a bound in `const_eval_select`
|
||||
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
|
||||
|
|
||||
|
@ -11,7 +11,7 @@ note: this value implements `FnOnce`, which causes it to be moved when called
|
||||
|
|
||||
LL | f();
|
||||
| ^
|
||||
= note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:41]`, which does not implement the `Copy` trait
|
||||
= note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:30]`, which does not implement the `Copy` trait
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,29 +5,26 @@ LL | fn call_it<F>(f: F) where F: Fn() { f(); }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | call_it(|| x.gen_mut());
|
||||
| ------- ^^^^^^^^^^^ cannot borrow as mutable
|
||||
| |
|
||||
| ------- -- ^^^^^^^^^^^ cannot borrow as mutable
|
||||
| | |
|
||||
| | in this closure
|
||||
| expects `Fn` instead of `FnMut`
|
||||
|
||||
error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
|
||||
--> $DIR/issue-21600.rs:14:17
|
||||
|
|
||||
LL | fn call_it<F>(f: F) where F: Fn() { f(); }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
LL | fn call_it<F>(f: F) where F: Fn() { f(); }
|
||||
| - change this to accept `FnMut` instead of `Fn`
|
||||
...
|
||||
LL | call_it(|| {
|
||||
| _____-------_-
|
||||
| | |
|
||||
| | expects `Fn` instead of `FnMut`
|
||||
LL | | call_it(|| x.gen());
|
||||
LL | | call_it(|| x.gen_mut());
|
||||
| | ^^ - mutable borrow occurs due to use of `x` in closure
|
||||
| | |
|
||||
| | cannot borrow as mutable
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | });
|
||||
| |_____- in this closure
|
||||
LL | call_it(|| {
|
||||
| ------- -- in this closure
|
||||
| |
|
||||
| expects `Fn` instead of `FnMut`
|
||||
LL | call_it(|| x.gen());
|
||||
LL | call_it(|| x.gen_mut());
|
||||
| ^^ - mutable borrow occurs due to use of `x` in closure
|
||||
| |
|
||||
| cannot borrow as mutable
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -2,12 +2,12 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-24036.rs:3:9
|
||||
|
|
||||
LL | let mut x = |c| c + 1;
|
||||
| --------- the expected closure
|
||||
| --- the expected closure
|
||||
LL | x = |c| c + 1;
|
||||
| ^^^^^^^^^ expected closure, found a different closure
|
||||
|
|
||||
= note: expected closure `[closure@$DIR/issue-24036.rs:2:17: 2:26]`
|
||||
found closure `[closure@$DIR/issue-24036.rs:3:9: 3:18]`
|
||||
= note: expected closure `[closure@$DIR/issue-24036.rs:2:17: 2:20]`
|
||||
found closure `[closure@$DIR/issue-24036.rs:3:9: 3:12]`
|
||||
= note: no two closures, even if identical, have the same type
|
||||
= help: consider boxing your closure and/or using it as a trait object
|
||||
|
||||
|
@ -2,11 +2,13 @@ error[E0308]: mismatched types
|
||||
--> $DIR/issue-3044.rs:3:35
|
||||
|
|
||||
LL | needlesArr.iter().fold(|x, y| {
|
||||
| ___________________________________^
|
||||
| ____________________________------_^
|
||||
| | |
|
||||
| | the expected closure
|
||||
LL | | });
|
||||
| |_____^ expected closure, found `()`
|
||||
|
|
||||
= note: expected closure `[closure@$DIR/issue-3044.rs:3:28: 4:6]`
|
||||
= note: expected closure `[closure@$DIR/issue-3044.rs:3:28: 3:34]`
|
||||
found unit type `()`
|
||||
|
||||
error[E0061]: this function takes 2 arguments but 1 argument was supplied
|
||||
|
@ -1,4 +1,4 @@
|
||||
error[E0271]: type mismatch resolving `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]> as Iterator>::Item == &_`
|
||||
error[E0271]: type mismatch resolving `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]> as Iterator>::Item == &_`
|
||||
--> $DIR/issue-31173.rs:10:10
|
||||
|
|
||||
LL | .cloned()
|
||||
@ -12,11 +12,11 @@ note: required by a bound in `cloned`
|
||||
LL | Self: Sized + Iterator<Item = &'a T>,
|
||||
| ^^^^^^^^^^^^ required by this bound in `cloned`
|
||||
|
||||
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>`, but its trait bounds were not satisfied
|
||||
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>`, but its trait bounds were not satisfied
|
||||
--> $DIR/issue-31173.rs:12:10
|
||||
|
|
||||
LL | .collect();
|
||||
| ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>` due to unsatisfied trait bounds
|
||||
| ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>` due to unsatisfied trait bounds
|
||||
|
|
||||
::: $SRC_DIR/core/src/iter/adapters/cloned.rs:LL:COL
|
||||
|
|
||||
@ -29,10 +29,10 @@ LL | pub struct TakeWhile<I, P> {
|
||||
| -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_`
|
||||
|
|
||||
= note: the following trait bounds were not satisfied:
|
||||
`<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]> as Iterator>::Item = &_`
|
||||
which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`
|
||||
`Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`
|
||||
which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`
|
||||
`<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]> as Iterator>::Item = &_`
|
||||
which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator`
|
||||
`Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator`
|
||||
which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | pub struct Iterate<T, F> {
|
||||
| ------- method `iter` not found for this struct
|
||||
...
|
||||
LL | println!("{:?}", a.iter().take(10).collect::<Vec<usize>>());
|
||||
| ^^^^ method not found in `Iterate<{integer}, [closure@$DIR/issue-41880.rs:26:24: 26:31]>`
|
||||
| ^^^^ method not found in `Iterate<{integer}, [closure@$DIR/issue-41880.rs:26:24: 26:27]>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -4,9 +4,8 @@ error[E0507]: cannot move out of `*v`, as `v` is a captured variable in an `FnMu
|
||||
LL | fn f<'r, T>(v: &'r T) -> Box<dyn FnMut() -> T + 'r> {
|
||||
| - captured outer variable
|
||||
LL | id(Box::new(|| *v))
|
||||
| ---^^
|
||||
| | |
|
||||
| | move occurs because `*v` has type `T`, which does not implement the `Copy` trait
|
||||
| -- ^^ move occurs because `*v` has type `T`, which does not implement the `Copy` trait
|
||||
| |
|
||||
| captured by this `FnMut` closure
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -5,7 +5,7 @@ LL | Square = |x| x,
|
||||
| ^^^^^ expected `isize`, found closure
|
||||
|
|
||||
= note: expected type `isize`
|
||||
found closure `[closure@$DIR/issue-48838.rs:2:14: 2:19]`
|
||||
found closure `[closure@$DIR/issue-48838.rs:2:14: 2:17]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | fn([u8; |x: u8| {}]),
|
||||
| ^^^^^^^^^^ expected `usize`, found closure
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found closure `[closure@$DIR/issue-50600.rs:2:13: 2:23]`
|
||||
found closure `[closure@$DIR/issue-50600.rs:2:13: 2:20]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -5,7 +5,7 @@ LL | [1; || {}];
|
||||
| ^^^^^ expected `usize`, found closure
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found closure `[closure@$DIR/issue-50688.rs:2:9: 2:14]`
|
||||
found closure `[closure@$DIR/issue-50688.rs:2:9: 2:11]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -9,7 +9,7 @@ LL | let _: Box<F> = Box::new(|| ());
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
= note: expected type parameter `F`
|
||||
found closure `[closure@$DIR/issue-51154.rs:2:30: 2:35]`
|
||||
found closure `[closure@$DIR/issue-51154.rs:2:30: 2:32]`
|
||||
= help: every closure has a distinct type and so could not always match the caller-chosen type of parameter `F`
|
||||
note: associated function defined here
|
||||
--> $SRC_DIR/alloc/src/boxed.rs:LL:COL
|
||||
|
@ -2,16 +2,16 @@ error[E0277]: `Rc<usize>` cannot be sent between threads safely
|
||||
--> $DIR/kindck-nonsendable-1.rs:9:5
|
||||
|
|
||||
LL | bar(move|| foo(x));
|
||||
| ^^^ ------------- within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`
|
||||
| ^^^ ------ within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`
|
||||
| |
|
||||
| `Rc<usize>` cannot be sent between threads safely
|
||||
|
|
||||
= help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`, the trait `Send` is not implemented for `Rc<usize>`
|
||||
= help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15]`, the trait `Send` is not implemented for `Rc<usize>`
|
||||
note: required because it's used within this closure
|
||||
--> $DIR/kindck-nonsendable-1.rs:9:9
|
||||
|
|
||||
LL | bar(move|| foo(x));
|
||||
| ^^^^^^^^^^^^^
|
||||
| ^^^^^^
|
||||
note: required by a bound in `bar`
|
||||
--> $DIR/kindck-nonsendable-1.rs:5:21
|
||||
|
|
||||
|
@ -37,7 +37,7 @@ note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-79187-2.rs:8:14
|
||||
|
|
||||
LL | take_foo(|a| a);
|
||||
| ^^^^^
|
||||
| ^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-79187-2.rs:5:21
|
||||
|
|
||||
|
@ -10,7 +10,7 @@ note: this closure does not fulfill the lifetime requirements
|
||||
--> $DIR/issue-79187.rs:4:13
|
||||
|
|
||||
LL | let f = |_| ();
|
||||
| ^^^^^^
|
||||
| ^^^
|
||||
note: the lifetime requirement is introduced here
|
||||
--> $DIR/issue-79187.rs:1:18
|
||||
|
|
||||
|
@ -128,7 +128,7 @@ LL | let _ = &baz as &dyn Fn(i32);
|
||||
|
|
||||
= help: cast can be replaced by coercion; this might require a temporary variable
|
||||
|
||||
error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:25]` as `&dyn Fn(i32)`
|
||||
error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:22]` as `&dyn Fn(i32)`
|
||||
--> $DIR/trivial_casts.rs:73:13
|
||||
|
|
||||
LL | let _ = &x as &dyn Fn(i32);
|
||||
|
@ -9,7 +9,7 @@ help: use parentheses to call the method
|
||||
LL | .get_x();
|
||||
| ++
|
||||
|
||||
error[E0615]: attempted to take value of method `filter_map` on type `Filter<Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/method-missing-call.rs:27:20: 27:25]>, [closure@$DIR/method-missing-call.rs:28:23: 28:35]>`
|
||||
error[E0615]: attempted to take value of method `filter_map` on type `Filter<Map<std::slice::Iter<'_, {integer}>, [closure@$DIR/method-missing-call.rs:27:20: 27:23]>, [closure@$DIR/method-missing-call.rs:28:23: 28:28]>`
|
||||
--> $DIR/method-missing-call.rs:29:16
|
||||
|
|
||||
LL | .filter_map;
|
||||
|
@ -23,7 +23,7 @@ error[E0599]: no method named `extend` found for struct `Map` in the current sco
|
||||
--> $DIR/method-not-found-generic-arg-elision.rs:87:29
|
||||
|
|
||||
LL | v.iter().map(|x| x * x).extend(std::iter::once(100));
|
||||
| ^^^^^^ method not found in `Map<std::slice::Iter<'_, i32>, [closure@$DIR/method-not-found-generic-arg-elision.rs:87:18: 87:27]>`
|
||||
| ^^^^^^ method not found in `Map<std::slice::Iter<'_, i32>, [closure@$DIR/method-not-found-generic-arg-elision.rs:87:18: 87:21]>`
|
||||
|
||||
error[E0599]: no method named `method` found for struct `Wrapper<bool>` in the current scope
|
||||
--> $DIR/method-not-found-generic-arg-elision.rs:90:13
|
||||
|
@ -2,7 +2,7 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/closure-arg-type-mismatch.rs:3:14
|
||||
|
|
||||
LL | a.iter().map(|_: (u32, u32)| 45);
|
||||
| ^^^ ------------------ found signature of `fn((u32, u32)) -> _`
|
||||
| ^^^ --------------- found signature of `fn((u32, u32)) -> _`
|
||||
| |
|
||||
| expected signature of `fn(&(u32, u32)) -> _`
|
||||
|
|
||||
@ -16,7 +16,7 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/closure-arg-type-mismatch.rs:4:14
|
||||
|
|
||||
LL | a.iter().map(|_: &(u16, u16)| 45);
|
||||
| ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _`
|
||||
| ^^^ ---------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _`
|
||||
| |
|
||||
| expected signature of `fn(&(u32, u32)) -> _`
|
||||
|
|
||||
@ -30,7 +30,7 @@ error[E0631]: type mismatch in closure arguments
|
||||
--> $DIR/closure-arg-type-mismatch.rs:5:14
|
||||
|
|
||||
LL | a.iter().map(|_: (u16, u16)| 45);
|
||||
| ^^^ ------------------ found signature of `fn((u16, u16)) -> _`
|
||||
| ^^^ --------------- found signature of `fn((u16, u16)) -> _`
|
||||
| |
|
||||
| expected signature of `fn(&(u32, u32)) -> _`
|
||||
|
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user