diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-07-09 22:30:26 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-02-10 20:21:39 +0000 |
| commit | f0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d (patch) | |
| tree | e97d87013709bda13934fdc452a2a459a069876a /tests/ui/impl-trait/in-trait | |
| parent | 8c04e395952022a451138dc4dbead6dd6ae65203 (diff) | |
| download | rust-f0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d.tar.gz rust-f0845adb0c1b7a7fa1bef73e749b2d7e1d7f374d.zip | |
Show diff suggestion format on verbose replacement
```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
--> $DIR/attempted-access-non-fatal.rs:7:15
|
LL | let _ = 2.l;
| ^
|
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
|
LL - let _ = 2.l;
LL + let _ = 2.0f64;
|
```
Diffstat (limited to 'tests/ui/impl-trait/in-trait')
11 files changed, 58 insertions, 37 deletions
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr index 022df6f906c..d3729b6c973 100644 --- a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr +++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr @@ -9,8 +9,10 @@ LL | 'b: 'a; | help: copy the `where` clause predicates from the trait | -LL | where Self: 'b; - | ~~~~~~~~~~~~~~ +LL - where +LL - 'b: 'a; +LL + where Self: 'b; + | warning: impl trait in impl method signature does not match trait method signature --> $DIR/bad-item-bound-within-rpitit.rs:18:28 @@ -26,8 +28,9 @@ LL | fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { = note: `#[warn(refining_impl_trait_reachable)]` on by default help: replace the return type so that it matches the trait | -LL | fn iter(&self) -> impl Iterator<Item = <Self as Iterable>::Item<'_>> + '_ { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> { +LL + fn iter(&self) -> impl Iterator<Item = <Self as Iterable>::Item<'_>> + '_ { + | error: aborting due to 1 previous error; 1 warning emitted diff --git a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr index 94f068cabaa..b7797317ea6 100644 --- a/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr +++ b/tests/ui/impl-trait/in-trait/expeced-refree-to-map-to-reearlybound-ice-108580.stderr @@ -12,8 +12,9 @@ LL | fn bar(&self) -> impl Iterator + '_ { = note: `#[warn(refining_impl_trait_internal)]` on by default help: replace the return type so that it matches the trait | -LL | fn bar(&self) -> impl Iterator<Item = impl Sized> + '_ { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn bar(&self) -> impl Iterator + '_ { +LL + fn bar(&self) -> impl Iterator<Item = impl Sized> + '_ { + | warning: 1 warning emitted diff --git a/tests/ui/impl-trait/in-trait/foreign.stderr b/tests/ui/impl-trait/in-trait/foreign.stderr index 36114dcf02b..8801ccc68b3 100644 --- a/tests/ui/impl-trait/in-trait/foreign.stderr +++ b/tests/ui/impl-trait/in-trait/foreign.stderr @@ -14,8 +14,9 @@ LL | #[warn(refining_impl_trait)] = note: `#[warn(refining_impl_trait_internal)]` implied by `#[warn(refining_impl_trait)]` help: replace the return type so that it matches the trait | -LL | fn bar(self) -> impl Deref<Target = impl Sized> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn bar(self) -> Arc<String> { +LL + fn bar(self) -> impl Deref<Target = impl Sized> { + | warning: impl trait in impl method signature does not match trait method signature --> $DIR/foreign.rs:31:21 @@ -32,8 +33,9 @@ LL | #[warn(refining_impl_trait)] | ^^^^^^^^^^^^^^^^^^^ help: replace the return type so that it matches the trait | -LL | fn bar(self) -> impl Deref<Target = impl Sized> { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - fn bar(self) -> Arc<String> { +LL + fn bar(self) -> impl Deref<Target = impl Sized> { + | warning: 2 warnings emitted diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr index a23879eb6c3..97f5b2af862 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.lt.stderr @@ -15,8 +15,9 @@ LL | fn early<'early, T>(x: &'early T) -> impl Sized; found signature `fn(&())` help: change the parameter type to match the trait | -LL | fn early<'late, T>(_: &'early T) {} - | ~~~~~~~~~ +LL - fn early<'late, T>(_: &'late ()) {} +LL + fn early<'late, T>(_: &'early T) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr index 9e18517e48c..588b4537610 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch.stderr @@ -13,8 +13,9 @@ LL | fn owo(x: ()) -> impl Sized; found signature `fn(u8)` help: change the parameter type to match the trait | -LL | fn owo(_: ()) {} - | ~~ +LL - fn owo(_: u8) {} +LL + fn owo(_: ()) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr index c01d7322d11..b0530045bea 100644 --- a/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr +++ b/tests/ui/impl-trait/in-trait/method-signature-matches.mismatch_async.stderr @@ -13,8 +13,9 @@ LL | async fn owo(x: ()) {} found signature `fn(u8) -> _` help: change the parameter type to match the trait | -LL | async fn owo(_: ()) {} - | ~~ +LL - async fn owo(_: u8) {} +LL + async fn owo(_: ()) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr index 81570781b27..d575fedbb58 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr @@ -86,8 +86,9 @@ LL | fn bar() -> Wrapper<impl Sized>; found signature `fn() -> i32` help: change the output type to match the trait | -LL | fn bar() -> Wrapper<'static> { - | ~~~~~~~~~~~~~~~~ +LL - fn bar() -> i32 { +LL + fn bar() -> Wrapper<'static> { + | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/opaque-and-lifetime-mismatch.rs:24:17 diff --git a/tests/ui/impl-trait/in-trait/refine-captures.stderr b/tests/ui/impl-trait/in-trait/refine-captures.stderr index ad2c2a11601..8a5c8d3c77b 100644 --- a/tests/ui/impl-trait/in-trait/refine-captures.stderr +++ b/tests/ui/impl-trait/in-trait/refine-captures.stderr @@ -9,8 +9,9 @@ LL | fn test() -> impl Sized + use<> {} = note: `#[warn(refining_impl_trait_internal)]` on by default help: modify the `use<..>` bound to capture the same lifetimes that the trait does | -LL | fn test() -> impl Sized + use<'a> {} - | ~~~~~~~ +LL - fn test() -> impl Sized + use<> {} +LL + fn test() -> impl Sized + use<'a> {} + | warning: impl trait in impl method captures fewer lifetimes than in trait --> $DIR/refine-captures.rs:22:31 @@ -22,8 +23,9 @@ LL | fn test() -> impl Sized + use<> {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: modify the `use<..>` bound to capture the same lifetimes that the trait does | -LL | fn test() -> impl Sized + use<'a> {} - | ~~~~~~~ +LL - fn test() -> impl Sized + use<> {} +LL + fn test() -> impl Sized + use<'a> {} + | warning: impl trait in impl method captures fewer lifetimes than in trait --> $DIR/refine-captures.rs:27:31 @@ -35,8 +37,9 @@ LL | fn test() -> impl Sized + use<'b> {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: modify the `use<..>` bound to capture the same lifetimes that the trait does | -LL | fn test() -> impl Sized + use<'a, 'b> {} - | ~~~~~~~~~~~ +LL - fn test() -> impl Sized + use<'b> {} +LL + fn test() -> impl Sized + use<'a, 'b> {} + | error: `impl Trait` must mention all type parameters in scope in `use<...>` --> $DIR/refine-captures.rs:32:18 diff --git a/tests/ui/impl-trait/in-trait/refine.stderr b/tests/ui/impl-trait/in-trait/refine.stderr index 8d30b035921..e381ef8c3f7 100644 --- a/tests/ui/impl-trait/in-trait/refine.stderr +++ b/tests/ui/impl-trait/in-trait/refine.stderr @@ -17,8 +17,9 @@ LL | #![deny(refining_impl_trait)] = note: `#[deny(refining_impl_trait_reachable)]` implied by `#[deny(refining_impl_trait)]` help: replace the return type so that it matches the trait | -LL | fn bar() -> impl Sized {} - | ~~~~~~~~~~ +LL - fn bar() -> impl Copy {} +LL + fn bar() -> impl Sized {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:15:5 @@ -49,8 +50,9 @@ LL | fn bar() -> () {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: replace the return type so that it matches the trait | -LL | fn bar() -> impl Sized {} - | ~~~~~~~~~~ +LL - fn bar() -> () {} +LL + fn bar() -> impl Sized {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:27:17 @@ -66,8 +68,9 @@ LL | fn bar() -> () {} = note: `#[deny(refining_impl_trait_internal)]` implied by `#[deny(refining_impl_trait)]` help: replace the return type so that it matches the trait | -LL | fn bar() -> impl Sized {} - | ~~~~~~~~~~ +LL - fn bar() -> () {} +LL + fn bar() -> impl Sized {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:35:17 @@ -82,8 +85,9 @@ LL | fn bar() -> () {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: replace the return type so that it matches the trait | -LL | fn bar() -> impl Sized {} - | ~~~~~~~~~~ +LL - fn bar() -> () {} +LL + fn bar() -> impl Sized {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:45:27 @@ -98,8 +102,9 @@ LL | fn bar(&self) -> impl Copy + '_ {} = note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information help: replace the return type so that it matches the trait | -LL | fn bar(&self) -> impl Sized + '_ {} - | ~~~~~~~~~~~~~~~ +LL - fn bar(&self) -> impl Copy + '_ {} +LL + fn bar(&self) -> impl Sized + '_ {} + | error: impl trait in impl method signature does not match trait method signature --> $DIR/refine.rs:56:9 diff --git a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr index 15bef5c78b0..dfcf11c57dd 100644 --- a/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr +++ b/tests/ui/impl-trait/in-trait/rpitit-hidden-types-self-implied-wf-via-param.stderr @@ -9,7 +9,9 @@ LL | 'a: 'static, | help: copy the `where` clause predicates from the trait | -LL | where 'a: 'a +LL - where +LL - 'a: 'static, +LL + where 'a: 'a | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/specialization-broken.stderr b/tests/ui/impl-trait/in-trait/specialization-broken.stderr index 8c9f2656015..fbbe1ac40b9 100644 --- a/tests/ui/impl-trait/in-trait/specialization-broken.stderr +++ b/tests/ui/impl-trait/in-trait/specialization-broken.stderr @@ -16,8 +16,9 @@ LL | fn bar(&self) -> impl Sized; found signature `fn(&_) -> U` help: change the output type to match the trait | -LL | fn bar(&self) -> impl Sized { - | ~~~~~~~~~~ +LL - fn bar(&self) -> U { +LL + fn bar(&self) -> impl Sized { + | error: method with return-position `impl Trait` in trait cannot be specialized --> $DIR/specialization-broken.rs:15:5 |
