diff options
| author | Esteban Kuber <esteban@kuber.com.ar> | 2021-12-13 20:56:40 +0000 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2022-04-04 21:01:42 +0000 |
| commit | 3aac307ca62f6d6c5b3612d3dfe80b6eeae8ba15 (patch) | |
| tree | 2c9610a6faa515517410ea51d6d48e52558b51da /src/test/ui/allocator | |
| parent | 6a9080b25e73d26aae94c3f6a13b31de58e66b5a (diff) | |
| download | rust-3aac307ca62f6d6c5b3612d3dfe80b6eeae8ba15.tar.gz rust-3aac307ca62f6d6c5b3612d3dfe80b6eeae8ba15.zip | |
Mention implementers of unsatisfied trait
When encountering an unsatisfied trait bound, if there are no other
suggestions, mention all the types that *do* implement that trait:
```
error[E0277]: the trait bound `f32: Foo` is not satisfied
--> $DIR/impl_wf.rs:22:6
|
LL | impl Baz<f32> for f32 { }
| ^^^^^^^^ the trait `Foo` is not implemented for `f32`
|
= help: the following other types implement trait `Foo`:
Option<T>
i32
str
note: required by a bound in `Baz`
--> $DIR/impl_wf.rs:18:31
|
LL | trait Baz<U: ?Sized> where U: Foo { }
| ^^^ required by this bound in `Baz`
```
Mention implementers of traits in `ImplObligation`s.
Do not mention other `impl`s for closures, ranges and `?`.
Diffstat (limited to 'src/test/ui/allocator')
| -rw-r--r-- | src/test/ui/allocator/not-an-allocator.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/allocator/not-an-allocator.stderr | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/test/ui/allocator/not-an-allocator.rs b/src/test/ui/allocator/not-an-allocator.rs index 417c371bdbf..4a538d4d0a0 100644 --- a/src/test/ui/allocator/not-an-allocator.rs +++ b/src/test/ui/allocator/not-an-allocator.rs @@ -1,8 +1,8 @@ #[global_allocator] static A: usize = 0; -//~^ the trait bound `usize: -//~| the trait bound `usize: -//~| the trait bound `usize: -//~| the trait bound `usize: +//~^ ERROR E0277 +//~| ERROR E0277 +//~| ERROR E0277 +//~| ERROR E0277 fn main() {} diff --git a/src/test/ui/allocator/not-an-allocator.stderr b/src/test/ui/allocator/not-an-allocator.stderr index c0f6118a9f1..62bb0679f81 100644 --- a/src/test/ui/allocator/not-an-allocator.stderr +++ b/src/test/ui/allocator/not-an-allocator.stderr @@ -6,6 +6,7 @@ LL | #[global_allocator] LL | static A: usize = 0; | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | + = help: the trait `GlobalAlloc` is implemented for `System` = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied @@ -16,6 +17,7 @@ LL | #[global_allocator] LL | static A: usize = 0; | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | + = help: the trait `GlobalAlloc` is implemented for `System` = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied @@ -26,6 +28,7 @@ LL | #[global_allocator] LL | static A: usize = 0; | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | + = help: the trait `GlobalAlloc` is implemented for `System` = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `usize: GlobalAlloc` is not satisfied @@ -36,6 +39,7 @@ LL | #[global_allocator] LL | static A: usize = 0; | ^^^^^ the trait `GlobalAlloc` is not implemented for `usize` | + = help: the trait `GlobalAlloc` is implemented for `System` = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 4 previous errors |
