INNER CODE UNIT · Rust

discard_punct_spans_tree

intellij-rust/intellij-rust · testData/test-proc-macros/src/lib.rs:196

fn  discard_punct_spans_tree(tt: TokenTree) -> TokenTree {
    match tt {
        TokenTree::Group(g) => {
            let dg = Group::new(g.delimiter(), discard_punct_spans_stream(g.stream()));
            TokenTree::Group(dg)
        }
        TokenTree::Punct(p) => {
            TokenTree::Punct(Punct::new(p.as_char(), p.spacing()))
        }
        TokenTree::Ident(..) | TokenTree::Literal(..) => tt,
    }
}

/// Expands to `compile_error!("the error message")` attached to the first 3 tokens of the item
#[proc_macro_attribute]
pub fn attr_err_at_3_first_tokens(_attr: TokenStream, item: TokenStream) -> TokenStream {
    let mut iter = item.into_iter();
    let t1 = iter.next().unwrap();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…