Manually register some bounds for a better span

This commit is contained in:
Michael Goulet 2024-11-08 04:27:20 +00:00
parent e4c1a0016c
commit 97dfe8b871
14 changed files with 156 additions and 14 deletions

View file

@ -35,6 +35,11 @@ note: required because it's used within this `async` block
|
LL | async move {
| ^^^^^^^^^^
note: required by a bound in an opaque type
--> $DIR/issue-70935-complex-spans.rs:15:37
|
LL | fn foo(x: NotSync) -> impl Future + Send {
| ^^^^
error[E0277]: `*mut ()` cannot be shared between threads safely
--> $DIR/issue-70935-complex-spans.rs:15:23

View file

@ -4,6 +4,16 @@ error[E0277]: the trait bound `T: Clone` is not satisfied
LL | t
| ^ the trait `Clone` is not implemented for `T`
|
note: required by a bound in an opaque type
--> $DIR/bounds-are-checked-2.rs:7:26
|
LL | pub type X<T> = impl Clone;
| ^^^^^
note: this definition site has more where clauses than the opaque type
--> $DIR/bounds-are-checked-2.rs:9:5
|
LL | fn f<T: Clone>(t: T) -> X<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `T`
|
LL | pub type X<T: std::clone::Clone> = impl Clone;

View file

@ -4,6 +4,16 @@ error[E0277]: `T` doesn't implement `Debug`
LL | t
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
note: required by a bound in an opaque type
--> $DIR/generic_duplicate_param_use2.rs:8:23
|
LL | type Two<T, U> = impl Debug;
| ^^^^^
note: this definition site has more where clauses than the opaque type
--> $DIR/generic_duplicate_param_use2.rs:10:1
|
LL | fn two<T: Debug, U>(t: T, _: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `T`
|
LL | type Two<T: std::fmt::Debug, U> = impl Debug;

View file

@ -4,6 +4,16 @@ error[E0277]: `U` doesn't implement `Debug`
LL | u
| ^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
note: required by a bound in an opaque type
--> $DIR/generic_duplicate_param_use4.rs:8:23
|
LL | type Two<T, U> = impl Debug;
| ^^^^^
note: this definition site has more where clauses than the opaque type
--> $DIR/generic_duplicate_param_use4.rs:10:1
|
LL | fn three<T, U: Debug>(_: T, u: U) -> Two<T, U> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `U`
|
LL | type Two<T, U: std::fmt::Debug> = impl Debug;

View file

@ -21,6 +21,20 @@ LL | impl<T: Proj<Assoc = i32> + Copy> Copy for Bar<T> {}
| ----------- ^^^^ ^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in an opaque type
--> $DIR/hidden_type_mismatch.rs:36:26
|
LL | pub type Tait = impl Copy + From<Bar<()>> + Into<Bar<()>>;
| ^^^^
note: this definition site has more where clauses than the opaque type
--> $DIR/hidden_type_mismatch.rs:37:5
|
LL | / pub fn define_tait() -> Tait
LL | | where
LL | | // this proves `Bar<()>: Copy`, but `define_tait` is
LL | | // now uncallable
LL | | (): Proj<Assoc = i32>,
| |______________________________^
error: aborting due to 1 previous error

View file

@ -5,8 +5,13 @@ LL | s
| ^
| |
| the parameter type `A` must be valid for the static lifetime...
| ...so that the type `A` will meet its required lifetime bounds
| ...so that the type `A` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/implied_lifetime_wf_check4_static.rs:4:35
|
LL | pub type Ty<A> = impl Sized + 'static;
| ^^^^^^^
help: consider adding an explicit lifetime bound
|
LL | pub type Ty<A: 'static> = impl Sized + 'static;

View file

@ -4,6 +4,16 @@ error[E0277]: the trait bound `T: Default` is not satisfied
LL | t
| ^ the trait `Default` is not implemented for `T`
|
note: required by a bound in an opaque type
--> $DIR/issue-52843.rs:3:20
|
LL | type Foo<T> = impl Default;
| ^^^^^^^
note: this definition site has more where clauses than the opaque type
--> $DIR/issue-52843.rs:6:1
|
LL | fn foo<T: Default>(t: T) -> Foo<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `T`
|
LL | type Foo<T: std::default::Default> = impl Default;

View file

@ -4,11 +4,23 @@ error[E0277]: the trait bound `B: Bar` is not satisfied
LL | MyBaz(bar)
| ^^^^^^^^^^ the trait `Bar` is not implemented for `B`
|
note: required by a bound in `MyBaz`
--> $DIR/issue-90400-2.rs:29:17
note: required for `MyBaz<B>` to implement `Baz`
--> $DIR/issue-90400-2.rs:30:14
|
LL | struct MyBaz<B: Bar>(B);
| ^^^ required by this bound in `MyBaz`
LL | impl<B: Bar> Baz for MyBaz<B> {
| --- ^^^ ^^^^^^^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in an opaque type
--> $DIR/issue-90400-2.rs:22:26
|
LL | type FooFn<B> = impl Baz;
| ^^^
note: this definition site has more where clauses than the opaque type
--> $DIR/issue-90400-2.rs:24:5
|
LL | fn foo<B: Bar>(&self, bar: B) -> Self::FooFn<B> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `B`
|
LL | type FooFn<B: Bar> = impl Baz;

View file

@ -11,6 +11,16 @@ LL | impl<X: Trait> ProofForConversion<X> for () {
| ----- ^^^^^^^^^^^^^^^^^^^^^ ^^
| |
| unsatisfied trait bound introduced here
note: required by a bound in an opaque type
--> $DIR/underconstrained_generic.rs:19:26
|
LL | type Converter<T> = impl ProofForConversion<T>;
| ^^^^^^^^^^^^^^^^^^^^^
note: this definition site has more where clauses than the opaque type
--> $DIR/underconstrained_generic.rs:21:1
|
LL | fn _defining_use<T: Trait>() -> Converter<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider restricting type parameter `T`
|
LL | type Converter<T: Trait> = impl ProofForConversion<T>;

View file

@ -5,8 +5,13 @@ LL | impl<'a, T> Trait<'a, T> for () {
| -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
...
LL | req
| ^^^ ...so that the type `&'a T` will meet its required lifetime bounds
| ^^^ ...so that the type `&'a T` will meet its required lifetime bounds...
|
note: ...that is required by this bound
--> $DIR/wf-in-associated-type.rs:38:36
|
LL | type Opaque = impl Sized + 'a;
| ^^
help: consider adding an explicit lifetime bound
|
LL | impl<'a, T: 'a> Trait<'a, T> for () {