Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 2 Packages Projects Releases Wiki Activity
Files
51b51b51d7931da85280382a81c4dd80c73ca754
rust/tests/ui/proc-macro/auxiliary/amputate-span.rs

10 lines
232 B
Rust
Raw Normal View History

Adjusted diagnostic output so that if there is no `use` in a item sequence, then we just suggest the first legal position where you could inject a use. To do this, I added `inject_use_span` field to `ModSpans`, and populate it in parser (it is the span of the first token found after inner attributes, if any). Then I rewrote the use-suggestion code to utilize it, and threw out some stuff that is now unnecessary with this in place. (I think the result is easier to understand.) Then I added a test of issue 87613.
2022-01-20 14:07:54 -05:00
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_attribute]
pub fn drop_first_token(attr: TokenStream, input: TokenStream) -> TokenStream {
assert!(attr.is_empty());
input.into_iter().skip(1).collect()
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 1305ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API