about summary refs log tree commit diff
path: root/tests/ui/fmt
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-08-19 17:49:20 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-08-22 17:55:15 +0000
commit049c32797b5f797d5823cdc0e5aaeb0fd68175da (patch)
tree1fd5b318305954b5845a8794a33506bd3fa18e73 /tests/ui/fmt
parentf5703d5dd3eec176f86a6e9bf7e668b48b84eabb (diff)
downloadrust-049c32797b5f797d5823cdc0e5aaeb0fd68175da.tar.gz
rust-049c32797b5f797d5823cdc0e5aaeb0fd68175da.zip
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: ;
   | ^^^^^^^^^^^^^^^^^
```
Diffstat (limited to 'tests/ui/fmt')
-rw-r--r--tests/ui/fmt/non-source-literals.stderr12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/ui/fmt/non-source-literals.stderr b/tests/ui/fmt/non-source-literals.stderr
index 5f8a6200dab..5f042e1e631 100644
--- a/tests/ui/fmt/non-source-literals.stderr
+++ b/tests/ui/fmt/non-source-literals.stderr
@@ -4,7 +4,11 @@ error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display`
 LL |     let _ = format!(concat!("{", "}"), NonDisplay);
    |                                        ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter
    |
-   = help: the trait `std::fmt::Display` is not implemented for `NonDisplay`
+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)
 
@@ -14,7 +18,11 @@ error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display`
 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`
+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)