Point at the def span of trait refs E0277

This commit is contained in:
Esteban Küber 2019-12-15 22:20:30 -08:00
parent c55615155d
commit 0dcdbaec0b
8 changed files with 71 additions and 13 deletions

View file

@ -3,6 +3,9 @@ error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl std::future::
|
LL | fn is_qux<T: Qux>(t: T) { }
| ------ --- required by this bound in `is_qux`
LL |
LL | async fn bar() {
| - within this `impl std::future::Future`
...
LL | is_qux(bar());
| ^^^^^^ within `impl std::future::Future`, the trait `Qux` is not implemented for `Foo`

View file

@ -77,6 +77,9 @@ LL | fn send<T: Send>(_: T) {}
...
LL | send(cycle2().clone());
| ^^^^ `std::rc::Rc<std::string::String>` cannot be sent between threads safely
...
LL | fn cycle2() -> impl Clone {
| ---------- within this `impl std::clone::Clone`
|
= help: within `impl std::clone::Clone`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::string::String>`
= note: required because it appears within the type `impl std::clone::Clone`

View file

@ -1,6 +1,9 @@
error[E0277]: `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely
--> $DIR/auto-trait-leak2.rs:13:5
|
LL | fn before() -> impl Fn(i32) {
| ------------ within this `impl std::ops::Fn<(i32,)>`
...
LL | fn send<T: Send>(_: T) {}
| ---- ---- required by this bound in `send`
...
@ -19,6 +22,9 @@ LL | fn send<T: Send>(_: T) {}
...
LL | send(after());
| ^^^^ `std::rc::Rc<std::cell::Cell<i32>>` cannot be sent between threads safely
...
LL | fn after() -> impl Fn(i32) {
| ------------ within this `impl std::ops::Fn<(i32,)>`
|
= help: within `impl std::ops::Fn<(i32,)>`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::Cell<i32>>`
= note: required because it appears within the type `[closure@$DIR/auto-trait-leak2.rs:24:5: 24:22 p:std::rc::Rc<std::cell::Cell<i32>>]`

View file

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

View file

@ -1,13 +1,20 @@
error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
--> $DIR/no-send-res-ports.rs:29:5
|
LL | thread::spawn(move|| {
| ^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely
LL | thread::spawn(move|| {
| _____^^^^^^^^^^^^^_-
| | |
| | `std::rc::Rc<()>` cannot be sent between threads safely
LL | |
LL | | let y = x;
LL | | println!("{:?}", y);
LL | | });
| |_____- within this `[closure@$DIR/no-send-res-ports.rs:29:19: 33:6 x:main::Foo]`
|
::: $SRC_DIR/libstd/thread/mod.rs:LL:COL
|
LL | F: Send + 'static,
| ---- required by this bound in `std::thread::spawn`
LL | F: Send + 'static,
| ---- required by this bound in `std::thread::spawn`
|
= help: within `[closure@$DIR/no-send-res-ports.rs:29:19: 33:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
= note: required because it appears within the type `Port<()>`

View file

@ -1,8 +1,14 @@
error[E0277]: the trait bound `S: std::clone::Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`
--> $DIR/not-clone-closure.rs:11:23
|
LL | let hello = hello.clone();
| ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`, the trait `std::clone::Clone` is not implemented for `S`
LL | let hello = move || {
| _________________-
LL | | println!("Hello {}", a.0);
LL | | };
| |_____- within this `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`
LL |
LL | let hello = hello.clone();
| ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`, the trait `std::clone::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]`