Add regression test for issue 142649

This commit is contained in:
David Tolnay 2025-06-19 16:20:15 -07:00
parent 86f40acce3
commit 715e02ff3c
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
3 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,8 @@
//@ check-fail
//@ compile-flags: --crate-type=lib
// Regression test for issue 142649
pub fn public() {
#[deprecated] 0
//~^ ERROR mismatched types
}

View file

@ -16,3 +16,8 @@ pub struct SinceAndNote;
#[deprecated(note = "here's why this is deprecated", since = "1.2.3")]
pub struct FlippedOrder;
pub fn f() {
// Attribute is ignored here (with a warning), but still preserved in HIR
#[deprecated] 0
}

View file

@ -24,3 +24,12 @@ struct SinceAndNote;
#[attr = Deprecation {deprecation: Deprecation {since: NonStandard("1.2.3"),
note: "here's why this is deprecated"}}]
struct FlippedOrder;
fn f() {
// Attribute is ignored here (with a warning), but still preserved in HIR
#[attr = Deprecation {deprecation:
Deprecation {since:
Unspecified}}]
0
}