Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/ui/proc-macro/auxiliary/identity-attr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ force-host
//@ no-prefer-dynamic
#![crate_type = "proc-macro"]

extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_attribute]
pub fn id(_attr: TokenStream, item: TokenStream) -> TokenStream {
item
}
18 changes: 18 additions & 0 deletions tests/ui/proc-macro/macro-def-in-attr-input.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//@ proc-macro: identity-attr.rs
//@ edition: 2021
//@ check-pass

// `gate_proc_macro_input` walks attribute-macro input with the
// `GateProcMacroInput` visitor; a `macro_rules!` definition inside the
// annotated item makes that walk hit `visit_macro_def`, which nothing
// else in the suite exercises.

#[identity_attr::id]
pub fn f() {
macro_rules! m {
() => {};
}
m!();
}

fn main() {}
8 changes: 7 additions & 1 deletion tests/ui/unpretty/exhaustive.expanded.stdout
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#![feature(prelude_import)]
//@ revisions: expanded hir
//@ revisions: expanded hir harness
//@[expanded]compile-flags: -Zunpretty=expanded
//@[expanded]check-pass
//@[hir]compile-flags: -Zunpretty=hir
//@[hir]check-fail
//@[harness]compile-flags: -Zunpretty=expanded --test
//@[harness]check-pass
//@ edition:2024

// Note: the HIR revision includes a `.stderr` file because there are some
// errors that only occur once we get past the AST.
// The `harness` revision runs test-harness expansion (`--test`) over this
// file, so the `InnerItemLinter` and `EntryPointCleaner` visitors in
// rustc_builtin_macros walk the complete AST. `-Zunpretty=expanded` stops
// before the analyses that make the `hir` revision fail.

#![feature(auto_traits)]
#![feature(box_patterns)]
Expand Down
Loading
Loading