On long E0277 primary span label, move it to a help

Long span labels don't read well.
This commit is contained in:
Esteban Küber 2024-10-25 05:11:42 +00:00
parent 092ecca5b9
commit 1a0c502183
15 changed files with 93 additions and 78 deletions

View File

@ -328,6 +328,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
} }
} else if let Some(custom_explanation) = safe_transmute_explanation { } else if let Some(custom_explanation) = safe_transmute_explanation {
err.span_label(span, custom_explanation); err.span_label(span, custom_explanation);
} else if explanation.len() > self.tcx.sess.diagnostic_width() {
// Really long types don't look good as span labels, instead move it
// to a `help`.
err.span_label(span, "unsatisfied trait bound");
err.help(explanation);
} else { } else {
err.span_label(span, explanation); err.span_label(span, explanation);
} }

View File

@ -2,8 +2,9 @@ error[E0277]: the trait bound `NotClonableUpvar: Clone` is not satisfied in `{as
--> $DIR/not-clone-closure.rs:32:15 --> $DIR/not-clone-closure.rs:32:15
| |
LL | not_clone.clone(); LL | not_clone.clone();
| ^^^^^ within `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}`, the trait `Clone` is not implemented for `NotClonableUpvar` | ^^^^^ unsatisfied trait bound
| |
= help: within `{async closure@$DIR/not-clone-closure.rs:29:21: 29:34}`, the trait `Clone` is not implemented for `NotClonableUpvar`
note: required because it's used within this closure note: required because it's used within this closure
--> $DIR/not-clone-closure.rs:29:21 --> $DIR/not-clone-closure.rs:29:21
| |

View File

@ -1,4 +1,5 @@
//@ edition:2018 //@ edition:2018
//@compile-flags: --diagnostic-width=300
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)] #![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
use std::future::Future; use std::future::Future;

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
--> $DIR/coroutine-not-future.rs:35:21 --> $DIR/coroutine-not-future.rs:36:21
| |
LL | takes_coroutine(async_fn()); LL | takes_coroutine(async_fn());
| --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>` | --------------- ^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
@ -7,13 +7,13 @@ LL | takes_coroutine(async_fn());
| required by a bound introduced by this call | required by a bound introduced by this call
| |
note: required by a bound in `takes_coroutine` note: required by a bound in `takes_coroutine`
--> $DIR/coroutine-not-future.rs:19:39 --> $DIR/coroutine-not-future.rs:20:39
| |
LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied error[E0277]: the trait bound `impl Future<Output = ()>: Coroutine<_>` is not satisfied
--> $DIR/coroutine-not-future.rs:37:21 --> $DIR/coroutine-not-future.rs:38:21
| |
LL | takes_coroutine(returns_async_block()); LL | takes_coroutine(returns_async_block());
| --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>` | --------------- ^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine<_>` is not implemented for `impl Future<Output = ()>`
@ -21,27 +21,27 @@ LL | takes_coroutine(returns_async_block());
| required by a bound introduced by this call | required by a bound introduced by this call
| |
note: required by a bound in `takes_coroutine` note: required by a bound in `takes_coroutine`
--> $DIR/coroutine-not-future.rs:19:39 --> $DIR/coroutine-not-future.rs:20:39
| |
LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}: Coroutine<_>` is not satisfied error[E0277]: the trait bound `{async block@$DIR/coroutine-not-future.rs:40:21: 40:26}: Coroutine<_>` is not satisfied
--> $DIR/coroutine-not-future.rs:39:21 --> $DIR/coroutine-not-future.rs:40:21
| |
LL | takes_coroutine(async {}); LL | takes_coroutine(async {});
| --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:39:21: 39:26}` | --------------- ^^^^^^^^ the trait `Coroutine<_>` is not implemented for `{async block@$DIR/coroutine-not-future.rs:40:21: 40:26}`
| | | |
| required by a bound introduced by this call | required by a bound introduced by this call
| |
note: required by a bound in `takes_coroutine` note: required by a bound in `takes_coroutine`
--> $DIR/coroutine-not-future.rs:19:39 --> $DIR/coroutine-not-future.rs:20:39
| |
LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {} LL | fn takes_coroutine<ResumeTy>(_g: impl Coroutine<ResumeTy, Yield = (), Return = ()>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_coroutine`
error[E0277]: `impl Coroutine<Yield = (), Return = ()>` is not a future error[E0277]: `impl Coroutine<Yield = (), Return = ()>` is not a future
--> $DIR/coroutine-not-future.rs:43:18 --> $DIR/coroutine-not-future.rs:44:18
| |
LL | takes_future(returns_coroutine()); LL | takes_future(returns_coroutine());
| ------------ ^^^^^^^^^^^^^^^^^^^ `impl Coroutine<Yield = (), Return = ()>` is not a future | ------------ ^^^^^^^^^^^^^^^^^^^ `impl Coroutine<Yield = (), Return = ()>` is not a future
@ -50,13 +50,13 @@ LL | takes_future(returns_coroutine());
| |
= help: the trait `Future` is not implemented for `impl Coroutine<Yield = (), Return = ()>` = help: the trait `Future` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
note: required by a bound in `takes_future` note: required by a bound in `takes_future`
--> $DIR/coroutine-not-future.rs:18:26 --> $DIR/coroutine-not-future.rs:19:26
| |
LL | fn takes_future(_f: impl Future<Output = ()>) {} LL | fn takes_future(_f: impl Future<Output = ()>) {}
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`
error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}` is not a future error[E0277]: `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}` is not a future
--> $DIR/coroutine-not-future.rs:47:9 --> $DIR/coroutine-not-future.rs:48:9
| |
LL | takes_future( LL | takes_future(
| ------------ required by a bound introduced by this call | ------------ required by a bound introduced by this call
@ -65,11 +65,11 @@ LL | / |ctx| {
LL | | LL | |
LL | | ctx = yield (); LL | | ctx = yield ();
LL | | }, LL | | },
| |_________^ `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}` is not a future | |_________^ `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}` is not a future
| |
= help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:47:9: 47:14}` = help: the trait `Future` is not implemented for `{coroutine@$DIR/coroutine-not-future.rs:48:9: 48:14}`
note: required by a bound in `takes_future` note: required by a bound in `takes_future`
--> $DIR/coroutine-not-future.rs:18:26 --> $DIR/coroutine-not-future.rs:19:26
| |
LL | fn takes_future(_f: impl Future<Output = ()>) {} LL | fn takes_future(_f: impl Future<Output = ()>) {}
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future` | ^^^^^^^^^^^^^^^^^^^ required by this bound in `takes_future`

View File

@ -20,10 +20,11 @@ error[E0277]: `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` can't be used as
--> $DIR/const_param_ty_bad.rs:8:11 --> $DIR/const_param_ty_bad.rs:8:11
| |
LL | check(|| {}); LL | check(|| {});
| ----- ^^^^^ the trait `UnsizedConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` | ----- ^^^^^ unsatisfied trait bound
| | | |
| required by a bound introduced by this call | required by a bound introduced by this call
| |
= help: the trait `UnsizedConstParamTy` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}`
note: required by a bound in `check` note: required by a bound in `check`
--> $DIR/const_param_ty_bad.rs:4:18 --> $DIR/const_param_ty_bad.rs:4:18
| |

View File

@ -1,6 +1,7 @@
// gate-test-coroutine_clone // gate-test-coroutine_clone
// Verifies that non-static coroutines can be cloned/copied if all their upvars and locals held // Verifies that non-static coroutines can be cloned/copied if all their upvars and locals held
// across awaits can be cloned/copied. // across awaits can be cloned/copied.
//@compile-flags: --diagnostic-width=300
#![feature(coroutines, coroutine_clone, stmt_expr_attributes)] #![feature(coroutines, coroutine_clone, stmt_expr_attributes)]

View File

@ -1,76 +1,76 @@
error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}` error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`
--> $DIR/clone-impl.rs:49:5 --> $DIR/clone-impl.rs:50:5
| |
LL | move || { LL | move || {
| ------- within this `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}` | ------- within this `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`
... ...
LL | check_copy(&gen_clone_0); LL | check_copy(&gen_clone_0);
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`, the trait `Copy` is not implemented for `Vec<u32>` | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`, the trait `Copy` is not implemented for `Vec<u32>`
| |
note: captured value does not implement `Copy` note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:47:14 --> $DIR/clone-impl.rs:48:14
| |
LL | drop(clonable_0); LL | drop(clonable_0);
| ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy` | ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy`
note: required by a bound in `check_copy` note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:89:18 --> $DIR/clone-impl.rs:90:18
| |
LL | fn check_copy<T: Copy>(_x: &T) {} LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy` | ^^^^ required by this bound in `check_copy`
error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}` error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`
--> $DIR/clone-impl.rs:49:5 --> $DIR/clone-impl.rs:50:5
| |
LL | move || { LL | move || {
| ------- within this `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}` | ------- within this `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`
... ...
LL | check_copy(&gen_clone_0); LL | check_copy(&gen_clone_0);
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:43:5: 43:12}`, the trait `Copy` is not implemented for `Vec<char>` | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:44:5: 44:12}`, the trait `Copy` is not implemented for `Vec<char>`
| |
note: coroutine does not implement `Copy` as this value is used across a yield note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:45:9 --> $DIR/clone-impl.rs:46:9
| |
LL | let v = vec!['a']; LL | let v = vec!['a'];
| - has type `Vec<char>` which does not implement `Copy` | - has type `Vec<char>` which does not implement `Copy`
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `v` maybe used later | ^^^^^ yield occurs here, with `v` maybe used later
note: required by a bound in `check_copy` note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:89:18 --> $DIR/clone-impl.rs:90:18
| |
LL | fn check_copy<T: Copy>(_x: &T) {} LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy` | ^^^^ required by this bound in `check_copy`
error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}` error[E0277]: the trait bound `Vec<u32>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`
--> $DIR/clone-impl.rs:70:5 --> $DIR/clone-impl.rs:71:5
| |
LL | move || { LL | move || {
| ------- within this `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}` | ------- within this `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`
... ...
LL | check_copy(&gen_clone_1); LL | check_copy(&gen_clone_1);
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`, the trait `Copy` is not implemented for `Vec<u32>` | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`, the trait `Copy` is not implemented for `Vec<u32>`
| |
note: captured value does not implement `Copy` note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:68:14 --> $DIR/clone-impl.rs:69:14
| |
LL | drop(clonable_1); LL | drop(clonable_1);
| ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy` | ^^^^^^^^^^ has type `Vec<u32>` which does not implement `Copy`
note: required by a bound in `check_copy` note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:89:18 --> $DIR/clone-impl.rs:90:18
| |
LL | fn check_copy<T: Copy>(_x: &T) {} LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy` | ^^^^ required by this bound in `check_copy`
error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}` error[E0277]: the trait bound `Vec<char>: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`
--> $DIR/clone-impl.rs:70:5 --> $DIR/clone-impl.rs:71:5
| |
LL | move || { LL | move || {
| ------- within this `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}` | ------- within this `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`
... ...
LL | check_copy(&gen_clone_1); LL | check_copy(&gen_clone_1);
| ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:58:5: 58:12}`, the trait `Copy` is not implemented for `Vec<char>` | ^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:59:5: 59:12}`, the trait `Copy` is not implemented for `Vec<char>`
| |
note: coroutine does not implement `Copy` as this value is used across a yield note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/clone-impl.rs:64:9 --> $DIR/clone-impl.rs:65:9
| |
LL | let v = vec!['a']; LL | let v = vec!['a'];
| - has type `Vec<char>` which does not implement `Copy` | - has type `Vec<char>` which does not implement `Copy`
@ -78,27 +78,27 @@ LL | let v = vec!['a'];
LL | yield; LL | yield;
| ^^^^^ yield occurs here, with `v` maybe used later | ^^^^^ yield occurs here, with `v` maybe used later
note: required by a bound in `check_copy` note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:89:18 --> $DIR/clone-impl.rs:90:18
| |
LL | fn check_copy<T: Copy>(_x: &T) {} LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy` | ^^^^ required by this bound in `check_copy`
error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}` error[E0277]: the trait bound `NonClone: Copy` is not satisfied in `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`
--> $DIR/clone-impl.rs:83:5 --> $DIR/clone-impl.rs:84:5
| |
LL | move || { LL | move || {
| ------- within this `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}` | ------- within this `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`
... ...
LL | check_copy(&gen_non_clone); LL | check_copy(&gen_non_clone);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`, the trait `Copy` is not implemented for `NonClone` | ^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`, the trait `Copy` is not implemented for `NonClone`
| |
note: captured value does not implement `Copy` note: captured value does not implement `Copy`
--> $DIR/clone-impl.rs:81:14 --> $DIR/clone-impl.rs:82:14
| |
LL | drop(non_clonable); LL | drop(non_clonable);
| ^^^^^^^^^^^^ has type `NonClone` which does not implement `Copy` | ^^^^^^^^^^^^ has type `NonClone` which does not implement `Copy`
note: required by a bound in `check_copy` note: required by a bound in `check_copy`
--> $DIR/clone-impl.rs:89:18 --> $DIR/clone-impl.rs:90:18
| |
LL | fn check_copy<T: Copy>(_x: &T) {} LL | fn check_copy<T: Copy>(_x: &T) {}
| ^^^^ required by this bound in `check_copy` | ^^^^ required by this bound in `check_copy`
@ -108,22 +108,22 @@ LL + #[derive(Copy)]
LL | struct NonClone; LL | struct NonClone;
| |
error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}` error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`
--> $DIR/clone-impl.rs:85:5 --> $DIR/clone-impl.rs:86:5
| |
LL | move || { LL | move || {
| ------- within this `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}` | ------- within this `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`
... ...
LL | check_clone(&gen_non_clone); LL | check_clone(&gen_non_clone);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:79:5: 79:12}`, the trait `Clone` is not implemented for `NonClone` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ within `{coroutine@$DIR/clone-impl.rs:80:5: 80:12}`, the trait `Clone` is not implemented for `NonClone`
| |
note: captured value does not implement `Clone` note: captured value does not implement `Clone`
--> $DIR/clone-impl.rs:81:14 --> $DIR/clone-impl.rs:82:14
| |
LL | drop(non_clonable); LL | drop(non_clonable);
| ^^^^^^^^^^^^ has type `NonClone` which does not implement `Clone` | ^^^^^^^^^^^^ has type `NonClone` which does not implement `Clone`
note: required by a bound in `check_clone` note: required by a bound in `check_clone`
--> $DIR/clone-impl.rs:90:19 --> $DIR/clone-impl.rs:91:19
| |
LL | fn check_clone<T: Clone>(_x: &T) {} LL | fn check_clone<T: Clone>(_x: &T) {}
| ^^^^^ required by this bound in `check_clone` | ^^^^^ required by this bound in `check_clone`

View File

@ -1,3 +1,4 @@
//@compile-flags: --diagnostic-width=300
#![feature(coroutines)] #![feature(coroutines)]
#![feature(coroutine_clone)] #![feature(coroutine_clone)]
#![feature(coroutine_trait)] #![feature(coroutine_trait)]

View File

@ -1,8 +1,8 @@
error[E0382]: borrow of moved value: `g` error[E0382]: borrow of moved value: `g`
--> $DIR/issue-105084.rs:38:14 --> $DIR/issue-105084.rs:39:14
| |
LL | let mut g = #[coroutine] LL | let mut g = #[coroutine]
| ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}`, which does not implement the `Copy` trait | ----- move occurs because `g` has type `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, which does not implement the `Copy` trait
... ...
LL | let mut h = copy(g); LL | let mut h = copy(g);
| - value moved here | - value moved here
@ -11,7 +11,7 @@ LL | Pin::new(&mut g).resume(());
| ^^^^^^ value borrowed here after move | ^^^^^^ value borrowed here after move
| |
note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary note: consider changing this parameter type in function `copy` to borrow instead if owning the value isn't necessary
--> $DIR/issue-105084.rs:9:21 --> $DIR/issue-105084.rs:10:21
| |
LL | fn copy<T: Copy>(x: T) -> T { LL | fn copy<T: Copy>(x: T) -> T {
| ---- ^ this parameter takes ownership of the value | ---- ^ this parameter takes ownership of the value
@ -22,17 +22,17 @@ help: consider cloning the value if the performance cost is acceptable
LL | let mut h = copy(g.clone()); LL | let mut h = copy(g.clone());
| ++++++++ | ++++++++
error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}` error[E0277]: the trait bound `Box<(i32, ())>: Copy` is not satisfied in `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
--> $DIR/issue-105084.rs:32:17 --> $DIR/issue-105084.rs:33:17
| |
LL | || { LL | || {
| -- within this `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}` | -- within this `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`
... ...
LL | let mut h = copy(g); LL | let mut h = copy(g);
| ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:15:5: 15:7}`, the trait `Copy` is not implemented for `Box<(i32, ())>` | ^^^^^^^ within `{coroutine@$DIR/issue-105084.rs:16:5: 16:7}`, the trait `Copy` is not implemented for `Box<(i32, ())>`
| |
note: coroutine does not implement `Copy` as this value is used across a yield note: coroutine does not implement `Copy` as this value is used across a yield
--> $DIR/issue-105084.rs:22:22 --> $DIR/issue-105084.rs:23:22
| |
LL | Box::new((5, yield)); LL | Box::new((5, yield));
| -------------^^^^^-- | -------------^^^^^--
@ -40,7 +40,7 @@ LL | Box::new((5, yield));
| | yield occurs here, with `Box::new((5, yield))` maybe used later | | yield occurs here, with `Box::new((5, yield))` maybe used later
| has type `Box<(i32, ())>` which does not implement `Copy` | has type `Box<(i32, ())>` which does not implement `Copy`
note: required by a bound in `copy` note: required by a bound in `copy`
--> $DIR/issue-105084.rs:9:12 --> $DIR/issue-105084.rs:10:12
| |
LL | fn copy<T: Copy>(x: T) -> T { LL | fn copy<T: Copy>(x: T) -> T {
| ^^^^ required by this bound in `copy` | ^^^^ required by this bound in `copy`

View File

@ -20,10 +20,11 @@ error[E0277]: the trait bound `{closure@$DIR/fn-ctor-passed-as-arg-where-it-shou
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:19:9 --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:19:9
| |
LL | bar(closure); LL | bar(closure);
| --- ^^^^^^^ the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}` | --- ^^^^^^^ unsatisfied trait bound
| | | |
| required by a bound introduced by this call | required by a bound introduced by this call
| |
= help: the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}`
note: required by a bound in `bar` note: required by a bound in `bar`
--> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16 --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16
| |

View File

@ -1,5 +1,6 @@
// Checks that certain traits for which we don't want to suggest borrowing // Checks that certain traits for which we don't want to suggest borrowing
// are blacklisted and don't cause the suggestion to be issued. // are blacklisted and don't cause the suggestion to be issued.
//@compile-flags: --diagnostic-width=300
#![feature(coroutines)] #![feature(coroutines)]

View File

@ -1,5 +1,5 @@
error[E0277]: the trait bound `String: Copy` is not satisfied error[E0277]: the trait bound `String: Copy` is not satisfied
--> $DIR/issue-84973-blacklist.rs:15:12 --> $DIR/issue-84973-blacklist.rs:16:12
| |
LL | f_copy("".to_string()); LL | f_copy("".to_string());
| ------ ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` | ------ ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
@ -7,7 +7,7 @@ LL | f_copy("".to_string());
| required by a bound introduced by this call | required by a bound introduced by this call
| |
note: required by a bound in `f_copy` note: required by a bound in `f_copy`
--> $DIR/issue-84973-blacklist.rs:6:14 --> $DIR/issue-84973-blacklist.rs:7:14
| |
LL | fn f_copy<T: Copy>(t: T) {} LL | fn f_copy<T: Copy>(t: T) {}
| ^^^^ required by this bound in `f_copy` | ^^^^ required by this bound in `f_copy`
@ -18,7 +18,7 @@ LL + f_copy("");
| |
error[E0277]: the trait bound `S: Clone` is not satisfied error[E0277]: the trait bound `S: Clone` is not satisfied
--> $DIR/issue-84973-blacklist.rs:16:13 --> $DIR/issue-84973-blacklist.rs:17:13
| |
LL | f_clone(S); LL | f_clone(S);
| ------- ^ the trait `Clone` is not implemented for `S` | ------- ^ the trait `Clone` is not implemented for `S`
@ -26,7 +26,7 @@ LL | f_clone(S);
| required by a bound introduced by this call | required by a bound introduced by this call
| |
note: required by a bound in `f_clone` note: required by a bound in `f_clone`
--> $DIR/issue-84973-blacklist.rs:7:15 --> $DIR/issue-84973-blacklist.rs:8:15
| |
LL | fn f_clone<T: Clone>(t: T) {} LL | fn f_clone<T: Clone>(t: T) {}
| ^^^^^ required by this bound in `f_clone` | ^^^^^ required by this bound in `f_clone`
@ -36,24 +36,24 @@ LL + #[derive(Clone)]
LL | struct S; LL | struct S;
| |
error[E0277]: `{static coroutine@$DIR/issue-84973-blacklist.rs:17:26: 17:35}` cannot be unpinned error[E0277]: `{static coroutine@$DIR/issue-84973-blacklist.rs:18:26: 18:35}` cannot be unpinned
--> $DIR/issue-84973-blacklist.rs:17:26 --> $DIR/issue-84973-blacklist.rs:18:26
| |
LL | f_unpin(#[coroutine] static || { yield; }); LL | f_unpin(#[coroutine] static || { yield; });
| ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/issue-84973-blacklist.rs:17:26: 17:35}` | ------- ^^^^^^^^^^^^^^^^^^^^ the trait `Unpin` is not implemented for `{static coroutine@$DIR/issue-84973-blacklist.rs:18:26: 18:35}`
| | | |
| required by a bound introduced by this call | required by a bound introduced by this call
| |
= note: consider using the `pin!` macro = note: consider using the `pin!` macro
consider using `Box::pin` if you need to access the pinned value outside of the current scope consider using `Box::pin` if you need to access the pinned value outside of the current scope
note: required by a bound in `f_unpin` note: required by a bound in `f_unpin`
--> $DIR/issue-84973-blacklist.rs:8:15 --> $DIR/issue-84973-blacklist.rs:9:15
| |
LL | fn f_unpin<T: Unpin>(t: T) {} LL | fn f_unpin<T: Unpin>(t: T) {}
| ^^^^^ required by this bound in `f_unpin` | ^^^^^ required by this bound in `f_unpin`
error[E0277]: the size for values of type `dyn Fn()` cannot be known at compilation time error[E0277]: the size for values of type `dyn Fn()` cannot be known at compilation time
--> $DIR/issue-84973-blacklist.rs:22:13 --> $DIR/issue-84973-blacklist.rs:23:13
| |
LL | f_sized(*ref_cl); LL | f_sized(*ref_cl);
| ------- ^^^^^^^ doesn't have a size known at compile-time | ------- ^^^^^^^ doesn't have a size known at compile-time
@ -62,7 +62,7 @@ LL | f_sized(*ref_cl);
| |
= help: the trait `Sized` is not implemented for `dyn Fn()` = help: the trait `Sized` is not implemented for `dyn Fn()`
note: required by a bound in `f_sized` note: required by a bound in `f_sized`
--> $DIR/issue-84973-blacklist.rs:9:15 --> $DIR/issue-84973-blacklist.rs:10:15
| |
LL | fn f_sized<T: Sized>(t: T) {} LL | fn f_sized<T: Sized>(t: T) {}
| ^^^^^ required by this bound in `f_sized` | ^^^^^ required by this bound in `f_sized`
@ -73,7 +73,7 @@ LL + f_sized(ref_cl);
| |
error[E0277]: `Rc<{integer}>` cannot be sent between threads safely error[E0277]: `Rc<{integer}>` cannot be sent between threads safely
--> $DIR/issue-84973-blacklist.rs:27:12 --> $DIR/issue-84973-blacklist.rs:28:12
| |
LL | f_send(rc); LL | f_send(rc);
| ------ ^^ `Rc<{integer}>` cannot be sent between threads safely | ------ ^^ `Rc<{integer}>` cannot be sent between threads safely
@ -82,7 +82,7 @@ LL | f_send(rc);
| |
= help: the trait `Send` is not implemented for `Rc<{integer}>` = help: the trait `Send` is not implemented for `Rc<{integer}>`
note: required by a bound in `f_send` note: required by a bound in `f_send`
--> $DIR/issue-84973-blacklist.rs:10:14 --> $DIR/issue-84973-blacklist.rs:11:14
| |
LL | fn f_send<T: Send>(t: T) {} LL | fn f_send<T: Send>(t: T) {}
| ^^^^ required by this bound in `f_send` | ^^^^ required by this bound in `f_send`

View File

@ -20,10 +20,11 @@ error[E0277]: the trait bound `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:
--> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11 --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11
| |
LL | takes(|_: Argument| -> Return { todo!() }); LL | takes(|_: Argument| -> Return { todo!() });
| ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}` | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
| | | |
| required by a bound introduced by this call | required by a bound introduced by this call
| |
= help: the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:14:11: 14:34}`
= help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return` = help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return`
note: required by a bound in `takes` note: required by a bound in `takes`
--> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:9:18 --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:9:18

View File

@ -2,8 +2,9 @@ error[E0277]: the trait bound `<T as A>::AssocA: TransmuteFrom<(), Assume { alig
--> $DIR/assoc-bound.rs:16:19 --> $DIR/assoc-bound.rs:16:19
| |
LL | type AssocB = T::AssocA; LL | type AssocB = T::AssocA;
| ^^^^^^^^^ the trait `TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `<T as A>::AssocA` | ^^^^^^^^^ unsatisfied trait bound
| |
= help: the trait `TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }>` is not implemented for `<T as A>::AssocA`
note: required by a bound in `B::AssocB` note: required by a bound in `B::AssocB`
--> $DIR/assoc-bound.rs:9:18 --> $DIR/assoc-bound.rs:9:18
| |

View File

@ -2,8 +2,9 @@ error[E0277]: the trait bound `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_t
--> $DIR/higher-ranked-fn-type.rs:20:5 --> $DIR/higher-ranked-fn-type.rs:20:5
| |
LL | called() LL | called()
| ^^^^^^^^ the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> Foo` is not implemented for `fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), "'b") ())` | ^^^^^^^^ unsatisfied trait bound
| |
= help: the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> Foo` is not implemented for `fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), "'b") ())`
help: this trait has no implementations, consider adding one help: this trait has no implementations, consider adding one
--> $DIR/higher-ranked-fn-type.rs:6:1 --> $DIR/higher-ranked-fn-type.rs:6:1
| |