about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-11-15 10:44:09 +0100
committerGitHub <noreply@github.com>2022-11-15 10:44:09 +0100
commit47f9d89f9abd24bc6a347a77dcf131e283ad2c3b (patch)
tree34c81cba566dc4e07e7ec021102bfee79ea07dbc /src/test
parente309b79050c4dd47c08b3ef2b8228701883c5c24 (diff)
parent5ef85bbd7cd02df6389db6b3160ec7ef153091f1 (diff)
downloadrust-47f9d89f9abd24bc6a347a77dcf131e283ad2c3b.tar.gz
rust-47f9d89f9abd24bc6a347a77dcf131e283ad2c3b.zip
Rollup merge of #104148 - fmease:fix-104140, r=petrochenkov
Visit attributes of trait impl items during AST validation

Fixes #104140.

This fix might not be backward compatible (in practice) since we now validate more attributes than before.
Should I write more tests?

`@rustbot` label A-attributes
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/on-unimplemented/issue-104140.rs8
-rw-r--r--src/test/ui/on-unimplemented/issue-104140.stderr15
2 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/on-unimplemented/issue-104140.rs b/src/test/ui/on-unimplemented/issue-104140.rs
new file mode 100644
index 00000000000..ade3f727004
--- /dev/null
+++ b/src/test/ui/on-unimplemented/issue-104140.rs
@@ -0,0 +1,8 @@
+#![feature(rustc_attrs)]
+
+trait Foo {}
+
+#[rustc_on_unimplemented] //~ ERROR malformed `rustc_on_unimplemented` attribute input
+impl Foo for u32 {}
+
+fn main() {}
diff --git a/src/test/ui/on-unimplemented/issue-104140.stderr b/src/test/ui/on-unimplemented/issue-104140.stderr
new file mode 100644
index 00000000000..ddb1f50f0bb
--- /dev/null
+++ b/src/test/ui/on-unimplemented/issue-104140.stderr
@@ -0,0 +1,15 @@
+error: malformed `rustc_on_unimplemented` attribute input
+  --> $DIR/issue-104140.rs:5:1
+   |
+LL | #[rustc_on_unimplemented]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: the following are the possible correct uses
+   |
+LL | #[rustc_on_unimplemented = "message"]
+   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LL | #[rustc_on_unimplemented(/*opt*/ message = "...", /*opt*/ label = "...", /*opt*/ note = "...")]
+   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+