diff options
| author | The Miri Cronjob Bot <miri@cron.bot> | 2024-03-30 05:23:38 +0000 |
|---|---|---|
| committer | The Miri Cronjob Bot <miri@cron.bot> | 2024-03-30 05:23:38 +0000 |
| commit | 28521fd2eb40339a20e10c124e60b5efbc31e17b (patch) | |
| tree | 90d2cf40dac38eaa763ff4df5c514b0f86b4b40e /compiler/rustc_span/src | |
| parent | fee9a8eab8f1ae85135f2de7bf8bee815e364665 (diff) | |
| parent | 69fa40cb48384fad7930dce2d9a20d18fe4d1b51 (diff) | |
Merge from rustc
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/lib.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_span/src/source_map.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 8 |
3 files changed, 35 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index 0c974ef4ca3..7ce879807ca 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -271,6 +271,18 @@ impl RealFileName { } } + /// Return the path remmapped or not depending on the [`FileNameDisplayPreference`]. + /// + /// For the purpose of this function, local and short preference are equal. + pub fn to_path(&self, display_pref: FileNameDisplayPreference) -> &Path { + match display_pref { + FileNameDisplayPreference::Local | FileNameDisplayPreference::Short => { + self.local_path_if_available() + } + FileNameDisplayPreference::Remapped => self.remapped_path_if_available(), + } + } + pub fn to_string_lossy(&self, display_pref: FileNameDisplayPreference) -> Cow<'_, str> { match display_pref { FileNameDisplayPreference::Local => self.local_path_if_available().to_string_lossy(), diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index df7635e447d..770624d331d 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -1129,6 +1129,21 @@ impl FilePathMapping { } } + /// Applies any path prefix substitution as defined by the mapping. + /// The return value is the local path with a "virtual path" representing the remapped + /// part if any remapping was performed. + pub fn to_real_filename<'a>(&self, local_path: impl Into<Cow<'a, Path>>) -> RealFileName { + let local_path = local_path.into(); + if let (remapped_path, true) = self.map_prefix(&*local_path) { + RealFileName::Remapped { + virtual_name: remapped_path.into_owned(), + local_path: Some(local_path.into_owned()), + } + } else { + RealFileName::LocalPath(local_path.into_owned()) + } + } + /// Expand a relative path to an absolute path with remapping taken into account. /// Use this when absolute paths are required (e.g. debuginfo or crate metadata). /// diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 1da0b80a610..998b1a5c7ea 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -531,8 +531,15 @@ symbols! { cmp, cmp_max, cmp_min, + cmp_ord_max, + cmp_ord_min, cmp_partialeq_eq, cmp_partialeq_ne, + cmp_partialord_cmp, + cmp_partialord_ge, + cmp_partialord_gt, + cmp_partialord_le, + cmp_partialord_lt, cmpxchg16b_target_feature, cmse_nonsecure_entry, coerce_unsized, @@ -1185,6 +1192,7 @@ symbols! { multiple_supertrait_upcastable, must_not_suspend, must_use, + mut_ref, naked, naked_functions, name, |
