rust/src/test/ui/phantom-oibit.stderr
Esteban Küber 190589f8a7 Use structured suggestion for restricting bounds
When a trait bound is not met and restricting a type parameter would
make the restriction hold, use a structured suggestion pointing at an
appropriate place (type param in param list or `where` clause).

Account for opaque parameters where instead of suggesting extending
the `where` clause, we suggest appending the new restriction:
`fn foo(impl Trait + UnmetTrait)`.
2019-10-15 13:55:43 -07:00

37 lines
1.6 KiB
Plaintext

error[E0277]: `T` cannot be shared between threads safely
--> $DIR/phantom-oibit.rs:21:12
|
LL | fn is_zen<T: Zen>(_: T) {}
| ------ --- required by this bound in `is_zen`
LL |
LL | fn not_sync<T>(x: Guard<T>) {
| - help: consider restricting this bound: `T: std::marker::Sync`
LL | is_zen(x)
| ^ `T` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `T`
= note: required because of the requirements on the impl of `Zen` for `&T`
= note: required because it appears within the type `std::marker::PhantomData<&T>`
= note: required because it appears within the type `Guard<'_, T>`
error[E0277]: `T` cannot be shared between threads safely
--> $DIR/phantom-oibit.rs:26:12
|
LL | fn is_zen<T: Zen>(_: T) {}
| ------ --- required by this bound in `is_zen`
...
LL | fn nested_not_sync<T>(x: Nested<Guard<T>>) {
| - help: consider restricting this bound: `T: std::marker::Sync`
LL | is_zen(x)
| ^ `T` cannot be shared between threads safely
|
= help: the trait `std::marker::Sync` is not implemented for `T`
= note: required because of the requirements on the impl of `Zen` for `&T`
= note: required because it appears within the type `std::marker::PhantomData<&T>`
= note: required because it appears within the type `Guard<'_, T>`
= note: required because it appears within the type `Nested<Guard<'_, T>>`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.