diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-07-03 21:02:27 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-07-04 02:41:13 +0000 |
| commit | f63d2bc657f2158bc37c747bb0835a9d02b864d1 (patch) | |
| tree | 77896b21cbc8757c6b4b71130e0494da14b6f57f /tests | |
| parent | 89ecae5d852a7346ee4e8240ae7a1130f1f6f458 (diff) | |
| download | rust-f63d2bc657f2158bc37c747bb0835a9d02b864d1.tar.gz rust-f63d2bc657f2158bc37c747bb0835a9d02b864d1.zip | |
Better suggestion span for missing type parameter
Diffstat (limited to 'tests')
6 files changed, 40 insertions, 8 deletions
diff --git a/tests/ui/associated-types/issue-22560.stderr b/tests/ui/associated-types/issue-22560.stderr index 46e6e3951a5..834040490f9 100644 --- a/tests/ui/associated-types/issue-22560.stderr +++ b/tests/ui/associated-types/issue-22560.stderr @@ -35,9 +35,13 @@ LL | trait Add<Rhs=Self> { | ------------------- type parameter `Rhs` must be specified for this ... LL | type Test = dyn Add + Sub; - | ^^^ help: set the type parameter to the desired type: `Add<Rhs>` + | ^^^ | = note: because of the default `Self` reference, type parameters must be specified on object types +help: set the type parameter to the desired type + | +LL | type Test = dyn Add<Rhs> + Sub; + | +++++ error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/issue-22560.rs:9:23 @@ -46,9 +50,13 @@ LL | trait Sub<Rhs=Self> { | ------------------- type parameter `Rhs` must be specified for this ... LL | type Test = dyn Add + Sub; - | ^^^ help: set the type parameter to the desired type: `Sub<Rhs>` + | ^^^ | = note: because of the default `Self` reference, type parameters must be specified on object types +help: set the type parameter to the desired type + | +LL | type Test = dyn Add + Sub<Rhs>; + | +++++ error: aborting due to 4 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index be79450a3ce..416a9381124 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -20,24 +20,32 @@ error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27 | LL | ) -> impl Iterator<Item = SubAssign> { - | ^^^^^^^^^ help: set the type parameter to the desired type: `SubAssign<Rhs>` + | ^^^^^^^^^ --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | = note: type parameter `Rhs` must be specified for this | = note: because of the default `Self` reference, type parameters must be specified on object types +help: set the type parameter to the desired type + | +LL | ) -> impl Iterator<Item = SubAssign<Rhs>> { + | +++++ error[E0393]: the type parameter `Rhs` must be explicitly specified --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27 | LL | ) -> impl Iterator<Item = SubAssign> { - | ^^^^^^^^^ help: set the type parameter to the desired type: `SubAssign<Rhs>` + | ^^^^^^^^^ --> $SRC_DIR/core/src/ops/arith.rs:LL:COL | = note: type parameter `Rhs` must be specified for this | = note: because of the default `Self` reference, type parameters must be specified on object types = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: set the type parameter to the desired type + | +LL | ) -> impl Iterator<Item = SubAssign<Rhs>> { + | +++++ error[E0277]: `()` is not an iterator --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:6 diff --git a/tests/ui/error-codes/E0393.stderr b/tests/ui/error-codes/E0393.stderr index 4083fa23e87..489398b7be5 100644 --- a/tests/ui/error-codes/E0393.stderr +++ b/tests/ui/error-codes/E0393.stderr @@ -5,9 +5,13 @@ LL | trait A<T=Self> {} | --------------- type parameter `T` must be specified for this LL | LL | fn together_we_will_rule_the_galaxy(son: &dyn A) {} - | ^ help: set the type parameter to the desired type: `A<T>` + | ^ | = note: because of the default `Self` reference, type parameters must be specified on object types +help: set the type parameter to the desired type + | +LL | fn together_we_will_rule_the_galaxy(son: &dyn A<T>) {} + | +++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-21950.stderr b/tests/ui/issues/issue-21950.stderr index e498565d4e6..584370c7178 100644 --- a/tests/ui/issues/issue-21950.stderr +++ b/tests/ui/issues/issue-21950.stderr @@ -14,9 +14,13 @@ LL | trait Add<Rhs=Self> { | ------------------- type parameter `Rhs` must be specified for this ... LL | let x = &10 as &dyn Add; - | ^^^ help: set the type parameter to the desired type: `Add<Rhs>` + | ^^^ | = note: because of the default `Self` reference, type parameters must be specified on object types +help: set the type parameter to the desired type + | +LL | let x = &10 as &dyn Add<Rhs>; + | +++++ error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-22370.stderr b/tests/ui/issues/issue-22370.stderr index 977cfe06bb8..3dc060963f9 100644 --- a/tests/ui/issues/issue-22370.stderr +++ b/tests/ui/issues/issue-22370.stderr @@ -5,9 +5,13 @@ LL | trait A<T=Self> {} | --------------- type parameter `T` must be specified for this LL | LL | fn f(a: &dyn A) {} - | ^ help: set the type parameter to the desired type: `A<T>` + | ^ | = note: because of the default `Self` reference, type parameters must be specified on object types +help: set the type parameter to the desired type + | +LL | fn f(a: &dyn A<T>) {} + | +++ error: aborting due to 1 previous error diff --git a/tests/ui/type/type-parameter-defaults-referencing-Self.stderr b/tests/ui/type/type-parameter-defaults-referencing-Self.stderr index 16d08b26722..c81405f03f8 100644 --- a/tests/ui/type/type-parameter-defaults-referencing-Self.stderr +++ b/tests/ui/type/type-parameter-defaults-referencing-Self.stderr @@ -5,9 +5,13 @@ LL | trait Foo<T=Self> { | ----------------- type parameter `T` must be specified for this ... LL | fn foo(x: &dyn Foo) { } - | ^^^ help: set the type parameter to the desired type: `Foo<T>` + | ^^^ | = note: because of the default `Self` reference, type parameters must be specified on object types +help: set the type parameter to the desired type + | +LL | fn foo(x: &dyn Foo<T>) { } + | +++ error: aborting due to 1 previous error |
