pub struct ParseSess {
dcx: DiagCtxt,
pub edition: Edition,
pub raw_identifier_spans: AppendOnlyVec<Span>,
pub bad_unicode_identifiers: Lock<FxIndexMap<Symbol, Vec<Span>>>,
source_map: Arc<SourceMap>,
pub buffered_lints: Lock<Vec<BufferedEarlyLint>>,
pub complete_stmt_exprs_before_bin_op_lookalike: Lock<FxIndexMap<Span, Span>>,
pub gated_spans: GatedSpans,
pub symbol_gallery: SymbolGallery,
pub attr_id_generator: AttrIdGenerator,
}Expand description
Info about a parsing session.
Fields§
§dcx: DiagCtxt§edition: Edition§raw_identifier_spans: AppendOnlyVec<Span>Places where raw identifiers were used. This is used to avoid complaining about idents clashing with keywords in new editions.
bad_unicode_identifiers: Lock<FxIndexMap<Symbol, Vec<Span>>>Places where identifiers that contain invalid Unicode codepoints but that look like they should be. Useful to avoid bad tokenization when encountering emoji. We group them to provide a single error per unique incorrect identifier.
source_map: Arc<SourceMap>§buffered_lints: Lock<Vec<BufferedEarlyLint>>§complete_stmt_exprs_before_bin_op_lookalike: Lock<FxIndexMap<Span, Span>>Places where complete stmt exprs are followed by a token that would’ve been interpreted as a binary operator instead of the start of a following stmt or pat if we weren’t in a stmt expr context.
For error recovery and diagnostic purposes only!
Maps from the start_point of the bin op lookalike to the span of the complete stmt expr
(e.g., block) that could be interpreted as its left operand.
Examples: Given fn f() { { dbg!(); } *ptr = 0; } it maps the span of * to the span of
{ dbg!(); }; given fn f() { { true } && panic!(); } it maps the span of the first & to
the span of { true }.
gated_spans: GatedSpans§symbol_gallery: SymbolGallery§attr_id_generator: AttrIdGeneratorUsed to generate new AttrIds. Every AttrId is unique.
Implementations§
Source§impl ParseSess
impl ParseSess
pub fn with_dcx(dcx: DiagCtxt, source_map: Arc<SourceMap>) -> Self
pub fn emitter_with_note(note: String) -> Self
pub fn source_map(&self) -> &SourceMap
pub fn clone_source_map(&self) -> Arc<SourceMap> ⓘ
pub fn buffer_lint( &self, lint: &'static Lint, span: impl Into<MultiSpan>, node_id: NodeId, diagnostic: impl Into<DecorateDiagCompat>, )
Sourcepub fn buffer_crate_lint(
&self,
lint: &'static Lint,
diagnostic: impl Into<DecorateDiagCompat>,
)
pub fn buffer_crate_lint( &self, lint: &'static Lint, diagnostic: impl Into<DecorateDiagCompat>, )
Buffer a crate-level lint. This is used for lints that are associated with command-line arguments and dependency structure.
pub fn dyn_buffer_lint<F: for<'a> FnOnce(DiagCtxtHandle<'a>, Level) -> Diag<'a> + DynSync + DynSend + 'static>( &self, lint: &'static Lint, span: impl Into<MultiSpan>, node_id: NodeId, callback: F, )
pub fn dyn_buffer_lint_sess<F: for<'a> FnOnce(DiagCtxtHandle<'a>, Level, &Session) -> Diag<'a> + DynSync + DynSend + 'static>( &self, lint: &'static Lint, span: impl Into<MultiSpan>, node_id: NodeId, callback: F, )
pub(crate) fn opt_span_buffer_lint( &self, lint: &'static Lint, span: Option<MultiSpan>, node_id: NodeId, diagnostic: DecorateDiagCompat, )
pub fn dcx(&self) -> DiagCtxtHandle<'_>
Auto Trait Implementations§
impl !Freeze for ParseSess
impl !RefUnwindSafe for ParseSess
impl !Send for ParseSess
impl !Sync for ParseSess
impl !UnwindSafe for ParseSess
impl DynSend for ParseSess
impl DynSync for ParseSess
impl Unpin for ParseSess
impl UnsafeUnpin for ParseSess
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 784 bytes