Skip to content

Commit 1aa0dd2

Browse files
authored
Rollup merge of rust-lang#140716 - Urgau:improve-remap_scope-tests, r=jieyouxu
Improve `-Zremap-path-scope` tests with dependency This PR greatly improves our coverage of `-Zremap-path-scope` for diagnostic paths and macros with dependencies. r? `@jieyouxu` (since we talked about it) try-job: x86_64-msvc-1
2 parents f7168af + f959039 commit 1aa0dd2

27 files changed

+292
-9
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
2+
//@ compile-flags: -Zremap-path-scope=debuginfo
3+
4+
#[macro_export]
5+
macro_rules! my_file {
6+
() => { file!() }
7+
}
8+
9+
pub fn file() -> &'static str {
10+
file!()
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
2+
//@ compile-flags: -Zremap-path-scope=diagnostics
3+
4+
#[macro_export]
5+
macro_rules! my_file {
6+
() => { file!() }
7+
}
8+
9+
pub fn file() -> &'static str {
10+
file!()
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
2+
//@ compile-flags: -Zremap-path-scope=macro
3+
4+
#[macro_export]
5+
macro_rules! my_file {
6+
() => { file!() }
7+
}
8+
9+
pub fn file() -> &'static str {
10+
file!()
11+
}

tests/ui/errors/auxiliary/file.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#[macro_export]
2+
macro_rules! my_file {
3+
() => { file!() }
4+
}
5+
6+
pub fn file() -> &'static str {
7+
file!()
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
2+
//@ compile-flags: -Zremap-path-scope=debuginfo
3+
4+
pub trait Trait: std::fmt::Display {}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
2+
//@ compile-flags: -Zremap-path-scope=diagnostics
3+
4+
pub trait Trait: std::fmt::Display {}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
2+
//@ compile-flags: -Zremap-path-scope=macro
3+
4+
pub trait Trait: std::fmt::Display {}

tests/ui/errors/auxiliary/trait.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub trait Trait: std::fmt::Display {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0277]: `A` doesn't implement `std::fmt::Display`
2+
--> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL
3+
|
4+
LL | impl r#trait::Trait for A {}
5+
| ^ `A` cannot be formatted with the default formatter
6+
|
7+
= help: the trait `std::fmt::Display` is not implemented for `A`
8+
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
9+
note: required by a bound in `Trait`
10+
--> $DIR/auxiliary/trait.rs:LL:COL
11+
|
12+
LL | pub trait Trait: std::fmt::Display {}
13+
| ^^^^^^^^^^^^^^^^^ required by this bound in `Trait`
14+
15+
error: aborting due to 1 previous error
16+
17+
For more information about this error, try `rustc --explain E0277`.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0277]: `A` doesn't implement `std::fmt::Display`
2+
--> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
3+
|
4+
LL | impl r#trait::Trait for A {}
5+
| ^ `A` cannot be formatted with the default formatter
6+
|
7+
= help: the trait `std::fmt::Display` is not implemented for `A`
8+
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
9+
note: required by a bound in `Trait`
10+
--> $DIR/auxiliary/trait-debuginfo.rs:LL:COL
11+
|
12+
LL | pub trait Trait: std::fmt::Display {}
13+
| ^^^^^^^^^^^^^^^^^ required by this bound in `Trait`
14+
15+
error: aborting due to 1 previous error
16+
17+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)