Skip to content

Commit f80daf4

Browse files
committed
Erase lifetime in E0277 default label
1 parent 2541c5b commit f80daf4

File tree

74 files changed

+131
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+131
-124
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4773,16 +4773,23 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>(
47734773
Some(desc) => format!(" {desc}"),
47744774
None => String::new(),
47754775
};
4776+
let pred = tcx.erase_regions(if tcx.features().non_lifetime_binders {
4777+
// We can't erase the lifetime bounds on their own when this feature is enabled.
4778+
// `instantiate_bound_regions_with_erased` expects there to be no type bounds.
4779+
trait_predicate.skip_binder()
4780+
} else {
4781+
tcx.instantiate_bound_regions_with_erased(*trait_predicate)
4782+
});
47764783
if let ty::ImplPolarity::Positive = trait_predicate.polarity() {
47774784
format!(
47784785
"{pre_message}the trait `{}` is not implemented for{desc} `{}`{post}",
4779-
trait_predicate.print_modifiers_and_trait_path(),
4780-
tcx.short_ty_string(trait_ref.skip_binder().self_ty(), &mut None),
4786+
pred.print_modifiers_and_trait_path(),
4787+
tcx.short_ty_string(pred.self_ty(), &mut None),
47814788
)
47824789
} else {
47834790
// "the trait bound `!Send: T` is not satisfied" reads better than "`!Send` is
47844791
// not implemented for `T`".
4785-
format!("{pre_message}the trait bound `{trait_predicate}` is not satisfied{post}")
4792+
format!("{pre_message}the trait bound `{pred}` is not satisfied{post}")
47864793
}
47874794
}
47884795
}

tests/ui/associated-types/hr-associated-type-bound-object.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `Clone` is not implemented for `<T as X<'_>>::U`
22
--> $DIR/hr-associated-type-bound-object.rs:7:13
33
|
44
LL | fn f<'a, T: X<'a> + ?Sized>(x: &<T as X<'a>>::U) {
5-
| ^^^^^ the trait `for<'b> Clone` is not implemented for `<T as X<'b>>::U`
5+
| ^^^^^ the trait `Clone` is not implemented for `<T as X<'_>>::U`
66
|
77
note: required by a bound in `X`
88
--> $DIR/hr-associated-type-bound-object.rs:3:33
@@ -21,7 +21,7 @@ error[E0277]: the trait `Clone` is not implemented for `<T as X<'_>>::U`
2121
--> $DIR/hr-associated-type-bound-object.rs:9:7
2222
|
2323
LL | <<T as X<'_>>::U>::clone(x);
24-
| ^ the trait `for<'b> Clone` is not implemented for `<T as X<'b>>::U`
24+
| ^ the trait `Clone` is not implemented for `<T as X<'_>>::U`
2525
|
2626
note: required by a bound in `X::U`
2727
--> $DIR/hr-associated-type-bound-object.rs:3:33
@@ -51,7 +51,7 @@ error[E0277]: the trait `Clone` is not implemented for `<T as X<'_>>::U`
5151
--> $DIR/hr-associated-type-bound-object.rs:9:5
5252
|
5353
LL | <<T as X<'_>>::U>::clone(x);
54-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> Clone` is not implemented for `<T as X<'b>>::U`
54+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `<T as X<'_>>::U`
5555
|
5656
note: required by a bound in `X`
5757
--> $DIR/hr-associated-type-bound-object.rs:3:33

tests/ui/associated-types/hr-associated-type-bound-param-6.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `X<'_, T>` is not implemented for `T`
22
--> $DIR/hr-associated-type-bound-param-6.rs:12:12
33
|
44
LL | impl<S, T> X<'_, T> for (S,) {
5-
| ^^^^^^^^ the trait `for<'b> X<'b, T>` is not implemented for `T`
5+
| ^^^^^^^^ the trait `X<'_, T>` is not implemented for `T`
66
|
77
help: consider restricting type parameter `T`
88
|
@@ -13,7 +13,7 @@ error[E0277]: the trait `X<'_, i32>` is not implemented for `i32`
1313
--> $DIR/hr-associated-type-bound-param-6.rs:18:5
1414
|
1515
LL | <(i32,) as X<i32>>::f("abc");
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'b> X<'b, i32>` is not implemented for `i32`
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `X<'_, i32>` is not implemented for `i32`
1717
|
1818
= help: the trait `X<'_, T>` is implemented for `(S,)`
1919

tests/ui/associated-types/issue-43924.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `Default` is not implemented for `dyn ToString`
22
--> $DIR/issue-43924.rs:7:45
33
|
44
LL | type Out: Default + ToString + ?Sized = dyn ToString;
5-
| ^^^^^^^^^^^^ the trait `Default` is not implemented for `(dyn ToString + 'static)`
5+
| ^^^^^^^^^^^^ the trait `Default` is not implemented for `dyn ToString`
66
|
77
note: required by a bound in `Foo::Out`
88
--> $DIR/issue-43924.rs:7:15

tests/ui/associated-types/issue-59324.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ error[E0277]: the size for values of type `(dyn ThriftService<(), AssocType = _>
8484
LL | fn with_factory<H>(factory: dyn ThriftService<()>) {}
8585
| ^^^^^^^ doesn't have a size known at compile-time
8686
|
87-
= help: the trait `Sized` is not implemented for `(dyn ThriftService<(), AssocType = _> + 'static)`
87+
= help: the trait `Sized` is not implemented for `dyn ThriftService<(), AssocType = _>`
8888
= help: unsized fn params are gated as an unstable feature
8989
help: you can use `impl Trait` as the argument type
9090
|

tests/ui/async-await/awaiting-unsized-param.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error[E0277]: the size for values of type `(dyn Future<Output = T> + Unpin + 'st
1313
LL | async fn bug<T>(mut f: dyn Future<Output = T> + Unpin) -> T {
1414
| ^^^^^ doesn't have a size known at compile-time
1515
|
16-
= help: the trait `Sized` is not implemented for `(dyn Future<Output = T> + Unpin + 'static)`
16+
= help: the trait `Sized` is not implemented for `dyn Future<Output = T> + Unpin`
1717
= note: all values captured by value by a closure must have a statically known size
1818

1919
error: aborting due to 1 previous error; 1 warning emitted

tests/ui/closures/capture-unsized-by-move.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let k2 = move || {
66
LL | k.to_string();
77
| ^ doesn't have a size known at compile-time
88
|
9-
= help: the trait `Sized` is not implemented for `(dyn std::fmt::Display + 'static)`
9+
= help: the trait `Sized` is not implemented for `dyn std::fmt::Display`
1010
= note: all values captured by value by a closure must have a statically known size
1111

1212
error: aborting due to 1 previous error

tests/ui/closures/issue-111932.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known
44
LL | foos.for_each(|foo| {
55
| ^^^ doesn't have a size known at compile-time
66
|
7-
= help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
7+
= help: the trait `Sized` is not implemented for `dyn Foo`
88
= note: all function arguments must have a statically known size
99
= help: unsized fn params are gated as an unstable feature
1010

tests/ui/consts/const-unsized.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot
44
LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
55
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
66
|
7-
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
7+
= help: the trait `Sized` is not implemented for `dyn Debug + Sync`
88

99
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
1010
--> $DIR/const-unsized.rs:3:35
1111
|
1212
LL | const CONST_0: dyn Debug + Sync = *(&0 as &(dyn Debug + Sync));
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
1414
|
15-
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
15+
= help: the trait `Sized` is not implemented for `dyn Debug + Sync`
1616
= note: constant expressions must have a statically known size
1717

1818
error[E0277]: the size for values of type `str` cannot be known at compilation time
@@ -38,15 +38,15 @@ error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot
3838
LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
3939
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
4040
|
41-
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
41+
= help: the trait `Sized` is not implemented for `dyn Debug + Sync`
4242

4343
error[E0277]: the size for values of type `(dyn Debug + Sync + 'static)` cannot be known at compilation time
4444
--> $DIR/const-unsized.rs:11:37
4545
|
4646
LL | static STATIC_1: dyn Debug + Sync = *(&1 as &(dyn Debug + Sync));
4747
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
4848
|
49-
= help: the trait `Sized` is not implemented for `(dyn Debug + Sync + 'static)`
49+
= help: the trait `Sized` is not implemented for `dyn Debug + Sync`
5050
= note: constant expressions must have a statically known size
5151

5252
error[E0277]: the size for values of type `str` cannot be known at compilation time

tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | || }
1414
LL | | });
1515
| |______^ expected an `FnOnce(&bool)` closure, found `bool`
1616
|
17-
= help: the trait `for<'a> FnOnce<(&'a bool,)>` is not implemented for `bool`
17+
= help: the trait `FnOnce<(&bool,)>` is not implemented for `bool`
1818
note: required by a bound in `Option::<T>::filter`
1919
--> $SRC_DIR/core/src/option.rs:LL:COL
2020
help: you might have meant to create the closure instead of a block

tests/ui/feature-gates/feature-gate-trivial_bounds.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at
9494
LL | fn unsized_local() where Dst<dyn A>: Sized {
9595
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
9696
|
97-
= help: within `Dst<(dyn A + 'static)>`, the trait `Sized` is not implemented for `(dyn A + 'static)`, which is required by `Dst<(dyn A + 'static)>: Sized`
97+
= help: within `Dst<(dyn A + 'static)>`, the trait `Sized` is not implemented for `dyn A`, which is required by `Dst<(dyn A + 'static)>: Sized`
9898
note: required because it appears within the type `Dst<(dyn A + 'static)>`
9999
--> $DIR/feature-gate-trivial_bounds.rs:48:8
100100
|

tests/ui/feature-gates/feature-gate-unsized_fn_params.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known
44
LL | fn foo(x: dyn Foo) {
55
| ^ doesn't have a size known at compile-time
66
|
7-
= help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
7+
= help: the trait `Sized` is not implemented for `dyn Foo`
88
= help: unsized fn params are gated as an unstable feature
99
help: you can use `impl Trait` as the argument type
1010
|
@@ -21,7 +21,7 @@ error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known
2121
LL | fn bar(x: Foo) {
2222
| ^ doesn't have a size known at compile-time
2323
|
24-
= help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
24+
= help: the trait `Sized` is not implemented for `dyn Foo`
2525
= help: unsized fn params are gated as an unstable feature
2626
help: you can use `impl Trait` as the argument type
2727
|
@@ -51,7 +51,7 @@ error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known
5151
LL | foo(*x);
5252
| ^^ doesn't have a size known at compile-time
5353
|
54-
= help: the trait `Sized` is not implemented for `(dyn Foo + 'static)`
54+
= help: the trait `Sized` is not implemented for `dyn Foo`
5555
= note: all function arguments must have a statically known size
5656
= help: unsized fn params are gated as an unstable feature
5757

tests/ui/feature-gates/feature-gate-unsized_locals.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `(dyn FnOnce() + 'static)` cannot be k
44
LL | fn f(f: dyn FnOnce()) {}
55
| ^ doesn't have a size known at compile-time
66
|
7-
= help: the trait `Sized` is not implemented for `(dyn FnOnce() + 'static)`
7+
= help: the trait `Sized` is not implemented for `dyn FnOnce()`
88
= help: unsized fn params are gated as an unstable feature
99
help: you can use `impl Trait` as the argument type
1010
|

tests/ui/for/issue-20605.next.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `IntoIterator` is not implemented for `dyn Iterator<Item
22
--> $DIR/issue-20605.rs:5:17
33
|
44
LL | for item in *things { *item = 0 }
5-
| ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
5+
| ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &mut u8>`
66

77
error: the type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::IntoIter` is not well-formed
88
--> $DIR/issue-20605.rs:5:17

tests/ui/function-pointer/unsized-ret.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ error[E0277]: the size for values of type `(dyn std::fmt::Display + 'a)` cannot
1818
LL | foo::<for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a), _>(None, (&(),));
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
2020
|
21-
= help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `for<'a> Sized` is not implemented for `(dyn std::fmt::Display + 'a)`, which is required by `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a): Fn<_>`
21+
= help: within `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`, the trait `Sized` is not implemented for `dyn std::fmt::Display`, which is required by `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a): Fn<_>`
2222
= note: required because it appears within the type `for<'a> fn(&'a ()) -> (dyn std::fmt::Display + 'a)`
2323
note: required by a bound in `foo`
2424
--> $DIR/unsized-ret.rs:5:11

tests/ui/generic-associated-types/issue-101020.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `Foo<&mut ()>` is not implemented for `&mut ()`
22
--> $DIR/issue-101020.rs:31:22
33
|
44
LL | (&mut EmptyIter).consume(());
5-
| ^^^^^^^ the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()`, which is required by `for<'a> &'a mut (): FuncInput<'a, &'a mut ()>`
5+
| ^^^^^^^ the trait `Foo<&mut ()>` is not implemented for `&mut ()`, which is required by `for<'a> &'a mut (): FuncInput<'a, &'a mut ()>`
66
|
77
help: this trait has no implementations, consider adding one
88
--> $DIR/issue-101020.rs:28:1

tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: the size for values of type `(dyn Deref<Target = T> + 'static)` ca
44
LL | type Pointer<T> = dyn Deref<Target = T>;
55
| ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
66
|
7-
= help: the trait `Sized` is not implemented for `(dyn Deref<Target = T> + 'static)`
7+
= help: the trait `Sized` is not implemented for `dyn Deref<Target = T>`
88
note: required by a bound in `PointerFamily::Pointer`
99
--> $DIR/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs:4:5
1010
|

tests/ui/generic-associated-types/unknown-lifetime-ice-119827.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ error[E0277]: the trait `Foo` is not implemented for `Box<dyn Foo>`
8484
--> $DIR/unknown-lifetime-ice-119827.rs:7:14
8585
|
8686
LL | impl Foo for Box<dyn Foo> {}
87-
| ^^^^^^^^^^^^ the trait `Foo` is not implemented for `Box<(dyn Foo + 'static)>`
87+
| ^^^^^^^^^^^^ the trait `Foo` is not implemented for `Box<dyn Foo>`
8888
|
8989
= help: the trait `Foo` is implemented for `Box<(dyn Foo + 'static)>`
9090

tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: expected a `Fn(&'w ())` closure, found `fn(&'w ())`
44
LL | ice();
55
| ^^^^^ expected an `Fn(&'w ())` closure, found `fn(&'w ())`
66
|
7-
= help: the trait `for<'w> Fn<(&'w (),)>` is not implemented for `fn(&'w ())`
7+
= help: the trait `Fn<(&(),)>` is not implemented for `fn(&())`
88
note: required by a bound in `ice`
99
--> $DIR/fn-ptr.rs:7:25
1010
|

tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits-transitive.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `Bar<'_>` is not implemented for `B`
22
--> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:26
33
|
44
LL | want_bar_for_any_ccx(b);
5-
| -------------------- ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
5+
| -------------------- ^ the trait `Bar<'_>` is not implemented for `B`
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/higher-ranked/trait-bounds/hrtb-higher-ranker-supertraits.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `Foo<'_>` is not implemented for `F`
22
--> $DIR/hrtb-higher-ranker-supertraits.rs:18:26
33
|
44
LL | want_foo_for_any_tcx(f);
5-
| -------------------- ^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F`
5+
| -------------------- ^ the trait `Foo<'_>` is not implemented for `F`
66
| |
77
| required by a bound introduced by this call
88
|
@@ -22,7 +22,7 @@ error[E0277]: the trait `Bar<'_>` is not implemented for `B`
2222
--> $DIR/hrtb-higher-ranker-supertraits.rs:35:26
2323
|
2424
LL | want_bar_for_any_ccx(b);
25-
| -------------------- ^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
25+
| -------------------- ^ the trait `Bar<'_>` is not implemented for `B`
2626
| |
2727
| required by a bound introduced by this call
2828
|

tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-85455.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `SomeTrait<'_>` is not implemented for `T`
22
--> $DIR/issue-85455.rs:8:14
33
|
44
LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `SomeTrait<'_>` is not implemented for `T`
66
|
77
help: consider restricting type parameter `T`
88
|
@@ -13,7 +13,7 @@ error[E0277]: the trait `SomeTrait<'_>` is not implemented for `T`
1313
--> $DIR/issue-85455.rs:8:5
1414
|
1515
LL | callee::<fn(&()) -> <T as SomeTrait<'_>>::Associated>();
16-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> SomeTrait<'a>` is not implemented for `T`
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `SomeTrait<'_>` is not implemented for `T`
1717
|
1818
help: consider restricting type parameter `T`
1919
|

tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-89118.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0277]: the trait `BufferMut` is not implemented for `&()`
22
--> $DIR/issue-89118.rs:19:8
33
|
44
LL | C: StackContext,
5-
| ^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>`
5+
| ^^^^^^^^^^^^ the trait `BufferMut` is not implemented for `&()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>`
66
|
77
help: this trait has no implementations, consider adding one
88
--> $DIR/issue-89118.rs:1:1
@@ -29,7 +29,7 @@ error[E0277]: the trait `BufferMut` is not implemented for `&()`
2929
--> $DIR/issue-89118.rs:29:9
3030
|
3131
LL | impl<C> EthernetWorker<C> {}
32-
| ^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>`
32+
| ^^^^^^^^^^^^^^^^^ the trait `BufferMut` is not implemented for `&()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>`
3333
|
3434
help: this trait has no implementations, consider adding one
3535
--> $DIR/issue-89118.rs:1:1
@@ -56,7 +56,7 @@ error[E0277]: the trait `BufferMut` is not implemented for `&()`
5656
--> $DIR/issue-89118.rs:22:20
5757
|
5858
LL | type Handler = Ctx<C::Dispatcher>;
59-
| ^^^^^^^^^^^^^^^^^^ the trait `for<'a> BufferMut` is not implemented for `&'a ()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>`
59+
| ^^^^^^^^^^^^^^^^^^ the trait `BufferMut` is not implemented for `&()`, which is required by `for<'a> Ctx<()>: BufferUdpStateContext<&'a ()>`
6060
|
6161
help: this trait has no implementations, consider adding one
6262
--> $DIR/issue-89118.rs:1:1

tests/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | fn fuz() -> (usize, Trait) { (42, Struct) }
1616
| |
1717
| doesn't have a size known at compile-time
1818
|
19-
= help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)`, which is required by `(usize, (dyn Trait + 'static)): Sized`
19+
= help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `dyn Trait`, which is required by `(usize, (dyn Trait + 'static)): Sized`
2020
= note: required because it appears within the type `(usize, (dyn Trait + 'static))`
2121
= note: the return type of a function must have a statically known size
2222

@@ -38,7 +38,7 @@ LL | fn bar() -> (usize, dyn Trait) { (42, Struct) }
3838
| |
3939
| doesn't have a size known at compile-time
4040
|
41-
= help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `(dyn Trait + 'static)`, which is required by `(usize, (dyn Trait + 'static)): Sized`
41+
= help: within `(usize, (dyn Trait + 'static))`, the trait `Sized` is not implemented for `dyn Trait`, which is required by `(usize, (dyn Trait + 'static)): Sized`
4242
= note: required because it appears within the type `(usize, (dyn Trait + 'static))`
4343
= note: the return type of a function must have a statically known size
4444

0 commit comments

Comments
 (0)