Skip to content

Commit 9fc991a

Browse files
committed
Add test for #[deprecated] attribute on trait impl block.
1 parent 6f1992a commit 9fc991a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/test/ui/deprecation/deprecation-sanity.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,13 @@ fn multiple1() { }
3030
#[deprecated(since = "a", since = "b", note = "c")] //~ ERROR multiple 'since' items
3131
fn f1() { }
3232

33+
struct X;
34+
35+
#[deprecated = "hello"] //~ ERROR this `#[deprecated]' annotation has no effect
36+
impl Default for X {
37+
fn default() -> Self {
38+
X
39+
}
40+
}
41+
3342
fn main() { }

src/test/ui/deprecation/deprecation-sanity.stderr

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,15 @@ error[E0538]: multiple 'since' items
5858
LL | #[deprecated(since = "a", since = "b", note = "c")]
5959
| ^^^^^^^^^^^
6060

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

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

0 commit comments

Comments
 (0)