about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-11-17 13:36:15 +0900
committerGitHub <noreply@github.com>2019-11-17 13:36:15 +0900
commit842612fcc00a679688bbc1bb74bb7480d12a0ac7 (patch)
tree405f342cf4b04790c542f24dc4e3dd6c07b13a6c /src/test
parent54998d1b3facdb684795c586d7a1e82582e32d27 (diff)
parent91aadf030548214da5a8f39a1b1dbd21db125625 (diff)
downloadrust-842612fcc00a679688bbc1bb74bb7480d12a0ac7.tar.gz
rust-842612fcc00a679688bbc1bb74bb7480d12a0ac7.zip
Rollup merge of #66381 - Centril:66340, r=petrochenkov
find_deprecation: deprecation attr may be ill-formed meta.

Fixes #66340.

r? @petrochenkov
cc @pnkfelix
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs11
-rw-r--r--src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr8
2 files changed, 19 insertions, 0 deletions
diff --git a/src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs b/src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs
new file mode 100644
index 00000000000..c0cde75d4ca
--- /dev/null
+++ b/src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs
@@ -0,0 +1,11 @@
+// The original problem in #66340 was that `find_deprecation_generic`
+// called `attr.meta().unwrap()` under the assumption that the attribute
+// was a well-formed `MetaItem`.
+
+fn main() {
+    foo()
+}
+
+#[deprecated(note = test)]
+//~^ ERROR expected unsuffixed literal or identifier, found `test`
+fn foo() {}
diff --git a/src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr b/src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr
new file mode 100644
index 00000000000..24178faf8de
--- /dev/null
+++ b/src/test/ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.stderr
@@ -0,0 +1,8 @@
+error: expected unsuffixed literal or identifier, found `test`
+  --> $DIR/issue-66340-deprecated-attr-non-meta-grammar.rs:9:21
+   |
+LL | #[deprecated(note = test)]
+   |                     ^^^^
+
+error: aborting due to previous error
+