-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #91764 - cjgillot:elide-anyway, r=jackh726
Do not ICE when suggesting elided lifetimes on non-existent spans. Fixes #91763 r? `@jackh726`
- Loading branch information
Showing
6 changed files
with
78 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|