pub struct CompileUnit<'tcx> {
pub cc: &'tcx CompileCtxt<'tcx>,
pub index: usize,
}Fields§
§cc: &'tcx CompileCtxt<'tcx>§index: usizeImplementations§
Source§impl<'tcx> CompileUnit<'tcx>
impl<'tcx> CompileUnit<'tcx>
pub fn file(&self) -> &'tcx File
pub fn tree(&self) -> &'tcx Tree
Sourcepub fn interner(&self) -> &InternPool
pub fn interner(&self) -> &InternPool
Access the shared string interner.
Sourcepub fn intern_str<S>(&self, value: S) -> InternedStr
pub fn intern_str<S>(&self, value: S) -> InternedStr
Intern a string and return its symbol.
Sourcepub fn resolve_interned_owned(&self, symbol: InternedStr) -> Option<String>
pub fn resolve_interned_owned(&self, symbol: InternedStr) -> Option<String>
Resolve an interned symbol into an owned string.
pub fn reserve_hir_id(&self) -> HirId
pub fn reserve_block_id(&self) -> BlockId
pub fn register_file_start(&self) -> HirId
pub fn file_start_hir_id(&self) -> Option<HirId>
pub fn file_path(&self) -> Option<&str>
Sourcepub fn get_text(&self, start: usize, end: usize) -> String
pub fn get_text(&self, start: usize, end: usize) -> String
Get text from the file between start and end byte positions
Sourcepub fn opt_hir_node(self, id: HirId) -> Option<HirNode<'tcx>>
pub fn opt_hir_node(self, id: HirId) -> Option<HirNode<'tcx>>
Get a HIR node by ID, returning None if not found
Sourcepub fn opt_bb(self, id: BlockId) -> Option<BasicBlock<'tcx>>
pub fn opt_bb(self, id: BlockId) -> Option<BasicBlock<'tcx>>
Get a HIR node by ID, returning None if not found
Sourcepub fn bb(self, id: BlockId) -> BasicBlock<'tcx>
pub fn bb(self, id: BlockId) -> BasicBlock<'tcx>
Get a HIR node by ID, panicking if not found
Sourcepub fn parent_node(self, id: HirId) -> Option<HirId>
pub fn parent_node(self, id: HirId) -> Option<HirId>
Get the parent of a HIR node
Sourcepub fn opt_get_scope(self, owner: HirId) -> Option<&'tcx Scope<'tcx>>
pub fn opt_get_scope(self, owner: HirId) -> Option<&'tcx Scope<'tcx>>
Get an existing scope or None if it doesn’t exist
pub fn opt_get_symbol(self, owner: SymId) -> Option<&'tcx Symbol>
Sourcepub fn get_scope(self, owner: HirId) -> &'tcx Scope<'tcx>
pub fn get_scope(self, owner: HirId) -> &'tcx Scope<'tcx>
Get an existing scope or None if it doesn’t exist
Sourcepub fn alloc_scope(self, owner: HirId) -> &'tcx Scope<'tcx>
pub fn alloc_scope(self, owner: HirId) -> &'tcx Scope<'tcx>
Find an existing scope or create a new one
Sourcepub fn insert_hir_node(self, id: HirId, node: HirNode<'tcx>)
pub fn insert_hir_node(self, id: HirId, node: HirNode<'tcx>)
Add a HIR node to the map
Sourcepub fn children_of(self, parent: HirId) -> Vec<(HirId, HirNode<'tcx>)>
pub fn children_of(self, parent: HirId) -> Vec<(HirId, HirNode<'tcx>)>
Get all child nodes of a given parent
Sourcepub fn find_ancestor<F>(self, current: HirId, predicate: F) -> Option<HirId>
pub fn find_ancestor<F>(self, current: HirId, predicate: F) -> Option<HirId>
Walk up the parent chain to find an ancestor of a specific type
pub fn add_unresolved_symbol(&self, symbol: &'tcx Symbol)
pub fn insert_block( &self, id: BlockId, block: BasicBlock<'tcx>, parent: BlockId, )
Methods from Deref<Target = CompileCtxt<'tcx>>§
Sourcepub fn compile_unit(&'tcx self, index: usize) -> CompileUnit<'tcx>
pub fn compile_unit(&'tcx self, index: usize) -> CompileUnit<'tcx>
Create a context that references this CompileCtxt for a specific file index
pub fn create_globals(&'tcx self) -> &'tcx Scope<'tcx>
pub fn get_scope(&'tcx self, owner: HirId) -> &'tcx Scope<'tcx>
pub fn opt_get_symbol(&'tcx self, owner: SymId) -> Option<&'tcx Symbol>
Sourcepub fn find_symbol_by_block_id(
&'tcx self,
block_id: BlockId,
) -> Option<&'tcx Symbol>
pub fn find_symbol_by_block_id( &'tcx self, block_id: BlockId, ) -> Option<&'tcx Symbol>
Find the primary symbol associated with a block ID
pub fn alloc_scope(&'tcx self, owner: HirId) -> &'tcx Scope<'tcx>
pub fn reserve_hir_id(&self) -> HirId
pub fn reserve_block_id(&self) -> BlockId
pub fn current_hir_id(&self) -> HirId
pub fn set_file_start(&self, index: usize, start: HirId)
pub fn file_start(&self, index: usize) -> Option<HirId>
pub fn file_path(&self, index: usize) -> Option<&str>
Trait Implementations§
Source§impl<'tcx> Clone for CompileUnit<'tcx>
impl<'tcx> Clone for CompileUnit<'tcx>
Source§fn clone(&self) -> CompileUnit<'tcx>
fn clone(&self) -> CompileUnit<'tcx>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'tcx> Debug for CompileUnit<'tcx>
impl<'tcx> Debug for CompileUnit<'tcx>
Source§impl<'tcx> Deref for CompileUnit<'tcx>
impl<'tcx> Deref for CompileUnit<'tcx>
impl<'tcx> Copy for CompileUnit<'tcx>
Auto Trait Implementations§
impl<'tcx> Freeze for CompileUnit<'tcx>
impl<'tcx> !RefUnwindSafe for CompileUnit<'tcx>
impl<'tcx> !Send for CompileUnit<'tcx>
impl<'tcx> !Sync for CompileUnit<'tcx>
impl<'tcx> Unpin for CompileUnit<'tcx>
impl<'tcx> !UnwindSafe for CompileUnit<'tcx>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more