Skip to content

Commit

Permalink
Add test for #[deprecated] attribute on trait impl block.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Nov 1, 2020
1 parent 6f1992a commit 9fc991a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/test/ui/deprecation/deprecation-sanity.rs
Expand Up @@ -30,4 +30,13 @@ fn multiple1() { }
#[deprecated(since = "a", since = "b", note = "c")] //~ ERROR multiple 'since' items
fn f1() { }

struct X;

#[deprecated = "hello"] //~ ERROR this `#[deprecated]' annotation has no effect
impl Default for X {
fn default() -> Self {
X
}
}

fn main() { }
10 changes: 9 additions & 1 deletion src/test/ui/deprecation/deprecation-sanity.stderr
Expand Up @@ -58,7 +58,15 @@ error[E0538]: multiple 'since' items
LL | #[deprecated(since = "a", since = "b", note = "c")]
| ^^^^^^^^^^^

error: aborting due to 9 previous errors
error: this `#[deprecated]' annotation has no effect
--> $DIR/deprecation-sanity.rs:35:1
|
LL | #[deprecated = "hello"]
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the deprecation attribute
|
= note: `#[deny(useless_deprecated)]` on by default

error: aborting due to 10 previous errors

Some errors have detailed explanations: E0538, E0541, E0550, E0551, E0565.
For more information about an error, try `rustc --explain E0538`.

0 comments on commit 9fc991a

Please sign in to comment.