mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-03 02:59:15 +00:00
`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`. We add support for shortening the path of "trait path only". Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem). When we don't actually print out a shortened type we don't need the "use `--verbose`" note. On E0599 show type identity to avoid expanding the receiver's generic parameters. Unify wording on `long_ty_path` everywhere.
60 lines
2.0 KiB
Plaintext
60 lines
2.0 KiB
Plaintext
error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
|
|
--> $DIR/auto-trait-leak2.rs:21:10
|
|
|
|
|
LL | fn before() -> impl Fn(i32) {
|
|
| ------------ within this `impl Fn(i32)`
|
|
...
|
|
LL | send(before());
|
|
| ---- ^^^^^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
|
|
| |
|
|
| required by a bound introduced by this call
|
|
|
|
|
= help: within `impl Fn(i32)`, the trait `Send` is not implemented for `Rc<Cell<i32>>`
|
|
note: required because it's used within this closure
|
|
--> $DIR/auto-trait-leak2.rs:11:5
|
|
|
|
|
LL | move |x| p.set(x)
|
|
| ^^^^^^^^
|
|
note: required because it appears within the type `impl Fn(i32)`
|
|
--> $DIR/auto-trait-leak2.rs:6:16
|
|
|
|
|
LL | fn before() -> impl Fn(i32) {
|
|
| ^^^^^^^^^^^^
|
|
note: required by a bound in `send`
|
|
--> $DIR/auto-trait-leak2.rs:14:12
|
|
|
|
|
LL | fn send<T: Send>(_: T) {}
|
|
| ^^^^ required by this bound in `send`
|
|
|
|
error[E0277]: `Rc<Cell<i32>>` cannot be sent between threads safely
|
|
--> $DIR/auto-trait-leak2.rs:26:10
|
|
|
|
|
LL | send(after());
|
|
| ---- ^^^^^^^ `Rc<Cell<i32>>` cannot be sent between threads safely
|
|
| |
|
|
| required by a bound introduced by this call
|
|
...
|
|
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's used within this closure
|
|
--> $DIR/auto-trait-leak2.rs:39:5
|
|
|
|
|
LL | move |x| p.set(x)
|
|
| ^^^^^^^^
|
|
note: required because it appears within the type `impl Fn(i32)`
|
|
--> $DIR/auto-trait-leak2.rs:34:15
|
|
|
|
|
LL | fn after() -> impl Fn(i32) {
|
|
| ^^^^^^^^^^^^
|
|
note: required by a bound in `send`
|
|
--> $DIR/auto-trait-leak2.rs:14:12
|
|
|
|
|
LL | fn send<T: Send>(_: T) {}
|
|
| ^^^^ required by this bound in `send`
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|