07e7823c01
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
28 lines
1.2 KiB
Plaintext
28 lines
1.2 KiB
Plaintext
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
|
|
--> $DIR/issue-16538.rs:11:27
|
|
|
|
|
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error[E0277]: `*const usize` cannot be shared between threads safely
|
|
--> $DIR/issue-16538.rs:11:1
|
|
|
|
|
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const usize` cannot be shared between threads safely
|
|
|
|
|
= help: the trait `Sync` is not implemented for `*const usize`
|
|
= note: shared static variables must have a type that implements `Sync`
|
|
|
|
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
|
--> $DIR/issue-16538.rs:11:34
|
|
|
|
|
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
|
| ^^^^ use of extern static
|
|
|
|
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
Some errors have detailed explanations: E0015, E0133, E0277.
|
|
For more information about an error, try `rustc --explain E0015`.
|