Skip to content

Commit d708bc4

Browse files
authored
Rollup merge of rust-lang#98665 - ChrisDenton:deprecated-suggestion, r=compiler-errors
Use verbose help for deprecation suggestion Fixes rust-lang#98631 r? `@compiler-errors`
2 parents bba00b5 + 3cbf864 commit d708bc4

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

compiler/rustc_middle/src/middle/stability.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub fn deprecation_suggestion(
150150
span: Span,
151151
) {
152152
if let Some(suggestion) = suggestion {
153-
diag.span_suggestion(
153+
diag.span_suggestion_verbose(
154154
span,
155155
&format!("replace the use of the deprecated {}", kind),
156156
suggestion,

src/test/ui/deprecation/atomic_initializers.stderr

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ warning: use of deprecated constant `std::sync::atomic::ATOMIC_ISIZE_INIT`: the
22
--> $DIR/atomic_initializers.rs:8:27
33
|
44
LL | static FOO: AtomicIsize = ATOMIC_ISIZE_INIT;
5-
| ^^^^^^^^^^^^^^^^^ help: replace the use of the deprecated constant: `AtomicIsize::new(0)`
5+
| ^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(deprecated)]` on by default
8+
help: replace the use of the deprecated constant
9+
|
10+
LL | static FOO: AtomicIsize = AtomicIsize::new(0);
11+
| ~~~~~~~~~~~~~~~~~~~
812

913
warning: 1 warning emitted
1014

src/test/ui/deprecation/issue-84637-deprecated-associated-function.stderr

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,28 @@ error: use of deprecated associated function `core::str::<impl str>::trim_left`:
22
--> $DIR/issue-84637-deprecated-associated-function.rs:6:21
33
|
44
LL | let _foo = str::trim_left(" aoeu");
5-
| ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start`
5+
| ^^^^^^^^^
66
|
77
note: the lint level is defined here
88
--> $DIR/issue-84637-deprecated-associated-function.rs:3:9
99
|
1010
LL | #![deny(deprecated)]
1111
| ^^^^^^^^^^
12+
help: replace the use of the deprecated associated function
13+
|
14+
LL | let _foo = str::trim_start(" aoeu");
15+
| ~~~~~~~~~~
1216

1317
error: use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start`
1418
--> $DIR/issue-84637-deprecated-associated-function.rs:8:26
1519
|
1620
LL | let _bar = " aoeu".trim_left();
17-
| ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start`
21+
| ^^^^^^^^^
22+
|
23+
help: replace the use of the deprecated associated function
24+
|
25+
LL | let _bar = " aoeu".trim_start();
26+
| ~~~~~~~~~~
1827

1928
error: aborting due to 2 previous errors
2029

src/test/ui/deprecation/suggestion.stderr

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,28 @@ error: use of deprecated function `bar::deprecated`: replaced by `replacement`
22
--> $DIR/suggestion.rs:42:10
33
|
44
LL | bar::deprecated();
5-
| ^^^^^^^^^^ help: replace the use of the deprecated function: `replacement`
5+
| ^^^^^^^^^^
66
|
77
note: the lint level is defined here
88
--> $DIR/suggestion.rs:8:9
99
|
1010
LL | #![deny(deprecated)]
1111
| ^^^^^^^^^^
12+
help: replace the use of the deprecated function
13+
|
14+
LL | bar::replacement();
15+
| ~~~~~~~~~~~
1216

1317
error: use of deprecated associated function `Foo::deprecated`: replaced by `replacement`
1418
--> $DIR/suggestion.rs:40:9
1519
|
1620
LL | foo.deprecated();
17-
| ^^^^^^^^^^ help: replace the use of the deprecated associated function: `replacement`
21+
| ^^^^^^^^^^
22+
|
23+
help: replace the use of the deprecated associated function
24+
|
25+
LL | foo.replacement();
26+
| ~~~~~~~~~~~
1827

1928
error: aborting due to 2 previous errors
2029

0 commit comments

Comments
 (0)