@@ -113,17 +113,16 @@ pub fn with_default_session_globals<R>(f: impl FnOnce() -> R) -> R {
113113// deserialization.
114114scoped_tls:: scoped_thread_local!( pub static SESSION_GLOBALS : SessionGlobals ) ;
115115
116- // FIXME: Perhaps this should not implement Rustc{Decodable, Encodable}
117- //
118116// FIXME: We should use this enum or something like it to get rid of the
119117// use of magic `/rust/1.x/...` paths across the board.
120118#[ derive( Debug , Eq , PartialEq , Clone , Ord , PartialOrd , Hash ) ]
121119#[ derive( HashStable_Generic , Decodable , Encodable ) ]
122120pub enum RealFileName {
123- Named ( PathBuf ) ,
124- /// For de-virtualized paths (namely paths into libstd that have been mapped
125- /// to the appropriate spot on the local host's file system),
126- Devirtualized {
121+ LocalPath ( PathBuf ) ,
122+ /// For remapped paths (namely paths into libstd that have been mapped
123+ /// to the appropriate spot on the local host's file system, and local file
124+ /// system paths that have been remapped with `FilePathMapping`),
125+ Remapped {
127126 /// `local_path` is the (host-dependent) local path to the file.
128127 local_path : PathBuf ,
129128 /// `virtual_name` is the stable path rustc will store internally within
@@ -137,28 +136,28 @@ impl RealFileName {
137136 /// Avoid embedding this in build artifacts; see `stable_name()` for that.
138137 pub fn local_path ( & self ) -> & Path {
139138 match self {
140- RealFileName :: Named ( p)
141- | RealFileName :: Devirtualized { local_path : p, virtual_name : _ } => & p,
139+ RealFileName :: LocalPath ( p)
140+ | RealFileName :: Remapped { local_path : p, virtual_name : _ } => & p,
142141 }
143142 }
144143
145144 /// Returns the path suitable for reading from the file system on the local host.
146145 /// Avoid embedding this in build artifacts; see `stable_name()` for that.
147146 pub fn into_local_path ( self ) -> PathBuf {
148147 match self {
149- RealFileName :: Named ( p)
150- | RealFileName :: Devirtualized { local_path : p, virtual_name : _ } => p,
148+ RealFileName :: LocalPath ( p)
149+ | RealFileName :: Remapped { local_path : p, virtual_name : _ } => p,
151150 }
152151 }
153152
154153 /// Returns the path suitable for embedding into build artifacts. Note that
155- /// a virtualized path will not correspond to a valid file system path; see
154+ /// a remapped path will not correspond to a valid file system path; see
156155 /// `local_path()` for something that is more likely to return paths into the
157156 /// local host file system.
158157 pub fn stable_name ( & self ) -> & Path {
159158 match self {
160- RealFileName :: Named ( p)
161- | RealFileName :: Devirtualized { local_path : _, virtual_name : p } => & p,
159+ RealFileName :: LocalPath ( p)
160+ | RealFileName :: Remapped { local_path : _, virtual_name : p } => & p,
162161 }
163162 }
164163}
@@ -214,7 +213,7 @@ impl std::fmt::Display for FileName {
214213impl From < PathBuf > for FileName {
215214 fn from ( p : PathBuf ) -> Self {
216215 assert ! ( !p. to_string_lossy( ) . ends_with( '>' ) ) ;
217- FileName :: Real ( RealFileName :: Named ( p) )
216+ FileName :: Real ( RealFileName :: LocalPath ( p) )
218217 }
219218}
220219
@@ -1124,11 +1123,6 @@ pub struct SourceFile {
11241123 /// originate from files has names between angle brackets by convention
11251124 /// (e.g., `<anon>`).
11261125 pub name : FileName ,
1127- /// `true` if the `name` field above has been modified by `--remap-path-prefix`.
1128- pub name_was_remapped : bool ,
1129- /// The unmapped path of the file that the source came from.
1130- /// Set to `None` if the `SourceFile` was imported from an external crate.
1131- pub unmapped_path : Option < FileName > ,
11321126 /// The complete source code.
11331127 pub src : Option < Lrc < String > > ,
11341128 /// The source code's hash.
@@ -1158,7 +1152,6 @@ impl<S: Encoder> Encodable<S> for SourceFile {
11581152 fn encode ( & self , s : & mut S ) -> Result < ( ) , S :: Error > {
11591153 s. emit_struct ( "SourceFile" , 8 , |s| {
11601154 s. emit_struct_field ( "name" , 0 , |s| self . name . encode ( s) ) ?;
1161- s. emit_struct_field ( "name_was_remapped" , 1 , |s| self . name_was_remapped . encode ( s) ) ?;
11621155 s. emit_struct_field ( "src_hash" , 2 , |s| self . src_hash . encode ( s) ) ?;
11631156 s. emit_struct_field ( "start_pos" , 3 , |s| self . start_pos . encode ( s) ) ?;
11641157 s. emit_struct_field ( "end_pos" , 4 , |s| self . end_pos . encode ( s) ) ?;
@@ -1233,8 +1226,6 @@ impl<D: Decoder> Decodable<D> for SourceFile {
12331226 fn decode ( d : & mut D ) -> Result < SourceFile , D :: Error > {
12341227 d. read_struct ( "SourceFile" , 8 , |d| {
12351228 let name: FileName = d. read_struct_field ( "name" , 0 , |d| Decodable :: decode ( d) ) ?;
1236- let name_was_remapped: bool =
1237- d. read_struct_field ( "name_was_remapped" , 1 , |d| Decodable :: decode ( d) ) ?;
12381229 let src_hash: SourceFileHash =
12391230 d. read_struct_field ( "src_hash" , 2 , |d| Decodable :: decode ( d) ) ?;
12401231 let start_pos: BytePos =
@@ -1278,8 +1269,6 @@ impl<D: Decoder> Decodable<D> for SourceFile {
12781269 let cnum: CrateNum = d. read_struct_field ( "cnum" , 10 , |d| Decodable :: decode ( d) ) ?;
12791270 Ok ( SourceFile {
12801271 name,
1281- name_was_remapped,
1282- unmapped_path : None ,
12831272 start_pos,
12841273 end_pos,
12851274 src : None ,
@@ -1307,8 +1296,6 @@ impl fmt::Debug for SourceFile {
13071296impl SourceFile {
13081297 pub fn new (
13091298 name : FileName ,
1310- name_was_remapped : bool ,
1311- unmapped_path : FileName ,
13121299 mut src : String ,
13131300 start_pos : BytePos ,
13141301 hash_kind : SourceFileHashAlgorithm ,
@@ -1330,8 +1317,6 @@ impl SourceFile {
13301317
13311318 SourceFile {
13321319 name,
1333- name_was_remapped,
1334- unmapped_path : Some ( unmapped_path) ,
13351320 src : Some ( Lrc :: new ( src) ) ,
13361321 src_hash,
13371322 external_src : Lock :: new ( ExternalSource :: Unneeded ) ,
0 commit comments