From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../hygiene/auxiliary/cached_hygiene.rs | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/incremental/hygiene/auxiliary/cached_hygiene.rs (limited to 'tests/incremental/hygiene/auxiliary') diff --git a/tests/incremental/hygiene/auxiliary/cached_hygiene.rs b/tests/incremental/hygiene/auxiliary/cached_hygiene.rs new file mode 100644 index 000000000..b31f60e97 --- /dev/null +++ b/tests/incremental/hygiene/auxiliary/cached_hygiene.rs @@ -0,0 +1,36 @@ +// revisions:rpass1 rpass2 +// compile-flags: -Z query-dep-graph + +// We use #[inline(always)] to ensure that the downstream crate +// will always load the MIR for these functions + +#![feature(rustc_attrs)] + +#[allow(unused)] +macro_rules! first_macro { + () => { + println!("New call!"); + } +} + +#[rustc_clean(except="hir_owner_nodes,typeck,optimized_mir,promoted_mir", cfg="rpass2")] +#[inline(always)] +pub fn changed_fn() { + // This will cause additional hygiene to be generate, + // which will cause the SyntaxContext/ExpnId raw ids to be + // different when we write out `my_fn` to the crate metadata. + #[cfg(rpass2)] + first_macro!(); +} + +macro_rules! print_loc { + () => { + println!("Caller loc: {}", std::panic::Location::caller()); + } +} + +#[rustc_clean(cfg="rpass2")] +#[inline(always)] +pub fn unchanged_fn() { + print_loc!(); +} -- cgit v1.2.3