Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/rustc_span/src/source_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ impl SourceMap {
/// information for things inlined from other crates.
pub fn new_imported_source_file(
&self,
filename: FileName,
mut filename: FileName,
src_hash: SourceFileHash,
checksum_hash: Option<SourceFileHash>,
stable_id: StableSourceFileId,
Expand All @@ -381,6 +381,10 @@ impl SourceMap {
normalized_pos: Vec<NormalizedPos>,
metadata_index: u32,
) -> Arc<SourceFile> {
if let FileName::Real(name) = &mut filename {
let path = name.path(RemapPathScopeComponents::DIAGNOSTICS);
*name = self.path_mapping.to_real_filename(&self.working_dir, path);
}
let normalized_source_len = RelativeBytePos::from_u32(normalized_source_len);

let source_file = SourceFile {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ help: the trait `std::fmt::Display` is not implemented for `A`
LL | struct A;
| ^^^^^^^^
note: required by a bound in `Trait`
--> $DIR/auxiliary/trait.rs:LL:COL
--> remapped/errors/auxiliary/trait.rs:LL:COL
|
LL | pub trait Trait: std::fmt::Display {}
| ^^^^^^^^^^^^^^^^^ required by this bound in `Trait`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ LL | struct A;
| ^^^^^^^^
note: required by a bound in `Trait`
--> remapped/errors/auxiliary/trait-diag.rs:LL:COL
|
LL | pub trait Trait: std::fmt::Display {}
| ^^^^^^^^^^^^^^^^^ required by this bound in `Trait`

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ LL | struct A;
| ^^^^^^^^
note: required by a bound in `Trait`
--> remapped/errors/auxiliary/trait-diag.rs:LL:COL
|
LL | pub trait Trait: std::fmt::Display {}
| ^^^^^^^^^^^^^^^^^ required by this bound in `Trait`

error: aborting due to 1 previous error

Expand Down
7 changes: 3 additions & 4 deletions tests/ui/errors/remap-path-prefix-reverse.local-self.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
error[E0423]: expected value, found struct `remapped_dep::SomeStruct`
--> $DIR/remap-path-prefix-reverse.rs:15:13
--> $DIR/remap-path-prefix-reverse.rs:14:13
|
LL | let _ = remapped_dep::SomeStruct;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `remapped_dep::SomeStruct {}`
|
::: remapped-aux/remapped_dep.rs:4:1
--> remapped-aux/remapped_dep.rs:4:0
|
LL | pub struct SomeStruct {} // This line should be show as part of the error.
| --------------------- `remapped_dep::SomeStruct` defined here
= note: `remapped_dep::SomeStruct` defined here

error: aborting due to 1 previous error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
error[E0423]: expected value, found struct `remapped_dep::SomeStruct`
--> $DIR/remap-path-prefix-reverse.rs:15:13
--> $DIR/remap-path-prefix-reverse.rs:14:13
|
LL | let _ = remapped_dep::SomeStruct;
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `remapped_dep::SomeStruct {}`
|
::: remapped-aux/remapped_dep.rs:4:1
--> remapped-aux/remapped_dep.rs:4:0
|
LL | pub struct SomeStruct {} // This line should be show as part of the error.
| --------------------- `remapped_dep::SomeStruct` defined here
= note: `remapped_dep::SomeStruct` defined here

error: aborting due to 1 previous error

Expand Down
1 change: 0 additions & 1 deletion tests/ui/errors/remap-path-prefix-reverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//@ [remapped-self] remap-src-base

// Verify that the expected source code is shown.
//@ error-pattern: pub struct SomeStruct {} // This line should be show

extern crate remapped_dep;

Expand Down
3 changes: 0 additions & 3 deletions tests/ui/errors/remap-path-prefix-sysroot.with-remap.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ LL | self.thread.join().unwrap();
|
note: `JoinHandle::<T>::join` takes ownership of the receiver `self`, which moves `self.thread`
--> remapped/library/std/src/thread/join_handle.rs:LL:COL
|
LL | pub fn join(self) -> Result<T> {
| ^^^^

error: aborting due to 1 previous error

Expand Down
Loading