diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/remap-path-prefix.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/remap-path-prefix.stderr | 9 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/macro_use.rs | 7 |
3 files changed, 20 insertions, 5 deletions
diff --git a/src/test/ui/remap-path-prefix.rs b/src/test/ui/remap-path-prefix.rs new file mode 100644 index 00000000000..2eef9709977 --- /dev/null +++ b/src/test/ui/remap-path-prefix.rs @@ -0,0 +1,9 @@ +// compile-flags: --remap-path-prefix={{src-base}}=remapped + +fn main() { + // We cannot actually put an ERROR marker here because + // the file name in the error message is not what the + // test framework expects (since the filename gets remapped). + // We still test the expected error in the stderr file. + ferris +} diff --git a/src/test/ui/remap-path-prefix.stderr b/src/test/ui/remap-path-prefix.stderr new file mode 100644 index 00000000000..ad6a35d1256 --- /dev/null +++ b/src/test/ui/remap-path-prefix.stderr @@ -0,0 +1,9 @@ +error[E0425]: cannot find value `ferris` in this scope + --> remapped/remap-path-prefix.rs:8:5 + | +LL | ferris + | ^^^^^^ not found in this scope + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. diff --git a/src/tools/clippy/clippy_lints/src/macro_use.rs b/src/tools/clippy/clippy_lints/src/macro_use.rs index a371f8bbd3c..39f7ade3f81 100644 --- a/src/tools/clippy/clippy_lints/src/macro_use.rs +++ b/src/tools/clippy/clippy_lints/src/macro_use.rs @@ -47,11 +47,8 @@ pub struct MacroRefData { impl MacroRefData { pub fn new(name: String, callee: Span, cx: &LateContext<'_>) -> Self { - let mut path = cx - .sess() - .source_map() - .span_to_filename(callee) - .prefer_local() + let sm = cx.sess().source_map(); + let mut path = sm.filename_for_diagnostics(&sm.span_to_filename(callee)) .to_string(); // std lib paths are <::std::module::file type> |
