Files
rust/tests/ui/fmt/non-source-literals.stderr
Esteban Küber 049c32797b On E0277, point at type that doesn't implement bound
When encountering an unmet trait bound, point at local type that doesn't implement the trait:

```
error[E0277]: the trait bound `Bar<T>: Foo` is not satisfied
  --> $DIR/issue-64855.rs:9:19
   |
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
   |                   ^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
   |
help: the trait `Foo` is not implemented for `Bar<T>`
  --> $DIR/issue-64855.rs:9:1
   |
LL | pub struct Bar<T>(<Self as Foo>::Type) where Self: ;
   | ^^^^^^^^^^^^^^^^^
```
2025-08-22 17:55:15 +00:00

62 lines
3.1 KiB
Plaintext

error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display`
--> $DIR/non-source-literals.rs:9:40
|
LL | let _ = format!(concat!("{", "}"), NonDisplay);
| ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter
|
help: the trait `std::fmt::Display` is not implemented for `NonDisplay`
--> $DIR/non-source-literals.rs:5:1
|
LL | pub struct NonDisplay;
| ^^^^^^^^^^^^^^^^^^^^^
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display`
--> $DIR/non-source-literals.rs:10:45
|
LL | let _ = format!(concat!("{", "0", "}"), NonDisplay);
| ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter
|
help: the trait `std::fmt::Display` is not implemented for `NonDisplay`
--> $DIR/non-source-literals.rs:5:1
|
LL | pub struct NonDisplay;
| ^^^^^^^^^^^^^^^^^^^^^
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `NonDebug` doesn't implement `Debug`
--> $DIR/non-source-literals.rs:11:42
|
LL | let _ = format!(concat!("{:", "?}"), NonDebug);
| ^^^^^^^^ `NonDebug` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= help: the trait `Debug` is not implemented for `NonDebug`
= note: add `#[derive(Debug)]` to `NonDebug` or manually `impl Debug for NonDebug`
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `NonDebug` with `#[derive(Debug)]`
|
LL + #[derive(Debug)]
LL | pub struct NonDebug;
|
error[E0277]: `NonDebug` doesn't implement `Debug`
--> $DIR/non-source-literals.rs:12:47
|
LL | let _ = format!(concat!("{", "0", ":?}"), NonDebug);
| ^^^^^^^^ `NonDebug` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= help: the trait `Debug` is not implemented for `NonDebug`
= note: add `#[derive(Debug)]` to `NonDebug` or manually `impl Debug for NonDebug`
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `NonDebug` with `#[derive(Debug)]`
|
LL + #[derive(Debug)]
LL | pub struct NonDebug;
|
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0277`.