pub struct Context<'a> {
pub interner: &'a mut Interner,
pub sources: &'a mut SourceMap,
pub fs: &'a dyn FileSystem,
pub search: &'a SearchPath,
pub lex: Options,
pub max_include_depth: u32,
}Expand description
Everything phase 4 needs from outside itself.
Grouped into one struct because #include needs all of it at once and threading five
references through every directive handler is how a parameter list becomes unreadable.
The lifetime is the compilation, and every field of it lives on the session.
Fields§
§interner: &'a mut InternerThe one interner.
sources: &'a mut SourceMapWhere an included file is added, and what a span is resolved against.
fs: &'a dyn FileSystemWhere a header is read from.
search: &'a SearchPathWhere a header is looked for.
lex: OptionsThe dialect knobs phase 1 cares about.
max_include_depth: u32How deep #include may nest before it is called a cycle.
A header that includes itself with no guard is the common way to reach this, and the alternative to a limit is a stack overflow with no diagnostic at all.
Implementations§
Source§impl<'a> Context<'a>
impl<'a> Context<'a>
Sourcepub fn new(
interner: &'a mut Interner,
sources: &'a mut SourceMap,
fs: &'a dyn FileSystem,
search: &'a SearchPath,
) -> Context<'a>
pub fn new( interner: &'a mut Interner, sources: &'a mut SourceMap, fs: &'a dyn FileSystem, search: &'a SearchPath, ) -> Context<'a>
A context with GCC’s include depth limit.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Context<'a>
impl<'a> !UnwindSafe for Context<'a>
impl<'a> Freeze for Context<'a>
impl<'a> Send for Context<'a>
impl<'a> Sync for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> UnsafeUnpin for Context<'a>
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
Mutably borrows from an owned value. Read more