summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_span/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--compiler/rustc_span/src/lib.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index da31b3462..322c7104b 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -15,7 +15,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(array_windows)]
-#![cfg_attr(bootstrap, feature(let_else))]
#![feature(if_let_guard)]
#![feature(negative_impls)]
#![feature(min_specialization)]
@@ -299,7 +298,11 @@ impl From<PathBuf> for FileName {
#[derive(Clone, Copy, Eq, PartialEq, Hash, Debug)]
pub enum FileNameDisplayPreference {
+ /// Display the path after the application of rewrite rules provided via `--remap-path-prefix`.
+ /// This is appropriate for paths that get embedded into files produced by the compiler.
Remapped,
+ /// Display the path before the application of rewrite rules provided via `--remap-path-prefix`.
+ /// This is appropriate for use in user-facing output (such as diagnostics).
Local,
}
@@ -533,9 +536,6 @@ impl Span {
self.data().with_hi(hi)
}
#[inline]
- pub fn ctxt(self) -> SyntaxContext {
- self.data_untracked().ctxt
- }
pub fn eq_ctxt(self, other: Span) -> bool {
self.data_untracked().ctxt == other.data_untracked().ctxt
}
@@ -1637,11 +1637,7 @@ impl SourceFile {
/// number. If the source_file is empty or the position is located before the
/// first line, `None` is returned.
pub fn lookup_line(&self, pos: BytePos) -> Option<usize> {
- self.lines(|lines| match lines.binary_search(&pos) {
- Ok(idx) => Some(idx),
- Err(0) => None,
- Err(idx) => Some(idx - 1),
- })
+ self.lines(|lines| lines.partition_point(|x| x <= &pos).checked_sub(1))
}
pub fn line_bounds(&self, line_index: usize) -> Range<BytePos> {