about summary refs log tree commit diff
path: root/tests/ui/errors/remap-path-prefix-macro.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-08 21:32:19 +0000
committerbors <bors@rust-lang.org>2025-05-08 21:32:19 +0000
commit667247db71ea18c4130dd018d060e7f09d589490 (patch)
tree459db133cc02cf8f3dc686d3313c95ecb2a2fddc /tests/ui/errors/remap-path-prefix-macro.rs
parent50aa04180709189a03dde5fd1c05751b2625ed37 (diff)
parent4e4d6ad43ccfd786881cc777addb129dd4f487e3 (diff)
downloadrust-667247db71ea18c4130dd018d060e7f09d589490.tar.gz
rust-667247db71ea18c4130dd018d060e7f09d589490.zip
Auto merge of #140818 - matthiaskrgr:rollup-5eaotr2, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #140095 (Eliminate `word_and_empty` methods.)
 - #140341 (Clarify black_box warning a bit)
 - #140684 (Only include `dyn Trait<Assoc = ...>` associated type bounds for `Self: Sized` associated types if they are provided)
 - #140707 (Structurally normalize in range pattern checking in HIR typeck)
 - #140716 (Improve `-Zremap-path-scope` tests with dependency)
 - #140800 (Make `rustdoc-tempdir-removal` run-make tests work on other platforms than linux)
 - #140802 (Add release notes for 1.87.0)
 - #140811 (Enable triagebot note functionality for rust-lang/rust)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui/errors/remap-path-prefix-macro.rs')
-rw-r--r--tests/ui/errors/remap-path-prefix-macro.rs47
1 files changed, 41 insertions, 6 deletions
diff --git a/tests/ui/errors/remap-path-prefix-macro.rs b/tests/ui/errors/remap-path-prefix-macro.rs
index 665156027c9..3e93843f916 100644
--- a/tests/ui/errors/remap-path-prefix-macro.rs
+++ b/tests/ui/errors/remap-path-prefix-macro.rs
@@ -1,12 +1,47 @@
+// This test exercises `-Zremap-path-scope`, macros (like file!()) and dependency.
+//
+// We test different combinations with/without remap in deps, with/without remap in
+// this crate but always in deps and always here but never in deps.
+
 //@ run-pass
 //@ check-run-results
 
-//@ revisions: normal with-macro-scope without-macro-scope
-//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
-//@ [with-macro-scope]compile-flags: -Zremap-path-scope=macro,diagnostics
-//@ [without-macro-scope]compile-flags: -Zremap-path-scope=diagnostics
-// no-remap-src-base: Manually remap, so the remapped path remains in .stderr file.
+//@ revisions: with-diag-in-deps with-macro-in-deps with-debuginfo-in-deps
+//@ revisions: only-diag-in-deps only-macro-in-deps only-debuginfo-in-deps
+//@ revisions: not-macro-in-deps
+
+//@[with-diag-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
+//@[with-macro-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
+//@[with-debuginfo-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
+//@[not-macro-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
+
+//@[with-diag-in-deps] compile-flags: -Zremap-path-scope=diagnostics
+//@[with-macro-in-deps] compile-flags: -Zremap-path-scope=macro
+//@[with-debuginfo-in-deps] compile-flags: -Zremap-path-scope=debuginfo
+//@[not-macro-in-deps] compile-flags: -Zremap-path-scope=macro
+
+//@[with-diag-in-deps] aux-build:file-diag.rs
+//@[with-macro-in-deps] aux-build:file-macro.rs
+//@[with-debuginfo-in-deps] aux-build:file-debuginfo.rs
+//@[only-diag-in-deps] aux-build:file-diag.rs
+//@[only-macro-in-deps] aux-build:file-macro.rs
+//@[only-debuginfo-in-deps] aux-build:file-debuginfo.rs
+//@[not-macro-in-deps] aux-build:file.rs
+
+#[cfg(any(with_diag_in_deps, only_diag_in_deps))]
+extern crate file_diag as file;
+
+#[cfg(any(with_macro_in_deps, only_macro_in_deps))]
+extern crate file_macro as file;
+
+#[cfg(any(with_debuginfo_in_deps, only_debuginfo_in_deps))]
+extern crate file_debuginfo as file;
+
+#[cfg(not_macro_in_deps)]
+extern crate file;
 
 fn main() {
-    println!("{}", file!());
+    println!("file::my_file!() = {}", file::my_file!());
+    println!("file::file() = {}", file::file());
+    println!("file!() = {}", file!());
 }