Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use verbose help for deprecation suggestion #98665

Merged
merged 1 commit into from
Jun 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/middle/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub fn deprecation_suggestion(
span: Span,
) {
if let Some(suggestion) = suggestion {
diag.span_suggestion(
diag.span_suggestion_verbose(
span,
&format!("replace the use of the deprecated {}", kind),
suggestion,
Expand Down
6 changes: 5 additions & 1 deletion src/test/ui/deprecation/atomic_initializers.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ warning: use of deprecated constant `std::sync::atomic::ATOMIC_ISIZE_INIT`: the
--> $DIR/atomic_initializers.rs:8:27
|
LL | static FOO: AtomicIsize = ATOMIC_ISIZE_INIT;
| ^^^^^^^^^^^^^^^^^ help: replace the use of the deprecated constant: `AtomicIsize::new(0)`
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
help: replace the use of the deprecated constant
|
LL | static FOO: AtomicIsize = AtomicIsize::new(0);
| ~~~~~~~~~~~~~~~~~~~

warning: 1 warning emitted

Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,28 @@ error: use of deprecated associated function `core::str::<impl str>::trim_left`:
--> $DIR/issue-84637-deprecated-associated-function.rs:6:21
|
LL | let _foo = str::trim_left(" aoeu");
| ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start`
| ^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/issue-84637-deprecated-associated-function.rs:3:9
|
LL | #![deny(deprecated)]
| ^^^^^^^^^^
help: replace the use of the deprecated associated function
|
LL | let _foo = str::trim_start(" aoeu");
| ~~~~~~~~~~

error: use of deprecated associated function `core::str::<impl str>::trim_left`: superseded by `trim_start`
--> $DIR/issue-84637-deprecated-associated-function.rs:8:26
|
LL | let _bar = " aoeu".trim_left();
| ^^^^^^^^^ help: replace the use of the deprecated associated function: `trim_start`
| ^^^^^^^^^
|
help: replace the use of the deprecated associated function
|
LL | let _bar = " aoeu".trim_start();
| ~~~~~~~~~~

error: aborting due to 2 previous errors

13 changes: 11 additions & 2 deletions src/test/ui/deprecation/suggestion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,28 @@ error: use of deprecated function `bar::deprecated`: replaced by `replacement`
--> $DIR/suggestion.rs:42:10
|
LL | bar::deprecated();
| ^^^^^^^^^^ help: replace the use of the deprecated function: `replacement`
| ^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/suggestion.rs:8:9
|
LL | #![deny(deprecated)]
| ^^^^^^^^^^
help: replace the use of the deprecated function
|
LL | bar::replacement();
| ~~~~~~~~~~~

error: use of deprecated associated function `Foo::deprecated`: replaced by `replacement`
--> $DIR/suggestion.rs:40:9
|
LL | foo.deprecated();
| ^^^^^^^^^^ help: replace the use of the deprecated associated function: `replacement`
| ^^^^^^^^^^
|
help: replace the use of the deprecated associated function
|
LL | foo.replacement();
| ~~~~~~~~~~~

error: aborting due to 2 previous errors