summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_span/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_span/src/lib.rs')
-rw-r--r--compiler/rustc_span/src/lib.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index 322c7104b..cef4c6f79 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -78,10 +78,10 @@ use sha2::Sha256;
#[cfg(test)]
mod tests;
-// Per-session global variables: this struct is stored in thread-local storage
-// in such a way that it is accessible without any kind of handle to all
-// threads within the compilation session, but is not accessible outside the
-// session.
+/// Per-session global variables: this struct is stored in thread-local storage
+/// in such a way that it is accessible without any kind of handle to all
+/// threads within the compilation session, but is not accessible outside the
+/// session.
pub struct SessionGlobals {
symbol_interner: symbol::Interner,
span_interner: Lock<span_encoding::SpanInterner>,
@@ -217,9 +217,7 @@ impl RealFileName {
pub fn local_path(&self) -> Option<&Path> {
match self {
RealFileName::LocalPath(p) => Some(p),
- RealFileName::Remapped { local_path: p, virtual_name: _ } => {
- p.as_ref().map(PathBuf::as_path)
- }
+ RealFileName::Remapped { local_path, virtual_name: _ } => local_path.as_deref(),
}
}
@@ -240,7 +238,7 @@ impl RealFileName {
pub fn remapped_path_if_available(&self) -> &Path {
match self {
RealFileName::LocalPath(p)
- | RealFileName::Remapped { local_path: _, virtual_name: p } => &p,
+ | RealFileName::Remapped { local_path: _, virtual_name: p } => p,
}
}
@@ -361,8 +359,8 @@ impl FileName {
FileNameDisplay { inner: self, display_pref: FileNameDisplayPreference::Remapped }
}
- // This may include transient local filesystem information.
- // Must not be embedded in build outputs.
+ /// This may include transient local filesystem information.
+ /// Must not be embedded in build outputs.
pub fn prefer_local(&self) -> FileNameDisplay<'_> {
FileNameDisplay { inner: self, display_pref: FileNameDisplayPreference::Local }
}
@@ -753,7 +751,7 @@ impl Span {
/// Checks if a span is "internal" to a macro in which `unsafe`
/// can be used without triggering the `unsafe_code` lint.
- // (that is, a macro marked with `#[allow_internal_unsafe]`).
+ /// (that is, a macro marked with `#[allow_internal_unsafe]`).
pub fn allows_unsafe(self) -> bool {
self.ctxt().outer_expn_data().allow_internal_unsafe
}