1
Fork 0

pretty.rs: Update Closure and Generator print

Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
This commit is contained in:
Aman Arora 2020-09-08 10:43:06 -04:00
parent db7ee7cc0d
commit c923da0b49
23 changed files with 104 additions and 122 deletions

View file

@ -641,42 +641,35 @@ pub trait PrettyPrinter<'tcx>:
} }
ty::Str => p!(write("str")), ty::Str => p!(write("str")),
ty::Generator(did, substs, movability) => { ty::Generator(did, substs, movability) => {
p!(write("["));
match movability { match movability {
hir::Movability::Movable => p!(write("[generator")), hir::Movability::Movable => {}
hir::Movability::Static => p!(write("[static generator")), hir::Movability::Static => p!(write("static ")),
} }
// FIXME(eddyb) should use `def_span`. if !self.tcx().sess.verbose() {
if let Some(did) = did.as_local() { p!(write("generator"));
let hir_id = self.tcx().hir().local_def_id_to_hir_id(did); // FIXME(eddyb) should use `def_span`.
let span = self.tcx().hir().span(hir_id); if let Some(did) = did.as_local() {
p!(write("@{}", self.tcx().sess.source_map().span_to_string(span))); let hir_id = self.tcx().hir().local_def_id_to_hir_id(did);
let span = self.tcx().hir().span(hir_id);
if substs.as_generator().is_valid() { p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
let upvar_tys = substs.as_generator().upvar_tys(); } else {
let mut sep = " "; p!(write("@{}", self.tcx().def_path_str(did)));
for (&var_id, upvar_ty) in self
.tcx()
.upvars_mentioned(did)
.as_ref()
.iter()
.flat_map(|v| v.keys())
.zip(upvar_tys)
{
p!(write("{}{}:", sep, self.tcx().hir().name(var_id)), print(upvar_ty));
sep = ", ";
}
} }
} else { } else {
p!(write("@{}", self.tcx().def_path_str(did))); p!(print_def_path(did, substs));
if substs.as_generator().is_valid() { if substs.as_generator().is_valid() {
let upvar_tys = substs.as_generator().upvar_tys(); // Search for the first inference variable
let mut sep = " "; p!(write(" upvar_tys=("));
for (index, upvar_ty) in upvar_tys.enumerate() { let mut uninferred_ty =
p!(write("{}{}:", sep, index), print(upvar_ty)); substs.as_generator().upvar_tys().filter(|ty| ty.is_ty_infer());
sep = ", "; if uninferred_ty.next().is_some() {
p!(write("unavailable"));
} else {
self = self.comma_sep(substs.as_generator().upvar_tys())?;
} }
p!(write(")"));
} }
} }
@ -684,61 +677,50 @@ pub trait PrettyPrinter<'tcx>:
p!(write(" "), print(substs.as_generator().witness())); p!(write(" "), print(substs.as_generator().witness()));
} }
p!(write("]")) p!(write("]"));
} }
ty::GeneratorWitness(types) => { ty::GeneratorWitness(types) => {
p!(in_binder(&types)); p!(in_binder(&types));
} }
ty::Closure(did, substs) => { ty::Closure(did, substs) => {
p!(write("[closure")); p!(write("["));
if !self.tcx().sess.verbose() {
// FIXME(eddyb) should use `def_span`. p!(write("closure"));
if let Some(did) = did.as_local() { // FIXME(eddyb) should use `def_span`.
let hir_id = self.tcx().hir().local_def_id_to_hir_id(did); if let Some(did) = did.as_local() {
if self.tcx().sess.opts.debugging_opts.span_free_formats { let hir_id = self.tcx().hir().local_def_id_to_hir_id(did);
p!(write("@"), print_def_path(did.to_def_id(), substs)); if self.tcx().sess.opts.debugging_opts.span_free_formats {
} else { p!(write("@"), print_def_path(did.to_def_id(), substs));
let span = self.tcx().hir().span(hir_id); } else {
p!(write("@{}", self.tcx().sess.source_map().span_to_string(span))); let span = self.tcx().hir().span(hir_id);
} p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
if substs.as_closure().is_valid() {
let upvar_tys = substs.as_closure().upvar_tys();
let mut sep = " ";
for (&var_id, upvar_ty) in self
.tcx()
.upvars_mentioned(did)
.as_ref()
.iter()
.flat_map(|v| v.keys())
.zip(upvar_tys)
{
p!(write("{}{}:", sep, self.tcx().hir().name(var_id)), print(upvar_ty));
sep = ", ";
} }
} else {
p!(write("@{}", self.tcx().def_path_str(did)));
} }
} else { } else {
p!(write("@{}", self.tcx().def_path_str(did))); p!(print_def_path(did, substs));
if substs.as_closure().is_valid() { if substs.as_closure().is_valid() {
let upvar_tys = substs.as_closure().upvar_tys(); // Search for the first inference variable
let mut sep = " "; let mut uninferred_ty =
for (index, upvar_ty) in upvar_tys.enumerate() { substs.as_closure().upvar_tys().filter(|ty| ty.is_ty_infer());
p!(write("{}{}:", sep, index), print(upvar_ty)); if uninferred_ty.next().is_some() {
sep = ", "; // If the upvar substs contain an inference variable we haven't
// finished capture analysis.
p!(write(" closure_substs=(unavailable)"));
} else {
p!(write(" closure_kind_ty="), print(substs.as_closure().kind_ty()));
p!(
write(" closure_sig_as_fn_ptr_ty="),
print(substs.as_closure().sig_as_fn_ptr_ty())
);
p!(write(" upvar_tys=("));
self = self.comma_sep(substs.as_closure().upvar_tys())?;
p!(write(")"));
} }
} }
} }
p!(write("]"));
if self.tcx().sess.verbose() && substs.as_closure().is_valid() {
p!(write(" closure_kind_ty="), print(substs.as_closure().kind_ty()));
p!(
write(" closure_sig_as_fn_ptr_ty="),
print(substs.as_closure().sig_as_fn_ptr_ty())
);
}
p!(write("]"))
} }
ty::Array(ty, sz) => { ty::Array(ty, sz) => {
p!(write("["), print(ty), write("; ")); p!(write("["), print(ty), write("; "));

View file

@ -4,10 +4,10 @@ fn foo(_1: T, _2: i32) -> (i32, T) {
debug t => _1; // in scope 0 at $DIR/inline-closure-captures.rs:10:17: 10:18 debug t => _1; // in scope 0 at $DIR/inline-closure-captures.rs:10:17: 10:18
debug q => _2; // in scope 0 at $DIR/inline-closure-captures.rs:10:23: 10:24 debug q => _2; // in scope 0 at $DIR/inline-closure-captures.rs:10:23: 10:24
let mut _0: (i32, T); // return place in scope 0 at $DIR/inline-closure-captures.rs:10:34: 10:42 let mut _0: (i32, T); // return place in scope 0 at $DIR/inline-closure-captures.rs:10:34: 10:42
let _3: [closure@foo<T>::{closure#0} q:&i32, t:&T]; // in scope 0 at $DIR/inline-closure-captures.rs:11:9: 11:10 let _3: [closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline-closure-captures.rs:11:9: 11:10
let mut _4: &i32; // in scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24 let mut _4: &i32; // in scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
let mut _5: &T; // in scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24 let mut _5: &T; // in scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
let mut _6: &[closure@foo<T>::{closure#0} q:&i32, t:&T]; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:6 let mut _6: &[closure@foo<T>::{closure#0}]; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:6
let mut _7: (i32,); // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9 let mut _7: (i32,); // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9
let mut _8: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:7: 12:8 let mut _8: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:7: 12:8
let mut _10: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9 let mut _10: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9

View file

@ -41,8 +41,8 @@ LL | require_send(send_fut);
| |
= help: the trait `Sync` is not implemented for `RefCell<i32>` = help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>` = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
= note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:47:31: 47:36 t:Arc<RefCell<i32>> {}]` = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:47:31: 47:36 {}]`
= note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:47:31: 47:36 t:Arc<RefCell<i32>> {}]>` = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:47:31: 47:36 {}]>`
= note: required because it appears within the type `impl Future` = note: required because it appears within the type `impl Future`
= note: required because it appears within the type `impl Future` = note: required because it appears within the type `impl Future`
= note: required because it appears within the type `impl Future` = note: required because it appears within the type `impl Future`

View file

@ -7,7 +7,7 @@ LL | |y| x + y
| ^^^^^^^^^ expected `()`, found closure | ^^^^^^^^^ expected `()`, found closure
| |
= note: expected unit type `()` = note: expected unit type `()`
found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14 x:_]` found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14]`
error[E0618]: expected function, found `()` error[E0618]: expected function, found `()`
--> $DIR/issue-20862.rs:7:13 --> $DIR/issue-20862.rs:7:13

View file

@ -4,7 +4,7 @@ error: lifetime may not live long enough
LL | let _action = move || { LL | let _action = move || {
| ------- | -------
| | | | | |
| | return type of closure is [closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:15 f:&'2 [closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:2:13: 2:23]] | | return type of closure is [closure@$DIR/issue-53432-nested-closure-outlives-borrowed-value.rs:4:9: 4:15]
| lifetime `'1` represents this closure's body | lifetime `'1` represents this closure's body
LL | || f() // The `nested` closure LL | || f() // The `nested` closure
| ^^^^^^ returning this value requires that `'1` must outlive `'2` | ^^^^^^ returning this value requires that `'1` must outlive `'2`

View file

@ -11,7 +11,7 @@ LL | F: Send + 'static,
| |
= help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>` = help: the trait `Sync` is not implemented for `std::sync::mpsc::Receiver<()>`
= note: required because of the requirements on the impl of `Send` for `&std::sync::mpsc::Receiver<()>` = note: required because of the requirements on the impl of `Send` for `&std::sync::mpsc::Receiver<()>`
= note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:6:27: 9:6 recv:&std::sync::mpsc::Receiver<()>]` = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:6:27: 9:6]`
error[E0277]: `Sender<()>` cannot be shared between threads safely error[E0277]: `Sender<()>` cannot be shared between threads safely
--> $DIR/closure-move-sync.rs:18:5 --> $DIR/closure-move-sync.rs:18:5
@ -26,7 +26,7 @@ LL | F: Send + 'static,
| |
= help: the trait `Sync` is not implemented for `Sender<()>` = help: the trait `Sync` is not implemented for `Sender<()>`
= note: required because of the requirements on the impl of `Send` for `&Sender<()>` = note: required because of the requirements on the impl of `Send` for `&Sender<()>`
= note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:18:19: 18:42 tx:&Sender<()>]` = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:18:19: 18:42]`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -7,7 +7,7 @@ LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
| expected due to this | expected due to this
| |
= note: expected fn pointer `fn(u8) -> u8` = note: expected fn pointer `fn(u8) -> u8`
found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50 a:_]` found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -7,7 +7,7 @@ LL | let bar: fn() -> u8 = || { b };
| expected due to this | expected due to this
| |
= note: expected fn pointer `fn() -> u8` = note: expected fn pointer `fn() -> u8`
found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35 b:_]` found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,4 +1,4 @@
error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:27: 6:37 b:_]` as `fn() -> u8` error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:6:27: 6:37]` as `fn() -> u8`
--> $DIR/closure-no-fn-3.rs:6:27 --> $DIR/closure-no-fn-3.rs:6:27
| |
LL | let baz: fn() -> u8 = (|| { b }) as fn() -> u8; LL | let baz: fn() -> u8 = (|| { b }) as fn() -> u8;

View file

@ -7,7 +7,7 @@ LL | call_bare(f)
| ^ expected fn pointer, found closure | ^ expected fn pointer, found closure
| |
= note: expected fn pointer `for<'r> fn(&'r str)` = note: expected fn pointer `for<'r> fn(&'r str)`
found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50 string:_]` found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -12,7 +12,7 @@ LL | | };
| |_____- `match` arms have incompatible types | |_____- `match` arms have incompatible types
| |
= note: expected type `fn(i32, i32) -> i32 {add}` = note: expected type `fn(i32, i32) -> i32 {add}`
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:43 cap:_]` found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:9:16: 9:43]`
error[E0308]: `match` arms have incompatible types error[E0308]: `match` arms have incompatible types
--> $DIR/closure_cap_coerce_many_fail.rs:18:16 --> $DIR/closure_cap_coerce_many_fail.rs:18:16
@ -28,7 +28,7 @@ LL | | };
| |_____- `match` arms have incompatible types | |_____- `match` arms have incompatible types
| |
= note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:17:16: 17:37]` = note: expected type `[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 cap:_]` found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:18:16: 18:43]`
= note: no two closures, even if identical, have the same type = note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object = help: consider boxing your closure and/or using it as a trait object
@ -38,14 +38,14 @@ error[E0308]: `match` arms have incompatible types
LL | let _ = match "+" { LL | let _ = match "+" {
| _____________- | _____________-
LL | | "+" => |a, b| (a + b + cap) as i32, LL | | "+" => |a, b| (a + b + cap) as i32,
| | --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43 cap:_]` | | --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43]`
LL | | "-" => |a, b| (a - b) as i32, LL | | "-" => |a, b| (a - b) as i32,
| | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure | | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
LL | | _ => unimplemented!(), LL | | _ => unimplemented!(),
LL | | }; LL | | };
| |_____- `match` arms have incompatible types | |_____- `match` arms have incompatible types
| |
= note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:26:16: 26:43 cap:_]` = note: expected type `[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]` found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:27:16: 27:37]`
= note: no two closures, even if identical, have the same type = note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object = help: consider boxing your closure and/or using it as a trait object
@ -56,15 +56,15 @@ error[E0308]: `match` arms have incompatible types
LL | let _ = match "+" { LL | let _ = match "+" {
| _____________- | _____________-
LL | | "+" => |a, b| (a + b + cap) as i32, LL | | "+" => |a, b| (a + b + cap) as i32,
| | --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43 cap:_]` | | --------------------------- this is found to be of type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43]`
LL | | "-" => |a, b| (a - b + cap) as i32, LL | | "-" => |a, b| (a - b + cap) as i32,
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
LL | | _ => unimplemented!(), LL | | _ => unimplemented!(),
LL | | }; LL | | };
| |_____- `match` arms have incompatible types | |_____- `match` arms have incompatible types
| |
= note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43 cap:_]` = note: expected type `[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 cap:_]` found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35:43]`
= note: no two closures, even if identical, have the same type = note: no two closures, even if identical, have the same type
= help: consider boxing your closure and/or using it as a trait object = help: consider boxing your closure and/or using it as a trait object

View file

@ -29,7 +29,7 @@ LL | require_send(send_gen);
| |
= help: the trait `Sync` is not implemented for `RefCell<i32>` = help: the trait `Sync` is not implemented for `RefCell<i32>`
= note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>` = note: required because of the requirements on the impl of `Send` for `Arc<RefCell<i32>>`
= note: required because it appears within the type `[generator@$DIR/issue-68112.rs:38:5: 41:6 t:Arc<RefCell<i32>> {()}]` = note: required because it appears within the type `[generator@$DIR/issue-68112.rs:38:5: 41:6 {()}]`
= note: required because it appears within the type `impl Generator` = note: required because it appears within the type `impl Generator`
= note: required because it appears within the type `impl Generator` = note: required because it appears within the type `impl Generator`
= note: required because it appears within the type `{impl Generator, ()}` = note: required because it appears within the type `{impl Generator, ()}`

View file

@ -9,7 +9,7 @@ LL | assert_send(|| {
| |
= help: the trait `Sync` is not implemented for `Cell<i32>` = help: the trait `Sync` is not implemented for `Cell<i32>`
= note: required because of the requirements on the impl of `Send` for `&Cell<i32>` = note: required because of the requirements on the impl of `Send` for `&Cell<i32>`
= note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:16:17: 20:6 a:&Cell<i32> _]` = note: required because it appears within the type `[generator@$DIR/not-send-sync.rs:16:17: 20:6 _]`
error: generator cannot be shared between threads safely error: generator cannot be shared between threads safely
--> $DIR/not-send-sync.rs:9:5 --> $DIR/not-send-sync.rs:9:5

View file

@ -11,7 +11,7 @@ LL | send(before());
| ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely | ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
| |
= help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>` = help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22 p:Rc<Cell<i32>>]` = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:7:5: 7:22]`
= note: required because it appears within the type `impl Fn<(i32,)>` = note: required because it appears within the type `impl Fn<(i32,)>`
error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
@ -27,7 +27,7 @@ LL | fn after() -> impl Fn(i32) {
| ------------ within this `impl Fn<(i32,)>` | ------------ within this `impl Fn<(i32,)>`
| |
= help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>` = help: within `impl Fn<(i32,)>`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:24:5: 24:22 p:Rc<Cell<i32>>]` = note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:24:5: 24:22]`
= note: required because it appears within the type `impl Fn<(i32,)>` = note: required because it appears within the type `impl Fn<(i32,)>`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -54,7 +54,7 @@ LL | fn closure_capture() -> impl Sized {
LL | / move || { LL | / move || {
LL | | x; LL | | x;
LL | | } LL | | }
| |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 37:6 x:impl Sized]` | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:35:5: 37:6]`
error[E0720]: cannot resolve opaque type error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:40:29 --> $DIR/recursive-impl-trait-type-indirect.rs:40:29
@ -65,7 +65,7 @@ LL | fn closure_ref_capture() -> impl Sized {
LL | / move || { LL | / move || {
LL | | &x; LL | | &x;
LL | | } LL | | }
| |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 45:6 x:impl Sized]` | |_____- returning here with type `[closure@$DIR/recursive-impl-trait-type-indirect.rs:43:5: 45:6]`
error[E0720]: cannot resolve opaque type error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:48:21 --> $DIR/recursive-impl-trait-type-indirect.rs:48:21
@ -95,7 +95,7 @@ LL | / move || {
LL | | yield; LL | | yield;
LL | | x; LL | | x;
LL | | } LL | | }
| |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 64:6 x:impl Sized {()}]` | |_____- returning here with type `[generator@$DIR/recursive-impl-trait-type-indirect.rs:61:5: 64:6 {()}]`
error[E0720]: cannot resolve opaque type error[E0720]: cannot resolve opaque type
--> $DIR/recursive-impl-trait-type-indirect.rs:67:35 --> $DIR/recursive-impl-trait-type-indirect.rs:67:35

View file

@ -12,7 +12,7 @@ LL | pub fn catch_unwind<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
= help: within `Cell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>` = help: within `Cell<i32>`, the trait `RefUnwindSafe` is not implemented for `UnsafeCell<i32>`
= note: required because it appears within the type `Cell<i32>` = note: required because it appears within the type `Cell<i32>`
= note: required because of the requirements on the impl of `UnwindSafe` for `&Cell<i32>` = note: required because of the requirements on the impl of `UnwindSafe` for `&Cell<i32>`
= note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:5:18: 5:35 x:&Cell<i32>]` = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:5:18: 5:35]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -11,7 +11,7 @@ note: this value implements `FnOnce`, which causes it to be moved when called
| |
LL | f(); LL | f();
| ^ | ^
= note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:41 x:Box<isize>]`, which does not implement the `Copy` trait = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:41]`, which does not implement the `Copy` trait
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,4 +1,4 @@
error[E0271]: type mismatch resolving `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]> as Iterator>::Item == &_` error[E0271]: type mismatch resolving `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]> as Iterator>::Item == &_`
--> $DIR/issue-31173.rs:10:10 --> $DIR/issue-31173.rs:10:10
| |
LL | .cloned() LL | .cloned()
@ -7,11 +7,11 @@ LL | .cloned()
= note: expected type `u8` = note: expected type `u8`
found reference `&_` found reference `&_`
error[E0599]: no method named `collect` found for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>` in the current scope error[E0599]: no method named `collect` found for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>` in the current scope
--> $DIR/issue-31173.rs:14:10 --> $DIR/issue-31173.rs:14:10
| |
LL | .collect(); LL | .collect();
| ^^^^^^^ method not found in `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>` | ^^^^^^^ method not found in `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>`
| |
::: $SRC_DIR/core/src/iter/adapters/mod.rs:LL:COL ::: $SRC_DIR/core/src/iter/adapters/mod.rs:LL:COL
| |
@ -22,10 +22,10 @@ LL | pub struct TakeWhile<I, P> {
| -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_` | -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_`
| |
= note: the method `collect` exists but the following trait bounds were not satisfied: = note: the method `collect` exists but the following trait bounds were not satisfied:
`<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]> as Iterator>::Item = &_` `<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 found_e:_]>>: Iterator` 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 found_e:_]>>: 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 found_e:_]>>: Iterator` which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 9:6]>>: Iterator`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -5,12 +5,12 @@ LL | fn bar<F:FnOnce() + Send>(_: F) { }
| ---- required by this bound in `bar` | ---- required by this bound in `bar`
... ...
LL | bar(move|| foo(x)); LL | bar(move|| foo(x));
| ^^^ ------------- within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:Rc<usize>]` | ^^^ ------------- within this `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`
| | | |
| `Rc<usize>` cannot be sent between threads safely | `Rc<usize>` cannot be sent between threads safely
| |
= help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:Rc<usize>]`, the trait `Send` is not implemented for `Rc<usize>` = help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`, the trait `Send` is not implemented for `Rc<usize>`
= note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:Rc<usize>]` = note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -9,17 +9,17 @@ LL | |
LL | | let y = x; LL | | let y = x;
LL | | println!("{:?}", y); LL | | println!("{:?}", y);
LL | | }); LL | | });
| |_____- within this `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6 x:Foo]` | |_____- within this `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]`
| |
::: $SRC_DIR/std/src/thread/mod.rs:LL:COL ::: $SRC_DIR/std/src/thread/mod.rs:LL:COL
| |
LL | F: Send + 'static, LL | F: Send + 'static,
| ---- required by this bound in `spawn` | ---- required by this bound in `spawn`
| |
= help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6 x:Foo]`, the trait `Send` is not implemented for `Rc<()>` = help: within `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]`, the trait `Send` is not implemented for `Rc<()>`
= note: required because it appears within the type `Port<()>` = note: required because it appears within the type `Port<()>`
= note: required because it appears within the type `Foo` = note: required because it appears within the type `Foo`
= note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6 x:Foo]` = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:25:19: 29:6]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,16 +1,16 @@
error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` error[E0277]: the trait bound `S: Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`
--> $DIR/not-clone-closure.rs:11:23 --> $DIR/not-clone-closure.rs:11:23
| |
LL | let hello = move || { LL | let hello = move || {
| _________________- | _________________-
LL | | println!("Hello {}", a.0); LL | | println!("Hello {}", a.0);
LL | | }; LL | | };
| |_____- within this `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` | |_____- within this `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`
LL | LL |
LL | let hello = hello.clone(); LL | let hello = hello.clone();
| ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`, the trait `Clone` is not implemented for `S` | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`, the trait `Clone` is not implemented for `S`
| |
= note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6]`
error: aborting due to previous error error: aborting due to previous error

View file

@ -33,7 +33,7 @@ LL | let mut f = move |g: Box<dyn FnMut(isize)>, b: isize| {
| ----- captured outer variable | ----- captured outer variable
... ...
LL | foo(f); LL | foo(f);
| ^ move occurs because `f` has type `[closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 54:6 s:String]`, which does not implement the `Copy` trait | ^ move occurs because `f` has type `[closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 54:6]`, which does not implement the `Copy` trait
error[E0505]: cannot move out of `f` because it is borrowed error[E0505]: cannot move out of `f` because it is borrowed
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16 --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16

View file

@ -41,7 +41,7 @@ LL | |
LL | | where LL | | where
LL | | G: Get<T> LL | | G: Get<T>
| |_____________^ | |_____________^
note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:30:5: 32:6 g:G, dest:&mut T]` will meet its required lifetime bounds note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:30:5: 32:6]` will meet its required lifetime bounds
--> $DIR/missing-lifetimes-in-signature.rs:25:37 --> $DIR/missing-lifetimes-in-signature.rs:25:37
| |
LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
@ -65,7 +65,7 @@ LL | |
LL | | where LL | | where
LL | | G: Get<T> LL | | G: Get<T>
| |_____________^ | |_____________^
note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:52:5: 54:6 g:G, dest:&mut T]` will meet its required lifetime bounds note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:52:5: 54:6]` will meet its required lifetime bounds
--> $DIR/missing-lifetimes-in-signature.rs:47:45 --> $DIR/missing-lifetimes-in-signature.rs:47:45
| |
LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ LL | fn qux<'a, G: 'a, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
@ -86,7 +86,7 @@ note: the parameter type `G` must be valid for the anonymous lifetime #1 defined
| |
LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:61:9: 63:10 g:G, dest:&mut T]` will meet its required lifetime bounds note: ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:61:9: 63:10]` will meet its required lifetime bounds
--> $DIR/missing-lifetimes-in-signature.rs:59:58 --> $DIR/missing-lifetimes-in-signature.rs:59:58
| |
LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ { LL | fn qux<'b, G: Get<T> + 'b, T>(g: G, dest: &mut T) -> impl FnOnce() + '_ {
@ -108,7 +108,7 @@ error[E0309]: the parameter type `G` may not live long enough
--> $DIR/missing-lifetimes-in-signature.rs:79:44 --> $DIR/missing-lifetimes-in-signature.rs:79:44
| |
LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a LL | fn bak<'a, G, T>(g: G, dest: &'a mut T) -> impl FnOnce() + 'a
| - ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:84:5: 86:6 g:G, dest:&mut T]` will meet its required lifetime bounds | - ^^^^^^^^^^^^^^^^^^ ...so that the type `[closure@$DIR/missing-lifetimes-in-signature.rs:84:5: 86:6]` will meet its required lifetime bounds
| | | |
| help: consider adding an explicit lifetime bound...: `G: 'a` | help: consider adding an explicit lifetime bound...: `G: 'a`