about summary refs log tree commit diff
path: root/tests/ui/parser
diff options
context:
space:
mode:
authorJonathan Brouwer <jonathantbrouwer@gmail.com>2025-06-29 11:34:29 +0200
committerJonathan Brouwer <jonathantbrouwer@gmail.com>2025-07-01 16:10:05 +0200
commit149bdde97e65779b126ec1ae6bcbe152fd90f856 (patch)
tree7fd8c5d47bd21f4dfbcd2812a2dad2ed3d2e42ba /tests/ui/parser
parent86b54d5729f019d5e2c5acff4ddfddbd7af2fde3 (diff)
downloadrust-149bdde97e65779b126ec1ae6bcbe152fd90f856.tar.gz
rust-149bdde97e65779b126ec1ae6bcbe152fd90f856.zip
Fix `#[must_use = 1]` not giving an error
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Diffstat (limited to 'tests/ui/parser')
-rw-r--r--tests/ui/parser/bad-lit-suffixes.rs1
-rw-r--r--tests/ui/parser/bad-lit-suffixes.stderr28
2 files changed, 19 insertions, 10 deletions
diff --git a/tests/ui/parser/bad-lit-suffixes.rs b/tests/ui/parser/bad-lit-suffixes.rs
index 13287aabb1d..0a01bb84f01 100644
--- a/tests/ui/parser/bad-lit-suffixes.rs
+++ b/tests/ui/parser/bad-lit-suffixes.rs
@@ -33,6 +33,7 @@ fn f() {}
 
 #[must_use = "string"suffix]
 //~^ ERROR suffixes on string literals are invalid
+//~| ERROR malformed `must_use` attribute input
 fn g() {}
 
 #[link(name = "string"suffix)]
diff --git a/tests/ui/parser/bad-lit-suffixes.stderr b/tests/ui/parser/bad-lit-suffixes.stderr
index 295e3112ec0..e68893535eb 100644
--- a/tests/ui/parser/bad-lit-suffixes.stderr
+++ b/tests/ui/parser/bad-lit-suffixes.stderr
@@ -23,13 +23,13 @@ LL | #[must_use = "string"suffix]
    |              ^^^^^^^^^^^^^^ invalid suffix `suffix`
 
 error: suffixes on string literals are invalid
-  --> $DIR/bad-lit-suffixes.rs:38:15
+  --> $DIR/bad-lit-suffixes.rs:39:15
    |
 LL | #[link(name = "string"suffix)]
    |               ^^^^^^^^^^^^^^ invalid suffix `suffix`
 
 error: invalid suffix `suffix` for number literal
-  --> $DIR/bad-lit-suffixes.rs:42:41
+  --> $DIR/bad-lit-suffixes.rs:43:41
    |
 LL | #[rustc_layout_scalar_valid_range_start(0suffix)]
    |                                         ^^^^^^^ invalid suffix `suffix`
@@ -150,15 +150,23 @@ LL |     1.0e10suffix;
    |
    = help: valid suffixes are `f32` and `f64`
 
-error[E0805]: malformed `rustc_layout_scalar_valid_range_start` attribute input
-  --> $DIR/bad-lit-suffixes.rs:42:1
+error[E0539]: malformed `must_use` attribute input
+  --> $DIR/bad-lit-suffixes.rs:34:1
+   |
+LL | #[must_use = "string"suffix]
+   | ^^^^^^^^^^^^^--------------^
+   |              |
+   |              expected a string literal here
+   |
+help: try changing it to one of the following valid forms of the attribute
+   |
+LL - #[must_use = "string"suffix]
+LL + #[must_use = "reason"]
+   |
+LL - #[must_use = "string"suffix]
+LL + #[must_use]
    |
-LL | #[rustc_layout_scalar_valid_range_start(0suffix)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^
-   | |                                      |
-   | |                                      expected a single argument here
-   | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]`
 
 error: aborting due to 21 previous errors; 2 warnings emitted
 
-For more information about this error, try `rustc --explain E0805`.
+For more information about this error, try `rustc --explain E0539`.