Rollup merge of #98665 - ChrisDenton:deprecated-suggestion, r=compiler-errors

Use verbose help for deprecation suggestion

Fixes #98631

r? `@compiler-errors`
This commit is contained in:
Matthias Krüger 2022-06-29 20:35:06 +02:00 committed by GitHub
commit d708bc45c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 6 deletions

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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