diff options
| author | David Tolnay <dtolnay@gmail.com> | 2025-06-19 16:20:15 -0700 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2025-06-21 11:09:14 -0700 |
| commit | 715e02ff3ce28e330a278db1eb834547b7ab86f2 (patch) | |
| tree | c9e386efe6b4f2cd659a87c4ce4b62c0fa404cea /tests | |
| parent | 86f40acce3ba62845642fb972e5a28191eb27c8a (diff) | |
| download | rust-715e02ff3ce28e330a278db1eb834547b7ab86f2.tar.gz rust-715e02ff3ce28e330a278db1eb834547b7ab86f2.zip | |
Add regression test for issue 142649
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/deprecation/deprecated-expr-precedence.rs | 8 | ||||
| -rw-r--r-- | tests/ui/unpretty/deprecated-attr.rs | 5 | ||||
| -rw-r--r-- | tests/ui/unpretty/deprecated-attr.stdout | 9 |
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/deprecation/deprecated-expr-precedence.rs b/tests/ui/deprecation/deprecated-expr-precedence.rs new file mode 100644 index 00000000000..9636b46df20 --- /dev/null +++ b/tests/ui/deprecation/deprecated-expr-precedence.rs @@ -0,0 +1,8 @@ +//@ check-fail +//@ compile-flags: --crate-type=lib + +// Regression test for issue 142649 +pub fn public() { + #[deprecated] 0 + //~^ ERROR mismatched types +} diff --git a/tests/ui/unpretty/deprecated-attr.rs b/tests/ui/unpretty/deprecated-attr.rs index 0c80203e965..e2ab5efb5d8 100644 --- a/tests/ui/unpretty/deprecated-attr.rs +++ b/tests/ui/unpretty/deprecated-attr.rs @@ -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 +} diff --git a/tests/ui/unpretty/deprecated-attr.stdout b/tests/ui/unpretty/deprecated-attr.stdout index 97d863b2e94..a2b645d00d0 100644 --- a/tests/ui/unpretty/deprecated-attr.stdout +++ b/tests/ui/unpretty/deprecated-attr.stdout @@ -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 +} |
