Skip to content

Commit 715e02f

Browse files
committed
Add regression test for issue 142649
1 parent 86f40ac commit 715e02f

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ check-fail
2+
//@ compile-flags: --crate-type=lib
3+
4+
// Regression test for issue 142649
5+
pub fn public() {
6+
#[deprecated] 0
7+
//~^ ERROR mismatched types
8+
}

tests/ui/unpretty/deprecated-attr.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ pub struct SinceAndNote;
1616

1717
#[deprecated(note = "here's why this is deprecated", since = "1.2.3")]
1818
pub struct FlippedOrder;
19+
20+
pub fn f() {
21+
// Attribute is ignored here (with a warning), but still preserved in HIR
22+
#[deprecated] 0
23+
}

tests/ui/unpretty/deprecated-attr.stdout

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ struct SinceAndNote;
2424
#[attr = Deprecation {deprecation: Deprecation {since: NonStandard("1.2.3"),
2525
note: "here's why this is deprecated"}}]
2626
struct FlippedOrder;
27+
28+
fn f() {
29+
30+
// Attribute is ignored here (with a warning), but still preserved in HIR
31+
#[attr = Deprecation {deprecation:
32+
Deprecation {since:
33+
Unspecified}}]
34+
0
35+
}

0 commit comments

Comments
 (0)