Auto merge of #77069 - sexxi-goose:closure_print_2, r=nikomatsakis
pretty.rs: Update Closure and Generator print More detailed outline: https://github.com/rust-lang/project-rfc-2229/pull/17 Closes: https://github.com/rust-lang/project-rfc-2229/issues/11 r? `@nikomatsakis` cc `@eddyb` `@davidtwco` `@estebank`
This commit is contained in:
commit
6ac6c67574
41 changed files with 513 additions and 122 deletions
|
@ -641,42 +641,35 @@ pub trait PrettyPrinter<'tcx>:
|
|||
}
|
||||
ty::Str => p!(write("str")),
|
||||
ty::Generator(did, substs, movability) => {
|
||||
p!(write("["));
|
||||
match movability {
|
||||
hir::Movability::Movable => p!(write("[generator")),
|
||||
hir::Movability::Static => p!(write("[static generator")),
|
||||
hir::Movability::Movable => {}
|
||||
hir::Movability::Static => p!(write("static ")),
|
||||
}
|
||||
|
||||
if !self.tcx().sess.verbose() {
|
||||
p!(write("generator"));
|
||||
// FIXME(eddyb) should use `def_span`.
|
||||
if let Some(did) = did.as_local() {
|
||||
let hir_id = self.tcx().hir().local_def_id_to_hir_id(did);
|
||||
let span = self.tcx().hir().span(hir_id);
|
||||
p!(write("@{}", self.tcx().sess.source_map().span_to_string(span)));
|
||||
|
||||
if substs.as_generator().is_valid() {
|
||||
let upvar_tys = substs.as_generator().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)));
|
||||
|
||||
if substs.as_generator().is_valid() {
|
||||
let upvar_tys = substs.as_generator().upvar_tys();
|
||||
let mut sep = " ";
|
||||
for (index, upvar_ty) in upvar_tys.enumerate() {
|
||||
p!(write("{}{}:", sep, index), print(upvar_ty));
|
||||
sep = ", ";
|
||||
}
|
||||
} else {
|
||||
p!(print_def_path(did, substs));
|
||||
if substs.as_generator().is_valid() {
|
||||
// Search for the first inference variable
|
||||
p!(write(" upvar_tys=("));
|
||||
let mut uninferred_ty =
|
||||
substs.as_generator().upvar_tys().filter(|ty| ty.is_ty_infer());
|
||||
if uninferred_ty.next().is_some() {
|
||||
p!(write("unavailable"));
|
||||
} else {
|
||||
self = self.comma_sep(substs.as_generator().upvar_tys())?;
|
||||
}
|
||||
p!(write(")"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -684,14 +677,15 @@ pub trait PrettyPrinter<'tcx>:
|
|||
p!(write(" "), print(substs.as_generator().witness()));
|
||||
}
|
||||
|
||||
p!(write("]"))
|
||||
p!(write("]"));
|
||||
}
|
||||
ty::GeneratorWitness(types) => {
|
||||
p!(in_binder(&types));
|
||||
}
|
||||
ty::Closure(did, substs) => {
|
||||
p!(write("[closure"));
|
||||
|
||||
p!(write("["));
|
||||
if !self.tcx().sess.verbose() {
|
||||
p!(write("closure"));
|
||||
// FIXME(eddyb) should use `def_span`.
|
||||
if let Some(did) = did.as_local() {
|
||||
let hir_id = self.tcx().hir().local_def_id_to_hir_id(did);
|
||||
|
@ -701,44 +695,32 @@ pub trait PrettyPrinter<'tcx>:
|
|||
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 {
|
||||
p!(print_def_path(did, substs));
|
||||
if substs.as_closure().is_valid() {
|
||||
let upvar_tys = substs.as_closure().upvar_tys();
|
||||
let mut sep = " ";
|
||||
for (index, upvar_ty) in upvar_tys.enumerate() {
|
||||
p!(write("{}{}:", sep, index), print(upvar_ty));
|
||||
sep = ", ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if self.tcx().sess.verbose() && substs.as_closure().is_valid() {
|
||||
// Search for the first inference variable
|
||||
let mut uninferred_ty =
|
||||
substs.as_closure().upvar_tys().filter(|ty| ty.is_ty_infer());
|
||||
if uninferred_ty.next().is_some() {
|
||||
// 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("]"))
|
||||
}
|
||||
}
|
||||
p!(write("]"));
|
||||
}
|
||||
ty::Array(ty, sz) => {
|
||||
p!(write("["), print(ty), write("; "));
|
||||
|
|
|
@ -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 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 _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 _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 _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
|
||||
|
|
|
@ -41,8 +41,8 @@ LL | require_send(send_fut);
|
|||
|
|
||||
= 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 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 `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 `[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 {}]>`
|
||||
= 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`
|
||||
|
|
|
@ -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 x:_]`
|
||||
found closure `[closure@$DIR/issue-20862.rs:2:5: 2:14]`
|
||||
|
||||
error[E0618]: expected function, found `()`
|
||||
--> $DIR/issue-20862.rs:7:13
|
||||
|
|
|
@ -4,7 +4,7 @@ error: lifetime may not live long enough
|
|||
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
|
||||
LL | || f() // The `nested` closure
|
||||
| ^^^^^^ returning this value requires that `'1` must outlive `'2`
|
||||
|
|
|
@ -11,7 +11,7 @@ LL | F: Send + 'static,
|
|||
|
|
||||
= 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 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
|
||||
--> $DIR/closure-move-sync.rs:18:5
|
||||
|
@ -26,7 +26,7 @@ LL | F: Send + 'static,
|
|||
|
|
||||
= 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 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
|
||||
|
||||
|
|
|
@ -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 a:_]`
|
||||
found closure `[closure@$DIR/closure-no-fn-1.rs:6:29: 6:50]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -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 b:_]`
|
||||
found closure `[closure@$DIR/closure-no-fn-2.rs:6:27: 6:35]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
||||
LL | let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
|
||||
|
|
|
@ -7,7 +7,7 @@ LL | call_bare(f)
|
|||
| ^ expected fn pointer, found closure
|
||||
|
|
||||
= 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
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ LL | | };
|
|||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= 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
|
||||
--> $DIR/closure_cap_coerce_many_fail.rs:18:16
|
||||
|
@ -28,7 +28,7 @@ LL | | };
|
|||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= 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
|
||||
= 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 | | "+" => |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,
|
||||
| | ^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
||||
LL | | _ => unimplemented!(),
|
||||
LL | | };
|
||||
| |_____- `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]`
|
||||
= note: no two closures, even if identical, have the same type
|
||||
= 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 | | "+" => |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,
|
||||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected closure, found a different closure
|
||||
LL | | _ => unimplemented!(),
|
||||
LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected type `[closure@$DIR/closure_cap_coerce_many_fail.rs:34:16: 34:43 cap:_]`
|
||||
found closure `[closure@$DIR/closure_cap_coerce_many_fail.rs:35:16: 35: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]`
|
||||
= note: no two closures, even if identical, have the same type
|
||||
= help: consider boxing your closure and/or using it as a trait object
|
||||
|
||||
|
|
23
src/test/ui/closures/print/closure-print-generic-1.rs
Normal file
23
src/test/ui/closures/print/closure-print-generic-1.rs
Normal file
|
@ -0,0 +1,23 @@
|
|||
fn to_fn_once<F: FnOnce()>(f: F) -> F {
|
||||
f
|
||||
}
|
||||
|
||||
fn f<T: std::fmt::Display>(y: T) {
|
||||
struct Foo<U: std::fmt::Display> {
|
||||
x: U,
|
||||
};
|
||||
|
||||
let foo = Foo { x: "x" };
|
||||
|
||||
let c = to_fn_once(move || {
|
||||
println!("{} {}", foo.x, y);
|
||||
});
|
||||
|
||||
c();
|
||||
c();
|
||||
//~^ ERROR use of moved value
|
||||
}
|
||||
|
||||
fn main() {
|
||||
f("S");
|
||||
}
|
20
src/test/ui/closures/print/closure-print-generic-1.stderr
Normal file
20
src/test/ui/closures/print/closure-print-generic-1.stderr
Normal file
|
@ -0,0 +1,20 @@
|
|||
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
|
||||
...
|
||||
LL | c();
|
||||
| --- `c` moved due to this call
|
||||
LL | c();
|
||||
| ^ value used here after move
|
||||
|
|
||||
note: this value implements `FnOnce`, which causes it to be moved when called
|
||||
--> $DIR/closure-print-generic-1.rs:16:5
|
||||
|
|
||||
LL | c();
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
13
src/test/ui/closures/print/closure-print-generic-2.rs
Normal file
13
src/test/ui/closures/print/closure-print-generic-2.rs
Normal file
|
@ -0,0 +1,13 @@
|
|||
mod mod1 {
|
||||
pub fn f<T: std::fmt::Display>(t: T) {
|
||||
let x = 20;
|
||||
|
||||
let c = || println!("{} {}", t, x);
|
||||
let c1: () = c;
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mod1::f(5i32);
|
||||
}
|
20
src/test/ui/closures/print/closure-print-generic-2.stderr
Normal file
20
src/test/ui/closures/print/closure-print-generic-2.stderr
Normal file
|
@ -0,0 +1,20 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/closure-print-generic-2.rs:6:22
|
||||
|
|
||||
LL | let c = || println!("{} {}", t, x);
|
||||
| -------------------------- 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]`
|
||||
help: use parentheses to call this closure
|
||||
|
|
||||
LL | let c1: () = c();
|
||||
| ^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
|
@ -0,0 +1,16 @@
|
|||
// compile-flags: -Ztrim-diagnostic-paths=off -Zverbose
|
||||
|
||||
mod mod1 {
|
||||
pub fn f<T: std::fmt::Display>(t: T)
|
||||
{
|
||||
let x = 20;
|
||||
|
||||
let c = || println!("{} {}", t, x);
|
||||
let c1 : () = c;
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mod1::f(5i32);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/closure-print-generic-trim-off-verbose-2.rs:9:23
|
||||
|
|
||||
LL | let c = || println!("{} {}", t, x);
|
||||
| -------------------------- the found closure
|
||||
LL | let c1 : () = c;
|
||||
| -- ^ expected `()`, found closure
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found closure `[mod1::f<T>::{closure#0} closure_substs=(unavailable)]`
|
||||
help: use parentheses to call this closure
|
||||
|
|
||||
LL | let c1 : () = c();
|
||||
| ^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
|
@ -0,0 +1,24 @@
|
|||
// compile-flags: -Zverbose
|
||||
|
||||
fn to_fn_once<F:FnOnce()>(f: F) -> F { f }
|
||||
|
||||
fn f<T: std::fmt::Display>(y: T) {
|
||||
struct Foo<U: std::fmt::Display> {
|
||||
x: U
|
||||
};
|
||||
|
||||
let foo = Foo{ x: "x" };
|
||||
|
||||
let c = to_fn_once(move|| {
|
||||
println!("{} {}", foo.x, y);
|
||||
});
|
||||
|
||||
c();
|
||||
c();
|
||||
//~^ ERROR use of moved value
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
f("S");
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
error[E0382]: use of moved value: `c`
|
||||
--> $DIR/closure-print-generic-verbose-1.rs:17:5
|
||||
|
|
||||
LL | let c = to_fn_once(move|| {
|
||||
| - move occurs because `c` has type `[f<T>::{closure#0} closure_kind_ty=i32 closure_sig_as_fn_ptr_ty=extern "rust-call" fn(()) upvar_tys=(Foo<&'_#10r str>, T)]`, which does not implement the `Copy` trait
|
||||
...
|
||||
LL | c();
|
||||
| --- `c` moved due to this call
|
||||
LL | c();
|
||||
| ^ value used here after move
|
||||
|
|
||||
note: this value implements `FnOnce`, which causes it to be moved when called
|
||||
--> $DIR/closure-print-generic-verbose-1.rs:16:5
|
||||
|
|
||||
LL | c();
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0382`.
|
|
@ -0,0 +1,16 @@
|
|||
// compile-flags: -Zverbose
|
||||
|
||||
mod mod1 {
|
||||
pub fn f<T: std::fmt::Display>(t: T)
|
||||
{
|
||||
let x = 20;
|
||||
|
||||
let c = || println!("{} {}", t, x);
|
||||
let c1 : () = c;
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mod1::f(5i32);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/closure-print-generic-verbose-2.rs:9:23
|
||||
|
|
||||
LL | let c = || println!("{} {}", t, x);
|
||||
| -------------------------- the found closure
|
||||
LL | let c1 : () = c;
|
||||
| -- ^ expected `()`, found closure
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found closure `[f<T>::{closure#0} closure_substs=(unavailable)]`
|
||||
help: use parentheses to call this closure
|
||||
|
|
||||
LL | let c1 : () = c();
|
||||
| ^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
12
src/test/ui/closures/print/closure-print-verbose.rs
Normal file
12
src/test/ui/closures/print/closure-print-verbose.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
// compile-flags: -Zverbose
|
||||
|
||||
// Same as closure-coerce-fn-1.rs
|
||||
|
||||
// Ensure that capturing closures are never coerced to fns
|
||||
// Especially interesting as non-capturing closures can be.
|
||||
|
||||
fn main() {
|
||||
let mut a = 0u8;
|
||||
let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
|
||||
//~^ ERROR mismatched types
|
||||
}
|
14
src/test/ui/closures/print/closure-print-verbose.stderr
Normal file
14
src/test/ui/closures/print/closure-print-verbose.stderr
Normal file
|
@ -0,0 +1,14 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/closure-print-verbose.rs:10:29
|
||||
|
|
||||
LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
|
||||
| ------------ ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected fn pointer `fn(u8) -> u8`
|
||||
found closure `[main::{closure#0} closure_substs=(unavailable)]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
|
@ -29,7 +29,7 @@ LL | require_send(send_gen);
|
|||
|
|
||||
= 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 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, ()}`
|
||||
|
|
|
@ -9,7 +9,7 @@ LL | assert_send(|| {
|
|||
|
|
||||
= 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 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
|
||||
--> $DIR/not-send-sync.rs:9:5
|
||||
|
|
60
src/test/ui/generator/print/generator-print-verbose-1.rs
Normal file
60
src/test/ui/generator/print/generator-print-verbose-1.rs
Normal file
|
@ -0,0 +1,60 @@
|
|||
// compile-flags: -Zverbose
|
||||
|
||||
// Same as: src/test/ui/generator/issue-68112.stderr
|
||||
|
||||
#![feature(generators, generator_trait)]
|
||||
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
sync::Arc,
|
||||
pin::Pin,
|
||||
ops::{Generator, GeneratorState},
|
||||
};
|
||||
|
||||
pub struct Ready<T>(Option<T>);
|
||||
impl<T> Generator<()> for Ready<T> {
|
||||
type Return = T;
|
||||
type Yield = ();
|
||||
fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> {
|
||||
GeneratorState::Complete(self.0.take().unwrap())
|
||||
}
|
||||
}
|
||||
pub fn make_gen1<T>(t: T) -> Ready<T> {
|
||||
Ready(Some(t))
|
||||
}
|
||||
|
||||
fn require_send(_: impl Send) {}
|
||||
|
||||
fn make_non_send_generator() -> impl Generator<Return = Arc<RefCell<i32>>> {
|
||||
make_gen1(Arc::new(RefCell::new(0)))
|
||||
}
|
||||
|
||||
fn test1() {
|
||||
let send_gen = || {
|
||||
let _non_send_gen = make_non_send_generator();
|
||||
yield;
|
||||
};
|
||||
require_send(send_gen);
|
||||
//~^ ERROR generator cannot be sent between threads
|
||||
}
|
||||
|
||||
pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> {
|
||||
|| {
|
||||
yield;
|
||||
t
|
||||
}
|
||||
}
|
||||
fn make_non_send_generator2() -> impl Generator<Return = Arc<RefCell<i32>>> {
|
||||
make_gen2(Arc::new(RefCell::new(0)))
|
||||
}
|
||||
|
||||
fn test2() {
|
||||
let send_gen = || {
|
||||
let _non_send_gen = make_non_send_generator2();
|
||||
yield;
|
||||
};
|
||||
require_send(send_gen);
|
||||
//~^ ERROR `RefCell<i32>` cannot be shared between threads safely
|
||||
}
|
||||
|
||||
fn main() {}
|
40
src/test/ui/generator/print/generator-print-verbose-1.stderr
Normal file
40
src/test/ui/generator/print/generator-print-verbose-1.stderr
Normal file
|
@ -0,0 +1,40 @@
|
|||
error: generator cannot be sent between threads safely
|
||||
--> $DIR/generator-print-verbose-1.rs:37:5
|
||||
|
|
||||
LL | fn require_send(_: impl Send) {}
|
||||
| ---- required by this bound in `require_send`
|
||||
...
|
||||
LL | require_send(send_gen);
|
||||
| ^^^^^^^^^^^^ generator is not `Send`
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `RefCell<i32>`
|
||||
note: generator is not `Send` as this value is used across a yield
|
||||
--> $DIR/generator-print-verbose-1.rs:35:9
|
||||
|
|
||||
LL | let _non_send_gen = make_non_send_generator();
|
||||
| ------------- has type `Opaque(DefId(0:24 ~ generator_print_verbose_1[317d]::make_non_send_generator::{opaque#0}), [])` which is not `Send`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `_non_send_gen` maybe used later
|
||||
LL | };
|
||||
| - `_non_send_gen` is later dropped here
|
||||
|
||||
error[E0277]: `RefCell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/generator-print-verbose-1.rs:56:5
|
||||
|
|
||||
LL | fn require_send(_: impl Send) {}
|
||||
| ---- required by this bound in `require_send`
|
||||
...
|
||||
LL | require_send(send_gen);
|
||||
| ^^^^^^^^^^^^ `RefCell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= 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 it appears within the type `[make_gen2<Arc<RefCell<i32>>>::{closure#0} upvar_tys=(Arc<RefCell<i32>>) {()}]`
|
||||
= note: required because it appears within the type `Opaque(DefId(0:29 ~ generator_print_verbose_1[317d]::make_gen2::{opaque#0}), [std::sync::Arc<std::cell::RefCell<i32>>])`
|
||||
= note: required because it appears within the type `Opaque(DefId(0:32 ~ generator_print_verbose_1[317d]::make_non_send_generator2::{opaque#0}), [])`
|
||||
= note: required because it appears within the type `{Opaque(DefId(0:32 ~ generator_print_verbose_1[317d]::make_non_send_generator2::{opaque#0}), []), ()}`
|
||||
= note: required because it appears within the type `[test2::{closure#0} upvar_tys=() {Opaque(DefId(0:32 ~ generator_print_verbose_1[317d]::make_non_send_generator2::{opaque#0}), []), ()}]`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
24
src/test/ui/generator/print/generator-print-verbose-2.rs
Normal file
24
src/test/ui/generator/print/generator-print-verbose-2.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// compile-flags: -Zverbose
|
||||
|
||||
// Same as test/ui/generator/not-send-sync.rs
|
||||
#![feature(generators)]
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
fn main() {
|
||||
fn assert_sync<T: Sync>(_: T) {}
|
||||
fn assert_send<T: Send>(_: T) {}
|
||||
|
||||
assert_sync(|| {
|
||||
//~^ ERROR: generator cannot be shared between threads safely
|
||||
let a = Cell::new(2);
|
||||
yield;
|
||||
});
|
||||
|
||||
let a = Cell::new(2);
|
||||
assert_send(|| {
|
||||
//~^ ERROR: E0277
|
||||
drop(&a);
|
||||
yield;
|
||||
});
|
||||
}
|
36
src/test/ui/generator/print/generator-print-verbose-2.stderr
Normal file
36
src/test/ui/generator/print/generator-print-verbose-2.stderr
Normal file
|
@ -0,0 +1,36 @@
|
|||
error[E0277]: `Cell<i32>` cannot be shared between threads safely
|
||||
--> $DIR/generator-print-verbose-2.rs:19:5
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send(|| {
|
||||
| ^^^^^^^^^^^ `Cell<i32>` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `Cell<i32>`
|
||||
= note: required because of the requirements on the impl of `Send` for `&'_#3r Cell<i32>`
|
||||
= note: required because it appears within the type `[main::{closure#1} upvar_tys=(&'_#3r Cell<i32>) _#16t]`
|
||||
|
||||
error: generator cannot be shared between threads safely
|
||||
--> $DIR/generator-print-verbose-2.rs:12:5
|
||||
|
|
||||
LL | fn assert_sync<T: Sync>(_: T) {}
|
||||
| ---- required by this bound in `assert_sync`
|
||||
...
|
||||
LL | assert_sync(|| {
|
||||
| ^^^^^^^^^^^ generator is not `Sync`
|
||||
|
|
||||
= help: within `[main::{closure#0} upvar_tys=() {Cell<i32>, ()}]`, the trait `Sync` is not implemented for `Cell<i32>`
|
||||
note: generator is not `Sync` as this value is used across a yield
|
||||
--> $DIR/generator-print-verbose-2.rs:15:9
|
||||
|
|
||||
LL | let a = Cell::new(2);
|
||||
| - has type `Cell<i32>` which is not `Sync`
|
||||
LL | yield;
|
||||
| ^^^^^ yield occurs here, with `a` maybe used later
|
||||
LL | });
|
||||
| - `a` is later dropped here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
12
src/test/ui/generator/print/generator-print-verbose-3.rs
Normal file
12
src/test/ui/generator/print/generator-print-verbose-3.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
// compile-flags: -Zverbose
|
||||
|
||||
#![feature(generators, generator_trait)]
|
||||
|
||||
fn main() {
|
||||
let x = "Type mismatch test";
|
||||
let generator :() = || {
|
||||
//~^ ERROR mismatched types
|
||||
yield 1i32;
|
||||
return x
|
||||
};
|
||||
}
|
19
src/test/ui/generator/print/generator-print-verbose-3.stderr
Normal file
19
src/test/ui/generator/print/generator-print-verbose-3.stderr
Normal file
|
@ -0,0 +1,19 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/generator-print-verbose-3.rs:7:25
|
||||
|
|
||||
LL | let generator :() = || {
|
||||
| ____________________--___^
|
||||
| | |
|
||||
| | expected due to this
|
||||
LL | |
|
||||
LL | | yield 1i32;
|
||||
LL | | return x
|
||||
LL | | };
|
||||
| |_____^ expected `()`, found generator
|
||||
|
|
||||
= note: expected unit type `()`
|
||||
found generator `[main::{closure#0} upvar_tys=(unavailable) _#5t]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
|
@ -11,7 +11,7 @@ LL | send(before());
|
|||
| ^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
|
||||
|
|
||||
= 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,)>`
|
||||
|
||||
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,)>`
|
||||
|
|
||||
= 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,)>`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
@ -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 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
|
||||
--> $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 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
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:48:21
|
||||
|
@ -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 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
|
||||
--> $DIR/recursive-impl-trait-type-indirect.rs:67:35
|
||||
|
|
|
@ -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>`
|
||||
= 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 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
|
||||
|
||||
|
|
|
@ -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 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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
||||
LL | .cloned()
|
||||
|
@ -7,11 +7,11 @@ LL | .cloned()
|
|||
= note: expected type `u8`
|
||||
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
|
||||
|
|
||||
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
|
||||
|
|
||||
|
@ -22,10 +22,10 @@ LL | pub struct TakeWhile<I, P> {
|
|||
| -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_`
|
||||
|
|
||||
= 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 = &_`
|
||||
which is required by `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 found_e:_]>>: 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`
|
||||
`<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`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ LL | fn bar<F:FnOnce() + Send>(_: F) { }
|
|||
| ---- required by this bound in `bar`
|
||||
...
|
||||
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
|
||||
|
|
||||
= help: within `[closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:22 x:Rc<usize>]`, 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>]`
|
||||
= 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]`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -9,17 +9,17 @@ LL | |
|
|||
LL | | let y = x;
|
||||
LL | | println!("{:?}", y);
|
||||
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
|
||||
|
|
||||
LL | F: Send + 'static,
|
||||
| ---- 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 `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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
||||
LL | let hello = move || {
|
||||
| _________________-
|
||||
LL | | println!("Hello {}", a.0);
|
||||
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 | 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
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ LL | let mut f = move |g: Box<dyn FnMut(isize)>, b: isize| {
|
|||
| ----- captured outer variable
|
||||
...
|
||||
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
|
||||
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16
|
||||
|
|
|
@ -41,7 +41,7 @@ LL | |
|
|||
LL | | where
|
||||
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
|
||||
|
|
||||
LL | fn bar<G, T>(g: G, dest: &mut T) -> impl FnOnce() + '_
|
||||
|
@ -65,7 +65,7 @@ LL | |
|
|||
LL | | where
|
||||
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
|
||||
|
|
||||
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() + '_ {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
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
|
||||
|
|
||||
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
|
||||
|
|
||||
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`
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue