You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #120530 - trevyn:issue-116434, r=compiler-errors
Be less confident when `dyn` suggestion is not checked for object safety
#120275 no longer checks bare traits for object safety when making a `dyn` suggestion on Rust < 2021. In this case, qualify the suggestion with a note that the trait must be object safe, to prevent user confusion as seen in #116434
r? ```@fmease```
Copy file name to clipboardexpand all lines: tests/ui/did_you_mean/bad-assoc-ty.stderr
+1-1
Original file line number
Diff line number
Diff line change
@@ -182,7 +182,7 @@ LL | type H = Fn(u8) -> (u8)::Output;
182
182
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
183
183
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
184
184
= note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
26
26
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
39
39
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `#[warn(bare_trait_objects)]` on by default
Copy file name to clipboardexpand all lines: tests/ui/issues/issue-28344.stderr
+2-2
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
7
7
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `#[warn(bare_trait_objects)]` on by default
10
-
help: use `dyn`
10
+
help: if this is an object-safe trait, use `dyn`
11
11
|
12
12
LL | let x: u8 = <dyn BitXor>::bitor(0 as u8, 0 as u8);
13
13
| ++++ +
@@ -35,7 +35,7 @@ LL | let g = BitXor::bitor;
35
35
|
36
36
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
37
37
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
Copy file name to clipboardexpand all lines: tests/ui/issues/issue-58734.stderr
+1-1
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ LL | Trait::nonexistent(());
7
7
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `#[warn(bare_trait_objects)]` on by default
Copy file name to clipboardexpand all lines: tests/ui/issues/issue-86756.stderr
+1-1
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ LL | eq::<dyn, Foo>
21
21
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
22
22
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
23
23
= note: `#[warn(bare_trait_objects)]` on by default
Copy file name to clipboardexpand all lines: tests/ui/lint/bare-trait-objects-path.stderr
+4-4
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ LL | let _: Dyn::Ty;
7
7
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `#[warn(bare_trait_objects)]` on by default
10
-
help: use `dyn`
10
+
help: if this is an object-safe trait, use `dyn`
11
11
|
12
12
LL | let _: <dyn Dyn>::Ty;
13
13
| ++++ +
@@ -26,7 +26,7 @@ LL | Dyn::func();
26
26
|
27
27
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
28
28
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
29
-
help: use `dyn`
29
+
help: if this is an object-safe trait, use `dyn`
30
30
|
31
31
LL | <dyn Dyn>::func();
32
32
| ++++ +
@@ -39,7 +39,7 @@ LL | ::Dyn::func();
39
39
|
40
40
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
41
41
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
42
-
help: use `dyn`
42
+
help: if this is an object-safe trait, use `dyn`
43
43
|
44
44
LL | <dyn (::Dyn)>::func();
45
45
| ++++++ ++
@@ -52,7 +52,7 @@ LL | Dyn::CONST;
52
52
|
53
53
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
54
54
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: requested on the command line with `--force-warn bare-trait-objects`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: requested on the command line with `--force-warn bare-trait-objects`
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
10
10
= help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
10
10
= help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
10
10
= help: to override `--force-warn rust-2018-idioms` add `#[allow(bare_trait_objects)]`
Copy file name to clipboardexpand all lines: tests/ui/object-safety/avoid-ice-on-warning-2.old.stderr
+2-2
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ LL | fn id<F>(f: Copy) -> usize {
7
7
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
22
22
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
23
23
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
Copy file name to clipboardexpand all lines: tests/ui/object-safety/avoid-ice-on-warning-3.old.stderr
+6-6
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ LL | trait B { fn f(a: A) -> A; }
7
7
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
8
8
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
9
9
= note: `#[warn(bare_trait_objects)]` on by default
10
-
help: use `dyn`
10
+
help: if this is an object-safe trait, use `dyn`
11
11
|
12
12
LL | trait B { fn f(a: dyn A) -> A; }
13
13
| +++
@@ -20,7 +20,7 @@ LL | trait B { fn f(a: A) -> A; }
20
20
|
21
21
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
22
22
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
23
-
help: use `dyn`
23
+
help: if this is an object-safe trait, use `dyn`
24
24
|
25
25
LL | trait B { fn f(a: A) -> dyn A; }
26
26
| +++
@@ -33,7 +33,7 @@ LL | trait A { fn g(b: B) -> B; }
33
33
|
34
34
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
35
35
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
36
-
help: use `dyn`
36
+
help: if this is an object-safe trait, use `dyn`
37
37
|
38
38
LL | trait A { fn g(b: dyn B) -> B; }
39
39
| +++
@@ -46,7 +46,7 @@ LL | trait A { fn g(b: B) -> B; }
46
46
|
47
47
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
48
48
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
49
-
help: use `dyn`
49
+
help: if this is an object-safe trait, use `dyn`
50
50
|
51
51
LL | trait A { fn g(b: B) -> dyn B; }
52
52
| +++
@@ -60,7 +60,7 @@ LL | trait B { fn f(a: A) -> A; }
60
60
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
61
61
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
62
62
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
63
-
help: use `dyn`
63
+
help: if this is an object-safe trait, use `dyn`
64
64
|
65
65
LL | trait B { fn f(a: dyn A) -> A; }
66
66
| +++
@@ -96,7 +96,7 @@ LL | trait A { fn g(b: B) -> B; }
96
96
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
97
97
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
98
98
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
20
20
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
21
21
= note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
26
26
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
27
27
= note: `#[warn(bare_trait_objects)]` on by default
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
51
51
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
75
75
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
0 commit comments