pub struct Scope<'tcx> { /* private fields */ }Expand description
Represents a single level in the scope hierarchy.
Implementations§
Source§impl<'tcx> Scope<'tcx>
impl<'tcx> Scope<'tcx>
Sourcepub fn new_with(
owner: HirId,
symbol: Option<&'tcx Symbol>,
interner: Option<&'tcx InternPool>,
) -> Self
pub fn new_with( owner: HirId, symbol: Option<&'tcx Symbol>, interner: Option<&'tcx InternPool>, ) -> Self
Creates a new scope owned by the given HIR node and associated with a symbol.
Sourcepub fn new_with_shards(
owner: HirId,
symbol: Option<&'tcx Symbol>,
interner: Option<&'tcx InternPool>,
shard_count: usize,
) -> Self
pub fn new_with_shards( owner: HirId, symbol: Option<&'tcx Symbol>, interner: Option<&'tcx InternPool>, shard_count: usize, ) -> Self
Creates a new scope with specified shard count for the DashMap. Use this for high-contention scopes like globals.
Sourcepub fn merge_with(&self, other: &'tcx Scope<'tcx>, _arena: &'tcx Arena<'tcx>)
pub fn merge_with(&self, other: &'tcx Scope<'tcx>, _arena: &'tcx Arena<'tcx>)
Merge existing scope into this scope.
pub fn add_parent(&self, parent: &'tcx Scope<'tcx>)
pub fn owner(&self) -> HirId
pub fn set_symbol(&self, symbol: &'tcx Symbol)
pub fn opt_symbol(&self) -> Option<&'tcx Symbol>
Sourcepub fn find_parent_by_kind(&self, kind: SymKind) -> Option<&'tcx Symbol>
pub fn find_parent_by_kind(&self, kind: SymKind) -> Option<&'tcx Symbol>
Find a parent scope with a symbol of the given kind. Walks up the parent chain (BFS) looking for a scope whose symbol matches.
pub fn id(&self) -> ScopeId
Sourcepub fn get_redirect(&self) -> Option<ScopeId>
pub fn get_redirect(&self) -> Option<ScopeId>
If this scope was redirected (merged into another), get the target scope ID.
Sourcepub fn set_redirect(&self, target: ScopeId)
pub fn set_redirect(&self, target: ScopeId)
Set the redirect for this scope (used when merging scopes).
pub fn parents(&self) -> Vec<&'tcx Scope<'tcx>>
Sourcepub fn for_each_symbol<F>(&self, visit: F)
pub fn for_each_symbol<F>(&self, visit: F)
Invokes a closure for each symbol in this scope. Iterates in deterministic order by sorting keys.
pub fn lookup_symbols( &self, name: InternedStr, options: LookupOptions, ) -> Option<Vec<&'tcx Symbol>>
Trait Implementations§
Source§impl<'a> ArenaInsert<'a> for Scope<'a>
impl<'a> ArenaInsert<'a> for Scope<'a>
fn insert_into(self, arena: &'a ArenaInner) -> &'a Self
Source§impl<'a> ArenaInsertWithId<'a> for Scope<'a>
impl<'a> ArenaInsertWithId<'a> for Scope<'a>
fn insert_with_id(self, arena: &'a ArenaInner, id: usize) -> &'a Self
Auto Trait Implementations§
impl<'tcx> !Freeze for Scope<'tcx>
impl<'tcx> !RefUnwindSafe for Scope<'tcx>
impl<'tcx> Send for Scope<'tcx>
impl<'tcx> Sync for Scope<'tcx>
impl<'tcx> Unpin for Scope<'tcx>
impl<'tcx> !UnwindSafe for Scope<'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> 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>
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