Skip to content

Commit f8911e3

Browse files
committed
:: selective on any case with dyn (#91997)
1 parent efd809e commit f8911e3

13 files changed

+44
-13
lines changed

tests/ui/associated-types/associated-types-incomplete-object.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LL | type B;
2525
| ------ `B` defined here
2626
...
2727
LL | let d = &42isize as &dyn Foo;
28-
| ^^^ help: specify the associated types: `Foo::<A = Type, B = Type>`
28+
| ^^^ help: specify the associated types: `Foo<A = Type, B = Type>`
2929

3030
error: aborting due to 3 previous errors
3131

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ LL | type Test = dyn Add + Sub;
2525
|
2626
help: specify the associated types
2727
|
28-
LL | type Test = dyn Add::<Output = Type> + Sub::<Output = Type>;
29-
| ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
28+
LL | type Test = dyn Add<Output = Type> + Sub<Output = Type>;
29+
| ~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
3030

3131
error[E0393]: the type parameter `Rhs` must be explicitly specified
3232
--> $DIR/issue-22560.rs:9:17

tests/ui/associated-types/issue-23595-1.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | type Value;
66
LL | type ChildKey;
77
| ------------- `ChildKey` defined here
88
LL | type Children = dyn Index<Self::ChildKey, Output = dyn Hierarchy>;
9-
| ------------- `Children` defined here ^^^^^^^^^ help: specify the associated types: `Hierarchy::<Value = Type, ChildKey = Type, Children = Type>`
9+
| ------------- `Children` defined here ^^^^^^^^^ help: specify the associated types: `Hierarchy<Value = Type, ChildKey = Type, Children = Type>`
1010

1111
error: aborting due to 1 previous error
1212

tests/ui/error-codes/E0191.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type Bar;
55
| -------- `Bar` defined here
66
...
77
LL | type Foo = dyn Trait;
8-
| ^^^^^ help: specify the associated type: `Trait::<Bar = Type>`
8+
| ^^^^^ help: specify the associated type: `Trait<Bar = Type>`
99

1010
error: aborting due to 1 previous error
1111

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trait MyIterator : Iterator {}
2+
3+
fn main() {
4+
let _ = MyIterator::next;
5+
}
6+
//~^^ ERROR the value of the associated type `Item` in `Iterator` must be specified [E0191]
7+
//~| WARN trait objects without an explicit `dyn` are deprecated [bare_trait_objects]
8+
//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
warning: trait objects without an explicit `dyn` are deprecated
2+
--> $DIR/dynless-turbofish-e0191-issue-91997.rs:4:13
3+
|
4+
LL | let _ = MyIterator::next;
5+
| ^^^^^^^^^^
6+
|
7+
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8+
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9+
= note: `#[warn(bare_trait_objects)]` on by default
10+
help: if this is an object-safe trait, use `dyn`
11+
|
12+
LL | let _ = <dyn MyIterator>::next;
13+
| ++++ +
14+
15+
error[E0191]: the value of the associated type `Item` in `Iterator` must be specified
16+
--> $DIR/dynless-turbofish-e0191-issue-91997.rs:4:13
17+
|
18+
LL | let _ = MyIterator::next;
19+
| ^^^^^^^^^^ help: specify the associated type: `MyIterator::<Item = Type>`
20+
21+
error: aborting due to 1 previous error; 1 warning emitted
22+
23+
For more information about this error, try `rustc --explain E0191`.

tests/ui/issues/issue-19482.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type A;
55
| ------ `A` defined here
66
...
77
LL | fn bar(x: &dyn Foo) {}
8-
| ^^^ help: specify the associated type: `Foo::<A = Type>`
8+
| ^^^ help: specify the associated type: `Foo<A = Type>`
99

1010
error: aborting due to 1 previous error
1111

tests/ui/issues/issue-21950.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type Output;
55
| ----------- `Output` defined here
66
...
77
LL | let x = &10 as &dyn Add;
8-
| ^^^ help: specify the associated type: `Add::<Output = Type>`
8+
| ^^^ help: specify the associated type: `Add<Output = Type>`
99

1010
error[E0393]: the type parameter `Rhs` must be explicitly specified
1111
--> $DIR/issue-21950.rs:10:25

tests/ui/issues/issue-22434.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type A;
55
| ------ `A` defined here
66
...
77
LL | type I<'a> = &'a (dyn Foo + 'a);
8-
| ^^^ help: specify the associated type: `Foo::<A = Type>`
8+
| ^^^ help: specify the associated type: `Foo<A = Type>`
99

1010
error: aborting due to 1 previous error
1111

tests/ui/issues/issue-23024.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ error[E0191]: the value of the associated type `Output` in `FnOnce` must be spec
2323
--> $DIR/issue-23024.rs:8:39
2424
|
2525
LL | println!("{:?}",(vfnfer[0] as dyn Fn)(3));
26-
| ^^ help: specify the associated type: `Fn::<Output = Type>`
26+
| ^^ help: specify the associated type: `Fn<Output = Type>`
2727

2828
error: aborting due to 3 previous errors
2929

tests/ui/object-safety/assoc_type_bounds_sized_others.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | type Bop;
55
| -------- `Bop` defined here
66
...
77
LL | fn foo(_: &dyn Foo) {}
8-
| ^^^ help: specify the associated type: `Foo::<Bop = Type>`
8+
| ^^^ help: specify the associated type: `Foo<Bop = Type>`
99

1010
error[E0191]: the value of the associated type `Bop` in `Bar` must be specified
1111
--> $DIR/assoc_type_bounds_sized_others.rs:22:16
@@ -14,7 +14,7 @@ LL | type Bop;
1414
| -------- `Bop` defined here
1515
...
1616
LL | fn bar(_: &dyn Bar) {}
17-
| ^^^ help: specify the associated type: `Bar::<Bop = Type>`
17+
| ^^^ help: specify the associated type: `Bar<Bop = Type>`
1818

1919
error: aborting due to 2 previous errors
2020

tests/ui/suggestions/trait-hidden-method.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0191]: the value of the associated type `Item` in `Iterator` must be spec
22
--> $DIR/trait-hidden-method.rs:6:33
33
|
44
LL | Box::new(1..=10) as Box<dyn Iterator>
5-
| ^^^^^^^^ help: specify the associated type: `Iterator::<Item = Type>`
5+
| ^^^^^^^^ help: specify the associated type: `Iterator<Item = Type>`
66

77
error[E0271]: expected `Box<dyn Iterator>` to be an iterator that yields `u32`, but it yields `<dyn Iterator as Iterator>::Item`
88
--> $DIR/trait-hidden-method.rs:3:32

tests/ui/traits/alias/object-fail.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error[E0191]: the value of the associated type `Item` in `Iterator` must be spec
1313
--> $DIR/object-fail.rs:9:17
1414
|
1515
LL | let _: &dyn IteratorAlias = &vec![123].into_iter();
16-
| ^^^^^^^^^^^^^ help: specify the associated type: `IteratorAlias::<Item = Type>`
16+
| ^^^^^^^^^^^^^ help: specify the associated type: `IteratorAlias<Item = Type>`
1717

1818
error: aborting due to 2 previous errors
1919

0 commit comments

Comments
 (0)