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/dyn-compatibility | |
| 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/dyn-compatibility')
7 files changed, 102 insertions, 68 deletions
diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr index 83795f3128e..87207d607e2 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-2.new.stderr @@ -7,8 +7,9 @@ LL | fn id<F>(f: Copy) -> usize { = note: `Copy` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `Copy` | -LL | fn id<F, T: Copy>(f: T) -> usize { - | +++++++++ ~ +LL - fn id<F>(f: Copy) -> usize { +LL + fn id<F, T: Copy>(f: T) -> usize { + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn id<F>(f: impl Copy) -> usize { diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr index 813b5863738..6075e313f4e 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning-3.new.stderr @@ -7,8 +7,9 @@ LL | trait A { fn g(b: B) -> B; } = note: `B` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `B` | -LL | trait A { fn g<T: B>(b: T) -> B; } - | ++++++ ~ +LL - trait A { fn g(b: B) -> B; } +LL + trait A { fn g<T: B>(b: T) -> B; } + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | trait A { fn g(b: impl B) -> B; } @@ -34,8 +35,9 @@ LL | trait B { fn f(a: A) -> A; } = note: `A` it is dyn-incompatible, so it can't be `dyn` help: use a new generic type parameter, constrained by `A` | -LL | trait B { fn f<T: A>(a: T) -> A; } - | ++++++ ~ +LL - trait B { fn f(a: A) -> A; } +LL + trait B { fn f<T: A>(a: T) -> A; } + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | trait B { fn f(a: impl A) -> A; } diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr index e9eb1cdd0c2..3ba4aa12e6d 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning.new.stderr @@ -6,8 +6,9 @@ LL | fn call_this<F>(f: F) : Fn(&str) + call_that {} | help: use `->` instead | -LL | fn call_this<F>(f: F) -> Fn(&str) + call_that {} - | ~~ +LL - fn call_this<F>(f: F) : Fn(&str) + call_that {} +LL + fn call_this<F>(f: F) -> Fn(&str) + call_that {} + | error[E0405]: cannot find trait `call_that` in this scope --> $DIR/avoid-ice-on-warning.rs:4:36 diff --git a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr index 646fb57af9e..dbfe91e1811 100644 --- a/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr +++ b/tests/ui/dyn-compatibility/avoid-ice-on-warning.old.stderr @@ -6,8 +6,9 @@ LL | fn call_this<F>(f: F) : Fn(&str) + call_that {} | help: use `->` instead | -LL | fn call_this<F>(f: F) -> Fn(&str) + call_that {} - | ~~ +LL - fn call_this<F>(f: F) : Fn(&str) + call_that {} +LL + fn call_this<F>(f: F) -> Fn(&str) + call_that {} + | error[E0405]: cannot find trait `call_that` in this scope --> $DIR/avoid-ice-on-warning.rs:4:36 diff --git a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr index 4c6d84f0534..832e7ef4dc3 100644 --- a/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr +++ b/tests/ui/dyn-compatibility/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.stderr @@ -195,8 +195,9 @@ LL | fn foo(_: &Trait); | help: use a new generic type parameter, constrained by `Trait` | -LL | fn foo<T: Trait>(_: &T); - | ++++++++++ ~ +LL - fn foo(_: &Trait); +LL + fn foo<T: Trait>(_: &T); + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn foo(_: &impl Trait); @@ -214,8 +215,9 @@ LL | fn bar(_: &'a Trait); | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bar<T: Trait>(_: &'a T); - | ++++++++++ ~ +LL - fn bar(_: &'a Trait); +LL + fn bar<T: Trait>(_: &'a T); + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(_: &'a impl Trait); @@ -233,8 +235,9 @@ LL | fn alice<'a>(_: &Trait); | help: use a new generic type parameter, constrained by `Trait` | -LL | fn alice<'a, T: Trait>(_: &T); - | ++++++++++ ~ +LL - fn alice<'a>(_: &Trait); +LL + fn alice<'a, T: Trait>(_: &T); + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn alice<'a>(_: &impl Trait); @@ -252,8 +255,9 @@ LL | fn bob<'a>(_: &'a Trait); | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bob<'a, T: Trait>(_: &'a T); - | ++++++++++ ~ +LL - fn bob<'a>(_: &'a Trait); +LL + fn bob<'a, T: Trait>(_: &'a T); + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bob<'a>(_: &'a impl Trait); @@ -275,8 +279,9 @@ LL | fn cat() -> &impl Trait; | ++++ help: alternatively, you can return an owned trait object | -LL | fn cat() -> Box<dyn Trait>; - | ~~~~~~~~~~~~~~ +LL - fn cat() -> &Trait; +LL + fn cat() -> Box<dyn Trait>; + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:69:22 @@ -290,8 +295,9 @@ LL | fn dog<'a>() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn dog<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn dog<'a>() -> &Trait { +LL + fn dog<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:75:24 @@ -305,8 +311,9 @@ LL | fn kitten() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn kitten() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn kitten() -> &'a Trait { +LL + fn kitten() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:81:27 @@ -320,8 +327,9 @@ LL | fn puppy<'a>() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn puppy<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn puppy<'a>() -> &'a Trait { +LL + fn puppy<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:86:25 @@ -335,8 +343,9 @@ LL | fn parrot() -> &mut impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn parrot() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn parrot() -> &mut Trait { +LL + fn parrot() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:93:12 @@ -346,8 +355,9 @@ LL | fn foo(_: &Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn foo<T: Trait>(_: &T) {} - | ++++++++++ ~ +LL - fn foo(_: &Trait) {} +LL + fn foo<T: Trait>(_: &T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn foo(_: &impl Trait) {} @@ -365,8 +375,9 @@ LL | fn bar(_: &'a Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bar<T: Trait>(_: &'a T) {} - | ++++++++++ ~ +LL - fn bar(_: &'a Trait) {} +LL + fn bar<T: Trait>(_: &'a T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(_: &'a impl Trait) {} @@ -384,8 +395,9 @@ LL | fn alice<'a>(_: &Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn alice<'a, T: Trait>(_: &T) {} - | ++++++++++ ~ +LL - fn alice<'a>(_: &Trait) {} +LL + fn alice<'a, T: Trait>(_: &T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn alice<'a>(_: &impl Trait) {} @@ -403,8 +415,9 @@ LL | fn bob<'a>(_: &'a Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bob<'a, T: Trait>(_: &'a T) {} - | ++++++++++ ~ +LL - fn bob<'a>(_: &'a Trait) {} +LL + fn bob<'a, T: Trait>(_: &'a T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bob<'a>(_: &'a impl Trait) {} @@ -426,8 +439,9 @@ LL | fn cat() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn cat() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn cat() -> &Trait { +LL + fn cat() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:116:18 @@ -441,8 +455,9 @@ LL | fn dog<'a>() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn dog<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn dog<'a>() -> &Trait { +LL + fn dog<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:122:20 @@ -456,8 +471,9 @@ LL | fn kitten() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn kitten() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn kitten() -> &'a Trait { +LL + fn kitten() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:128:23 @@ -471,8 +487,9 @@ LL | fn puppy<'a>() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn puppy<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn puppy<'a>() -> &'a Trait { +LL + fn puppy<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:133:21 @@ -486,8 +503,9 @@ LL | fn parrot() -> &mut impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn parrot() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn parrot() -> &mut Trait { +LL + fn parrot() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:8:16 @@ -497,8 +515,9 @@ LL | fn foo(_: &Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn foo<T: Trait>(_: &T) {} - | ++++++++++ ~ +LL - fn foo(_: &Trait) {} +LL + fn foo<T: Trait>(_: &T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn foo(_: &impl Trait) {} @@ -516,8 +535,9 @@ LL | fn bar(self, _: &'a Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bar<T: Trait>(self, _: &'a T) {} - | ++++++++++ ~ +LL - fn bar(self, _: &'a Trait) {} +LL + fn bar<T: Trait>(self, _: &'a T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(self, _: &'a impl Trait) {} @@ -535,8 +555,9 @@ LL | fn alice<'a>(&self, _: &Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn alice<'a, T: Trait>(&self, _: &T) {} - | ++++++++++ ~ +LL - fn alice<'a>(&self, _: &Trait) {} +LL + fn alice<'a, T: Trait>(&self, _: &T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn alice<'a>(&self, _: &impl Trait) {} @@ -554,8 +575,9 @@ LL | fn bob<'a>(_: &'a Trait) {} | help: use a new generic type parameter, constrained by `Trait` | -LL | fn bob<'a, T: Trait>(_: &'a T) {} - | ++++++++++ ~ +LL - fn bob<'a>(_: &'a Trait) {} +LL + fn bob<'a, T: Trait>(_: &'a T) {} + | help: you can also use an opaque type, but users won't be able to specify the type parameter when calling the `fn`, having to rely exclusively on type inference | LL | fn bob<'a>(_: &'a impl Trait) {} @@ -577,8 +599,9 @@ LL | fn cat() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn cat() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn cat() -> &Trait { +LL + fn cat() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:27:22 @@ -592,8 +615,9 @@ LL | fn dog<'a>() -> &impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn dog<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn dog<'a>() -> &Trait { +LL + fn dog<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:33:24 @@ -607,8 +631,9 @@ LL | fn kitten() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn kitten() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn kitten() -> &'a Trait { +LL + fn kitten() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:39:27 @@ -622,8 +647,9 @@ LL | fn puppy<'a>() -> &'a impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn puppy<'a>() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn puppy<'a>() -> &'a Trait { +LL + fn puppy<'a>() -> Box<dyn Trait> { + | error[E0782]: expected a type, found a trait --> $DIR/reference-to-bare-trait-in-fn-inputs-and-outputs-issue-125139.rs:44:25 @@ -637,8 +663,9 @@ LL | fn parrot() -> &mut impl Trait { | ++++ help: alternatively, you can return an owned trait object | -LL | fn parrot() -> Box<dyn Trait> { - | ~~~~~~~~~~~~~~ +LL - fn parrot() -> &mut Trait { +LL + fn parrot() -> Box<dyn Trait> { + | error: aborting due to 42 previous errors diff --git a/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr b/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr index 8e139ee6b48..582cf1af054 100644 --- a/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr +++ b/tests/ui/dyn-compatibility/supertrait-mentions-GAT.stderr @@ -17,8 +17,9 @@ LL | fn c(&self) -> dyn SuperTrait<T>; | help: you might have meant to use `Self` to refer to the implementing type | -LL | fn c(&self) -> Self; - | ~~~~ +LL - fn c(&self) -> dyn SuperTrait<T>; +LL + fn c(&self) -> Self; + | error[E0038]: the trait `SuperTrait` is not dyn compatible --> $DIR/supertrait-mentions-GAT.rs:10:20 diff --git a/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr b/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr index a763649e9c6..2ba8e4611cb 100644 --- a/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr +++ b/tests/ui/dyn-compatibility/supertrait-mentions-Self.stderr @@ -34,8 +34,9 @@ LL | trait Baz : Bar<Self> { | this trait is not dyn compatible... help: consider using an opaque type instead | -LL | fn make_baz<T:Baz>(t: &T) -> &impl Baz { - | ~~~~ +LL - fn make_baz<T:Baz>(t: &T) -> &dyn Baz { +LL + fn make_baz<T:Baz>(t: &T) -> &impl Baz { + | error: aborting due to 2 previous errors |
