about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-12-11 10:35:37 +0100
committerCamille GILLOT <gillot.camille@gmail.com>2021-12-11 11:40:38 +0100
commit989d1de91bb357ba7bb360dd85a4a1308862ceb6 (patch)
tree3c0e1a34e4fb53d41457e658a32341d19cdc7eb0
parent9a680037425b730787dc3071bb0837aaeee8d3fb (diff)
downloadrust-989d1de91bb357ba7bb360dd85a4a1308862ceb6.tar.gz
rust-989d1de91bb357ba7bb360dd85a4a1308862ceb6.zip
Add test.
-rw-r--r--src/test/ui/lifetimes/auxiliary/issue-91763-aux.rs47
-rw-r--r--src/test/ui/lifetimes/issue-91763.rs11
-rw-r--r--src/test/ui/lifetimes/issue-91763.stderr14
3 files changed, 72 insertions, 0 deletions
diff --git a/src/test/ui/lifetimes/auxiliary/issue-91763-aux.rs b/src/test/ui/lifetimes/auxiliary/issue-91763-aux.rs
new file mode 100644
index 00000000000..0335f72b784
--- /dev/null
+++ b/src/test/ui/lifetimes/auxiliary/issue-91763-aux.rs
@@ -0,0 +1,47 @@
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+//#![feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)]
+
+extern crate proc_macro;
+
+use proc_macro::{Delimiter, Group, Ident, Punct, Spacing, Span, TokenStream, TokenTree};
+use std::iter::FromIterator;
+
+#[proc_macro_attribute]
+pub fn repro(_args: TokenStream, input: TokenStream) -> TokenStream {
+    let call_site = Span::call_site();
+    let span = input.into_iter().nth(8).unwrap().span();
+
+    //fn f(_: &::std::fmt::Formatter) {}
+    TokenStream::from_iter([
+        TokenTree::Ident(Ident::new("fn", call_site)),
+        TokenTree::Ident(Ident::new("f", call_site)),
+        TokenTree::Group(Group::new(
+            Delimiter::Parenthesis,
+            TokenStream::from_iter([
+                TokenTree::Ident(Ident::new("_", call_site)),
+                TokenTree::Punct(punct(':', Spacing::Alone, call_site)),
+                TokenTree::Punct(punct('&', Spacing::Alone, call_site)),
+                TokenTree::Punct(punct(':', Spacing::Joint, span)),
+                TokenTree::Punct(punct(':', Spacing::Alone, span)),
+                TokenTree::Ident(Ident::new("std", span)),
+                TokenTree::Punct(punct(':', Spacing::Joint, span)),
+                TokenTree::Punct(punct(':', Spacing::Alone, span)),
+                TokenTree::Ident(Ident::new("fmt", span)),
+                TokenTree::Punct(punct(':', Spacing::Joint, span)),
+                TokenTree::Punct(punct(':', Spacing::Alone, span)),
+                TokenTree::Ident(Ident::new("Formatter", span)),
+            ]),
+        )),
+        TokenTree::Group(Group::new(Delimiter::Brace, TokenStream::new())),
+    ])
+}
+
+fn punct(ch: char, spacing: Spacing, span: Span) -> Punct {
+    let mut punct = Punct::new(ch, spacing);
+    punct.set_span(span);
+    punct
+}
diff --git a/src/test/ui/lifetimes/issue-91763.rs b/src/test/ui/lifetimes/issue-91763.rs
new file mode 100644
index 00000000000..2e8807fe639
--- /dev/null
+++ b/src/test/ui/lifetimes/issue-91763.rs
@@ -0,0 +1,11 @@
+// aux-build:issue-91763-aux.rs
+
+#![deny(elided_lifetimes_in_paths)]
+
+extern crate issue_91763_aux;
+
+#[issue_91763_aux::repro]
+fn f() -> Ptr<Thing>;
+//~^ ERROR hidden lifetime parameters in types are deprecated
+
+fn main() {}
diff --git a/src/test/ui/lifetimes/issue-91763.stderr b/src/test/ui/lifetimes/issue-91763.stderr
new file mode 100644
index 00000000000..1b1912c8e45
--- /dev/null
+++ b/src/test/ui/lifetimes/issue-91763.stderr
@@ -0,0 +1,14 @@
+error: hidden lifetime parameters in types are deprecated
+  --> $DIR/issue-91763.rs:8:20
+   |
+LL | fn f() -> Ptr<Thing>;
+   |                    ^ expected named lifetime parameter
+   |
+note: the lint level is defined here
+  --> $DIR/issue-91763.rs:3:9
+   |
+LL | #![deny(elided_lifetimes_in_paths)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+