Struct rustc_session::parse::ParseSess
source · pub struct ParseSess {Show 19 fields
pub span_diagnostic: Handler,
pub unstable_features: UnstableFeatures,
pub config: CrateConfig,
pub check_config: CrateCheckConfig,
pub edition: Edition,
pub raw_identifier_spans: Lock<Vec<Span>>,
pub bad_unicode_identifiers: Lock<FxHashMap<Symbol, Vec<Span>>>,
source_map: Lrc<SourceMap>,
pub buffered_lints: Lock<Vec<BufferedEarlyLint>>,
pub ambiguous_block_expr_parse: Lock<FxHashMap<Span, Span>>,
pub gated_spans: GatedSpans,
pub symbol_gallery: SymbolGallery,
pub reached_eof: Lock<bool>,
pub env_depinfo: Lock<FxHashSet<(Symbol, Option<Symbol>)>>,
pub file_depinfo: Lock<FxHashSet<Symbol>>,
pub type_ascription_path_suggestions: Lock<FxHashSet<Span>>,
pub assume_incomplete_release: bool,
pub proc_macro_quoted_spans: Lock<Vec<Span>>,
pub attr_id_generator: AttrIdGenerator,
}
Expand description
Info about a parsing session.
Fields§
§span_diagnostic: Handler
§unstable_features: UnstableFeatures
§config: CrateConfig
§check_config: CrateCheckConfig
§edition: Edition
§raw_identifier_spans: Lock<Vec<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<FxHashMap<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: Lrc<SourceMap>
§buffered_lints: Lock<Vec<BufferedEarlyLint>>
§ambiguous_block_expr_parse: Lock<FxHashMap<Span, Span>>
Contains the spans of block expressions that could have been incomplete based on the operation token that followed it, but that the parser cannot identify without further analysis.
gated_spans: GatedSpans
§symbol_gallery: SymbolGallery
§reached_eof: Lock<bool>
The parser has reached Eof
due to an unclosed brace. Used to silence unnecessary errors.
env_depinfo: Lock<FxHashSet<(Symbol, Option<Symbol>)>>
Environment variables accessed during the build and their values when they exist.
file_depinfo: Lock<FxHashSet<Symbol>>
File paths accessed during the build.
type_ascription_path_suggestions: Lock<FxHashSet<Span>>
All the type ascriptions expressions that have had a suggestion for likely path typo.
assume_incomplete_release: bool
Whether cfg(version) should treat the current release as incomplete
proc_macro_quoted_spans: Lock<Vec<Span>>
Spans passed to proc_macro::quote_span
. Each span has a numerical
identifier represented by its position in the vector.
attr_id_generator: AttrIdGenerator
Used to generate new AttrId
s. Every AttrId
is unique.
Implementations§
source§impl ParseSess
impl ParseSess
sourcepub fn new(file_path_mapping: FilePathMapping) -> Self
pub fn new(file_path_mapping: FilePathMapping) -> Self
Used for testing.
pub fn with_span_handler(handler: Handler, source_map: Lrc<SourceMap>) -> Self
pub fn with_silent_emitter(fatal_note: Option<String>) -> Self
pub fn source_map(&self) -> &SourceMap
pub fn clone_source_map(&self) -> Lrc<SourceMap>
pub fn buffer_lint(
&self,
lint: &'static Lint,
span: impl Into<MultiSpan>,
node_id: NodeId,
msg: &str
)
pub fn buffer_lint_with_diagnostic(
&self,
lint: &'static Lint,
span: impl Into<MultiSpan>,
node_id: NodeId,
msg: &str,
diagnostic: BuiltinLintDiagnostics
)
pub fn save_proc_macro_span(&self, span: Span) -> usize
pub fn proc_macro_quoted_spans(&self) -> Vec<Span>
pub fn create_err<'a>(
&'a self,
err: impl IntoDiagnostic<'a>
) -> DiagnosticBuilder<'a, ErrorGuaranteed>
pub fn emit_err<'a>(&'a self, err: impl IntoDiagnostic<'a>) -> ErrorGuaranteed
pub fn create_warning<'a>(
&'a self,
warning: impl IntoDiagnostic<'a, ()>
) -> DiagnosticBuilder<'a, ()>
pub fn emit_warning<'a>(&'a self, warning: impl IntoDiagnostic<'a, ()>)
pub fn create_note<'a>(
&'a self,
note: impl IntoDiagnostic<'a, Noted>
) -> DiagnosticBuilder<'a, Noted>
pub fn emit_note<'a>(&'a self, note: impl IntoDiagnostic<'a, Noted>) -> Noted
pub fn create_fatal<'a>(
&'a self,
fatal: impl IntoDiagnostic<'a, !>
) -> DiagnosticBuilder<'a, !>
pub fn emit_fatal<'a>(&'a self, fatal: impl IntoDiagnostic<'a, !>) -> !
pub fn struct_err(
&self,
msg: impl Into<DiagnosticMessage>
) -> DiagnosticBuilder<'_, ErrorGuaranteed>
pub fn struct_warn(
&self,
msg: impl Into<DiagnosticMessage>
) -> DiagnosticBuilder<'_, ()>
pub fn struct_fatal(
&self,
msg: impl Into<DiagnosticMessage>
) -> DiagnosticBuilder<'_, !>
pub fn struct_diagnostic<G: EmissionGuarantee>(
&self,
msg: impl Into<DiagnosticMessage>
) -> DiagnosticBuilder<'_, G>
Auto Trait Implementations§
impl !RefUnwindSafe for ParseSess
impl !Send for ParseSess
impl !Sync for ParseSess
impl Unpin for ParseSess
impl !UnwindSafe for ParseSess
Blanket Implementations§
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: 944 bytes