mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-13 23:42:56 +00:00
Remove unnecessary note on errors
Seeing the trait definition doesn't help with implementation not general enough errors, so don't make the error message larger to show it.
This commit is contained in:
parent
638980a07f
commit
c2066cf069
@ -207,10 +207,6 @@ impl NiceRegionError<'me, 'tcx> {
|
||||
self.tcx().def_path_str(trait_def_id),
|
||||
);
|
||||
let mut err = self.tcx().sess.struct_span_err(span, &msg);
|
||||
err.span_label(
|
||||
self.tcx().def_span(trait_def_id),
|
||||
format!("trait `{}` defined here", self.tcx().def_path_str(trait_def_id)),
|
||||
);
|
||||
|
||||
let leading_ellipsis = if let ObligationCauseCode::ItemObligation(def_id) = cause.code {
|
||||
err.span_label(span, "doesn't satisfy where-clause");
|
||||
|
@ -31,15 +31,8 @@ LL | bar::<IntStruct>();
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:96:5
|
||||
|
|
||||
LL | / pub trait TheTrait<T> {
|
||||
LL | | type A;
|
||||
LL | |
|
||||
LL | | fn get(&self, t: T) -> Self::A;
|
||||
LL | | }
|
||||
| |_- trait `TheTrait` defined here
|
||||
...
|
||||
LL | tuple_one::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
LL | tuple_one::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `Tuple` actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
@ -47,15 +40,8 @@ LL | tuple_one::<Tuple>();
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:96:5
|
||||
|
|
||||
LL | / pub trait TheTrait<T> {
|
||||
LL | | type A;
|
||||
LL | |
|
||||
LL | | fn get(&self, t: T) -> Self::A;
|
||||
LL | | }
|
||||
| |_- trait `TheTrait` defined here
|
||||
...
|
||||
LL | tuple_one::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
LL | tuple_one::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `Tuple` actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
@ -63,15 +49,8 @@ LL | tuple_one::<Tuple>();
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:102:5
|
||||
|
|
||||
LL | / pub trait TheTrait<T> {
|
||||
LL | | type A;
|
||||
LL | |
|
||||
LL | | fn get(&self, t: T) -> Self::A;
|
||||
LL | | }
|
||||
| |_- trait `TheTrait` defined here
|
||||
...
|
||||
LL | tuple_two::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
LL | tuple_two::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `Tuple` actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
@ -79,15 +58,8 @@ LL | tuple_two::<Tuple>();
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:102:5
|
||||
|
|
||||
LL | / pub trait TheTrait<T> {
|
||||
LL | | type A;
|
||||
LL | |
|
||||
LL | | fn get(&self, t: T) -> Self::A;
|
||||
LL | | }
|
||||
| |_- trait `TheTrait` defined here
|
||||
...
|
||||
LL | tuple_two::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
LL | tuple_two::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `Tuple` actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
@ -95,15 +67,8 @@ LL | tuple_two::<Tuple>();
|
||||
error: implementation of `TheTrait` is not general enough
|
||||
--> $DIR/associated-types-eq-hr.rs:112:5
|
||||
|
|
||||
LL | / pub trait TheTrait<T> {
|
||||
LL | | type A;
|
||||
LL | |
|
||||
LL | | fn get(&self, t: T) -> Self::A;
|
||||
LL | | }
|
||||
| |_- trait `TheTrait` defined here
|
||||
...
|
||||
LL | tuple_four::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
LL | tuple_four::<Tuple>();
|
||||
| ^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
|
||||
|
|
||||
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `Tuple` actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
|
@ -1,9 +1,6 @@
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:31:5
|
||||
|
|
||||
LL | auto trait Foo {}
|
||||
| ----------------- trait `Foo` defined here
|
||||
...
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
@ -13,9 +10,6 @@ LL | assert_foo(gen);
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:31:5
|
||||
|
|
||||
LL | auto trait Foo {}
|
||||
| ----------------- trait `Foo` defined here
|
||||
...
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
@ -25,9 +19,6 @@ LL | assert_foo(gen);
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:50:5
|
||||
|
|
||||
LL | auto trait Foo {}
|
||||
| ----------------- trait `Foo` defined here
|
||||
...
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
@ -37,9 +28,6 @@ LL | assert_foo(gen);
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/auto-trait-regions.rs:50:5
|
||||
|
|
||||
LL | auto trait Foo {}
|
||||
| ----------------- trait `Foo` defined here
|
||||
...
|
||||
LL | assert_foo(gen);
|
||||
| ^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
|
@ -3,9 +3,6 @@ error: implementation of `Foo` is not general enough
|
||||
|
|
||||
LL | test::<FooS>(&mut 42);
|
||||
| ^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
...
|
||||
LL | trait Foo<'a> {}
|
||||
| ---------------- trait `Foo` defined here
|
||||
|
|
||||
= note: `FooS<'_>` must implement `Foo<'0>`, for any lifetime `'0`...
|
||||
= note: ...but `FooS<'_>` actually implements `Foo<'1>`, for some specific lifetime `'1`
|
||||
|
@ -1,9 +1,6 @@
|
||||
error: implementation of `Deserialize` is not general enough
|
||||
--> $DIR/hrtb-cache-issue-54302.rs:19:5
|
||||
|
|
||||
LL | trait Deserialize<'de> {}
|
||||
| ------------------------- trait `Deserialize` defined here
|
||||
...
|
||||
LL | assert_deserialize_owned::<&'static str>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Deserialize` is not general enough
|
||||
|
|
||||
|
@ -1,13 +1,8 @@
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/hrtb-conflate-regions.rs:27:10
|
||||
|
|
||||
LL | / trait Foo<X> {
|
||||
LL | | fn foo(&self, x: X) { }
|
||||
LL | | }
|
||||
| |_- trait `Foo` defined here
|
||||
...
|
||||
LL | fn b() { want_foo2::<SomeStruct>(); }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
LL | fn b() { want_foo2::<SomeStruct>(); }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `SomeStruct` must implement `Foo<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
|
||||
= note: ...but `SomeStruct` actually implements `Foo<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
|
||||
|
@ -1,9 +1,6 @@
|
||||
error: implementation of `Trait` is not general enough
|
||||
--> $DIR/hrtb-exists-forall-trait-contravariant.rs:34:5
|
||||
|
|
||||
LL | trait Trait<T> {}
|
||||
| ----------------- trait `Trait` defined here
|
||||
...
|
||||
LL | foo::<()>();
|
||||
| ^^^^^^^^^ implementation of `Trait` is not general enough
|
||||
|
|
||||
|
@ -1,9 +1,6 @@
|
||||
error: implementation of `Trait` is not general enough
|
||||
--> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5
|
||||
|
|
||||
LL | trait Trait<T> {}
|
||||
| ----------------- trait `Trait` defined here
|
||||
...
|
||||
LL | foo::<()>();
|
||||
| ^^^^^^^^^ implementation of `Trait` is not general enough
|
||||
|
|
||||
|
@ -1,13 +1,8 @@
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/hrtb-just-for-static.rs:24:5
|
||||
|
|
||||
LL | / trait Foo<X> {
|
||||
LL | | fn foo(&self, x: X) { }
|
||||
LL | | }
|
||||
| |_- trait `Foo` defined here
|
||||
...
|
||||
LL | want_hrtb::<StaticInt>()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
LL | want_hrtb::<StaticInt>()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `StaticInt` must implement `Foo<&'0 isize>`, for any lifetime `'0`...
|
||||
= note: ...but `StaticInt` actually implements `Foo<&'1 isize>`, for some specific lifetime `'1`
|
||||
@ -15,13 +10,8 @@ LL | want_hrtb::<StaticInt>()
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/hrtb-just-for-static.rs:30:5
|
||||
|
|
||||
LL | / trait Foo<X> {
|
||||
LL | | fn foo(&self, x: X) { }
|
||||
LL | | }
|
||||
| |_- trait `Foo` defined here
|
||||
...
|
||||
LL | want_hrtb::<&'a u32>()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
LL | want_hrtb::<&'a u32>()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `Foo<&'0 isize>` would have to be implemented for the type `&'a u32`, for any lifetime `'0`...
|
||||
= note: ...but `Foo<&'1 isize>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`
|
||||
|
@ -1,9 +1,6 @@
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/issue-46989.rs:38:5
|
||||
|
|
||||
LL | trait Foo {}
|
||||
| ------------ trait `Foo` defined here
|
||||
...
|
||||
LL | assert_foo::<fn(&i32)>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
|
@ -1,13 +1,8 @@
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/issue-54302-cases.rs:63:5
|
||||
|
|
||||
LL | / trait Foo<'x, T> {
|
||||
LL | | fn foo(self) -> &'x T;
|
||||
LL | | }
|
||||
| |_- trait `Foo` defined here
|
||||
...
|
||||
LL | <u32 as RefFoo<u32>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
LL | <u32 as RefFoo<u32>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `Foo<'static, u32>` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
|
||||
= note: ...but `Foo<'_, u32>` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`
|
||||
@ -15,13 +10,8 @@ LL | <u32 as RefFoo<u32>>::ref_foo(a)
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/issue-54302-cases.rs:69:5
|
||||
|
|
||||
LL | / trait Foo<'x, T> {
|
||||
LL | | fn foo(self) -> &'x T;
|
||||
LL | | }
|
||||
| |_- trait `Foo` defined here
|
||||
...
|
||||
LL | <i32 as RefFoo<i32>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
LL | <i32 as RefFoo<i32>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `Foo<'static, i32>` would have to be implemented for the type `&'0 i32`, for any lifetime `'0`...
|
||||
= note: ...but `Foo<'_, i32>` is actually implemented for the type `&'1 i32`, for some specific lifetime `'1`
|
||||
@ -29,13 +19,8 @@ LL | <i32 as RefFoo<i32>>::ref_foo(a)
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/issue-54302-cases.rs:75:5
|
||||
|
|
||||
LL | / trait Foo<'x, T> {
|
||||
LL | | fn foo(self) -> &'x T;
|
||||
LL | | }
|
||||
| |_- trait `Foo` defined here
|
||||
...
|
||||
LL | <u64 as RefFoo<u64>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
LL | <u64 as RefFoo<u64>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `Foo<'static, u64>` would have to be implemented for the type `&'0 u64`, for any lifetime `'0`...
|
||||
= note: ...but `Foo<'_, u64>` is actually implemented for the type `&'1 u64`, for some specific lifetime `'1`
|
||||
@ -43,13 +28,8 @@ LL | <u64 as RefFoo<u64>>::ref_foo(a)
|
||||
error: implementation of `Foo` is not general enough
|
||||
--> $DIR/issue-54302-cases.rs:81:5
|
||||
|
|
||||
LL | / trait Foo<'x, T> {
|
||||
LL | | fn foo(self) -> &'x T;
|
||||
LL | | }
|
||||
| |_- trait `Foo` defined here
|
||||
...
|
||||
LL | <i64 as RefFoo<i64>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
LL | <i64 as RefFoo<i64>>::ref_foo(a)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
|
||||
|
|
||||
= note: `Foo<'static, i64>` would have to be implemented for the type `&'0 i64`, for any lifetime `'0`...
|
||||
= note: ...but `Foo<'_, i64>` is actually implemented for the type `&'1 i64`, for some specific lifetime `'1`
|
||||
|
@ -1,9 +1,6 @@
|
||||
error: implementation of `Deserialize` is not general enough
|
||||
--> $DIR/issue-54302.rs:13:5
|
||||
|
|
||||
LL | trait Deserialize<'de> {}
|
||||
| ------------------------- trait `Deserialize` defined here
|
||||
...
|
||||
LL | assert_deserialize_owned::<&'static str>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `Deserialize` is not general enough
|
||||
|
|
||||
|
@ -1,13 +1,8 @@
|
||||
error: implementation of `DistributedIteratorMulti` is not general enough
|
||||
--> $DIR/issue-55731.rs:48:5
|
||||
|
|
||||
LL | / trait DistributedIteratorMulti<Source> {
|
||||
LL | | type Item;
|
||||
LL | | }
|
||||
| |_- trait `DistributedIteratorMulti` defined here
|
||||
...
|
||||
LL | multi(Map {
|
||||
| ^^^^^ implementation of `DistributedIteratorMulti` is not general enough
|
||||
LL | multi(Map {
|
||||
| ^^^^^ implementation of `DistributedIteratorMulti` is not general enough
|
||||
|
|
||||
= note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0`...
|
||||
= note: ...but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1`
|
||||
|
@ -1,13 +1,8 @@
|
||||
error: implementation of `Bar` is not general enough
|
||||
--> $DIR/where-for-self-2.rs:23:5
|
||||
|
|
||||
LL | / trait Bar {
|
||||
LL | | fn bar(&self);
|
||||
LL | | }
|
||||
| |_- trait `Bar` defined here
|
||||
...
|
||||
LL | foo(&X);
|
||||
| ^^^ implementation of `Bar` is not general enough
|
||||
LL | foo(&X);
|
||||
| ^^^ implementation of `Bar` is not general enough
|
||||
|
|
||||
= note: `Bar` would have to be implemented for the type `&'0 u32`, for any lifetime `'0`...
|
||||
= note: ...but `Bar` is actually implemented for the type `&'1 u32`, for some specific lifetime `'1`
|
||||
|
Loading…
Reference in New Issue
Block a user