[−][src]Struct syntax::source_map::SourceMap
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Fields
files: Lock<SourceMapFiles>
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
file_loader: Box<dyn FileLoader + 'static + Sync + Send>
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
path_mapping: FilePathMapping
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Methods
impl SourceMap
[src]
pub fn new(path_mapping: FilePathMapping) -> SourceMap
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn with_file_loader(
file_loader: Box<dyn FileLoader + 'static + Sync + Send>,
path_mapping: FilePathMapping
) -> SourceMap
[src]
file_loader: Box<dyn FileLoader + 'static + Sync + Send>,
path_mapping: FilePathMapping
) -> SourceMap
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn path_mapping(&self) -> &FilePathMapping
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn file_exists(&self, path: &Path) -> bool
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn load_file(&self, path: &Path) -> Result<Rc<SourceFile>, Error>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn load_binary_file(&self, path: &Path) -> Result<Vec<u8>, Error>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Loads source file as a binary blob.
Unlike load_file
, guarantees that no normalization like BOM-removal
takes place.
pub fn files(&self) -> RefMut<Vec<Rc<SourceFile>>>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn source_file_by_stable_id(
&self,
stable_id: StableSourceFileId
) -> Option<Rc<SourceFile>>
[src]
&self,
stable_id: StableSourceFileId
) -> Option<Rc<SourceFile>>
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn new_source_file(&self, filename: FileName, src: String) -> Rc<SourceFile>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Creates a new SourceFile
.
If a file already exists in the SourceMap
with the same ID, that file is returned
unmodified.
pub fn new_imported_source_file(
&self,
filename: FileName,
name_was_remapped: bool,
crate_of_origin: u32,
src_hash: u128,
name_hash: u128,
source_len: usize,
file_local_lines: Vec<BytePos>,
file_local_multibyte_chars: Vec<MultiByteChar>,
file_local_non_narrow_chars: Vec<NonNarrowChar>,
file_local_normalized_pos: Vec<NormalizedPos>
) -> Rc<SourceFile>
[src]
&self,
filename: FileName,
name_was_remapped: bool,
crate_of_origin: u32,
src_hash: u128,
name_hash: u128,
source_len: usize,
file_local_lines: Vec<BytePos>,
file_local_multibyte_chars: Vec<MultiByteChar>,
file_local_non_narrow_chars: Vec<NonNarrowChar>,
file_local_normalized_pos: Vec<NormalizedPos>
) -> Rc<SourceFile>
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Allocates a new SourceFile
representing a source file from an external
crate. The source code of such an "imported SourceFile
" is not available,
but we still know enough to generate accurate debuginfo location
information for things inlined from other crates.
pub fn mk_substr_filename(&self, sp: Span) -> String
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn doctest_offset_line(&self, file: &FileName, orig: usize) -> usize
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn lookup_char_pos(&self, pos: BytePos) -> Loc
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Looks up source information about a BytePos
.
pub fn lookup_line(
&self,
pos: BytePos
) -> Result<SourceFileAndLine, Rc<SourceFile>>
[src]
&self,
pos: BytePos
) -> Result<SourceFileAndLine, Rc<SourceFile>>
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Returns Some(span)
, a union of the LHS and RHS span. The LHS must precede the RHS. If
there are gaps between LHS and RHS, the resulting union will cross these gaps.
For this to work,
- the syntax contexts of both spans much match,
- the LHS span needs to end on the same line the RHS span begins,
- the LHS span must start at or before the RHS span.
pub fn span_to_string(&self, sp: Span) -> String
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn span_to_filename(&self, sp: Span) -> FileName
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn span_to_unmapped_path(&self, sp: Span) -> FileName
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn is_multiline(&self, sp: Span) -> bool
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn span_to_lines(&self, sp: Span) -> Result<FileLines, SpanLinesError>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Returns the source snippet as String
corresponding to the given Span
.
pub fn span_to_margin(&self, sp: Span) -> Option<usize>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn span_to_prev_source(&self, sp: Span) -> Result<String, SpanSnippetError>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Returns the source snippet as String
before the given Span
.
pub fn span_extend_to_prev_char(&self, sp: Span, c: char) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Extends the given Span
to just after the previous occurrence of c
. Return the same span
if no character could be found or if an error occurred while retrieving the code snippet.
pub fn span_extend_to_prev_str(
&self,
sp: Span,
pat: &str,
accept_newlines: bool
) -> Span
[src]
&self,
sp: Span,
pat: &str,
accept_newlines: bool
) -> Span
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Extends the given Span
to just after the previous occurrence of pat
when surrounded by
whitespace. Returns the same span if no character could be found or if an error occurred
while retrieving the code snippet.
pub fn span_until_char(&self, sp: Span, c: char) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Given a Span
, tries to get a shorter span ending before the first occurrence of char
c
.
pub fn span_through_char(&self, sp: Span, c: char) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Given a Span
, tries to get a shorter span ending just after the first occurrence of char
c
.
pub fn span_until_non_whitespace(&self, sp: Span) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Given a Span
, gets a new Span
covering the first token and all its trailing whitespace
or the original Span
.
If sp
points to "let mut x"
, then a span pointing at "let "
will be returned.
pub fn span_until_whitespace(&self, sp: Span) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Given a Span
, gets a new Span
covering the first token without its trailing whitespace
or the original Span
in case of error.
If sp
points to "let mut x"
, then a span pointing at "let"
will be returned.
pub fn span_take_while<P>(&self, sp: Span, predicate: P) -> Span where
P: for<'r> FnMut(&'r char) -> bool,
[src]
P: for<'r> FnMut(&'r char) -> bool,
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Given a Span
, gets a shorter one until predicate
yields false
.
pub fn def_span(&self, sp: Span) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn start_point(&self, sp: Span) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Returns a new span representing just the start point of this span.
pub fn end_point(&self, sp: Span) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Returns a new span representing just the end point of this span.
pub fn next_point(&self, sp: Span) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Returns a new span representing the next character after the end-point of this span.
pub fn get_source_file(&self, filename: &FileName) -> Option<Rc<SourceFile>>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn lookup_byte_offset(&self, bpos: BytePos) -> SourceFileAndBytePos
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
For a global BytePos
, computes the local offset within the containing SourceFile
.
pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Converts an absolute BytePos
to a CharPos
relative to the SourceFile
.
pub fn lookup_source_file_idx(&self, pos: BytePos) -> usize
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn count_lines(&self) -> usize
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn generate_fn_name_span(&self, span: Span) -> Option<Span>
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn generate_local_type_param_snippet(
&self,
span: Span
) -> Option<(Span, String)>
[src]
&self,
span: Span
) -> Option<(Span, String)>
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Takes the span of a type parameter in a function signature and try to generate a span for the function name (with generics) and a new snippet for this span with the pointed type parameter as a new local type parameter.
For instance:
// Given span fn my_function(param: T) // ^ Original span // Result fn my_function(param: T) // ^^^^^^^^^^^ Generated span with snippet `my_function<T>`
Attention: The method used is very fragile since it essentially duplicates the work of the
parser. If you need to use this function or something similar, please consider updating the
SourceMap
functions and this function to something more robust.
pub fn ensure_source_file_source_present(
&self,
source_file: Rc<SourceFile>
) -> bool
[src]
&self,
source_file: Rc<SourceFile>
) -> bool
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
pub fn call_span_if_macro(&self, sp: Span) -> Span
[src]
⚙️ This is an internal compiler API. (rustc_private
)
This crate is being loaded from the sysroot, a permanently unstable location for private compiler dependencies. It is not intended for general use. Prefer using a public version of this crate from crates.io via Cargo.toml
.
Auto Trait Implementations
impl !RefUnwindSafe for SourceMap
impl !Send for SourceMap
impl !Sync for SourceMap
impl Unpin for SourceMap
impl !UnwindSafe for SourceMap
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<E> SpecializationError for E
[src]
default fn not_found<S, T>(
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
[src]
trait_name: &'static str,
method_name: &'static str
) -> E where
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,