forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#59389 - euclio:deprecated-suggestion, r=varkor
replace redundant note in deprecation warning
- Loading branch information
Showing
5 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// run-rustfix | ||
|
||
#![feature(staged_api)] | ||
|
||
#![stable(since = "1.0.0", feature = "test")] | ||
|
||
#![deny(deprecated)] | ||
#![allow(dead_code)] | ||
|
||
struct Foo; | ||
|
||
impl Foo { | ||
#[rustc_deprecated( | ||
since = "1.0.0", | ||
reason = "replaced by `replacement`", | ||
suggestion = "replacement", | ||
)] | ||
#[stable(since = "1.0.0", feature = "test")] | ||
fn deprecated(&self) {} | ||
|
||
fn replacement(&self) {} | ||
} | ||
|
||
fn main() { | ||
let foo = Foo; | ||
|
||
foo.replacement(); //~ ERROR use of deprecated | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// run-rustfix | ||
|
||
#![feature(staged_api)] | ||
|
||
#![stable(since = "1.0.0", feature = "test")] | ||
|
||
#![deny(deprecated)] | ||
#![allow(dead_code)] | ||
|
||
struct Foo; | ||
|
||
impl Foo { | ||
#[rustc_deprecated( | ||
since = "1.0.0", | ||
reason = "replaced by `replacement`", | ||
suggestion = "replacement", | ||
)] | ||
#[stable(since = "1.0.0", feature = "test")] | ||
fn deprecated(&self) {} | ||
|
||
fn replacement(&self) {} | ||
} | ||
|
||
fn main() { | ||
let foo = Foo; | ||
|
||
foo.deprecated(); //~ ERROR use of deprecated | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: use of deprecated item 'Foo::deprecated': replaced by `replacement` | ||
--> $DIR/suggestion.rs:27:9 | ||
| | ||
LL | foo.deprecated(); | ||
| ^^^^^^^^^^ help: replace the use of the deprecated item: `replacement` | ||
| | ||
note: lint level defined here | ||
--> $DIR/suggestion.rs:7:9 | ||
| | ||
LL | #![deny(deprecated)] | ||
| ^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|