summaryrefslogtreecommitdiffstats
path: root/tests/incremental/hygiene/auxiliary
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:58 +0000
commita4b7ed7a42c716ab9f05e351f003d589124fd55d (patch)
treeb620cd3f223850b28716e474e80c58059dca5dd4 /tests/incremental/hygiene/auxiliary
parentAdding upstream version 1.67.1+dfsg1. (diff)
downloadrustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.tar.xz
rustc-a4b7ed7a42c716ab9f05e351f003d589124fd55d.zip
Adding upstream version 1.68.2+dfsg1.upstream/1.68.2+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/incremental/hygiene/auxiliary')
-rw-r--r--tests/incremental/hygiene/auxiliary/cached_hygiene.rs36
1 files changed, 36 insertions, 0 deletions
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!();
+}