Enum rustc_resolve::late::RibKind
source · pub(crate) enum RibKind<'a> {
Normal,
AssocItem,
ClosureOrAsync,
Item(HasGenericParams),
ConstantItem(ConstantHasGenerics, Option<(Ident, ConstantItemKind)>),
Module(Module<'a>),
MacroDefinition(DefId),
ForwardGenericParamBan,
ConstParamTy,
InlineAsmSym,
}
Expand description
The rib kind restricts certain accesses,
e.g. to a Res::Local
of an outer item.
Variants§
Normal
No restriction needs to be applied.
AssocItem
We passed through an impl or trait and are now in one of its methods or associated types. Allow references to ty params that impl or trait binds. Disallow any other upvars (including other ty params that are upvars).
ClosureOrAsync
We passed through a closure. Disallow labels.
Item(HasGenericParams)
We passed through an item scope. Disallow upvars.
ConstantItem(ConstantHasGenerics, Option<(Ident, ConstantItemKind)>)
We’re in a constant item. Can’t refer to dynamic stuff.
The item may reference generic parameters in trivial constant expressions. All other constants aren’t allowed to use generic params at all.
Module(Module<'a>)
We passed through a module.
MacroDefinition(DefId)
We passed through a macro_rules!
statement
ForwardGenericParamBan
All bindings in this rib are generic parameters that can’t be used
from the default of a generic parameter because they’re not declared
before said generic parameter. Also see the visit_generics
override.
ConstParamTy
We are inside of the type of a const parameter. Can’t refer to any parameters.
InlineAsmSym
We are inside a sym
inline assembly operand. Can only refer to
globals.
Implementations§
source§impl RibKind<'_>
impl RibKind<'_>
sourcepub(crate) fn contains_params(&self) -> bool
pub(crate) fn contains_params(&self) -> bool
Whether this rib kind contains generic parameters, as opposed to local variables.
sourcefn is_label_barrier(self) -> bool
fn is_label_barrier(self) -> bool
This rib forbids referring to labels defined in upwards ribs.
Trait Implementations§
impl<'a> Copy for RibKind<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for RibKind<'a>
impl<'a> !Send for RibKind<'a>
impl<'a> !Sync for RibKind<'a>
impl<'a> Unpin for RibKind<'a>
impl<'a> !UnwindSafe for RibKind<'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
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: 24 bytes
Size for each variant:
Normal
: 0 bytesAssocItem
: 0 bytesClosureOrAsync
: 0 bytesItem
: 15 bytesConstantItem
: 19 bytesModule
: 15 bytesMacroDefinition
: 11 bytesForwardGenericParamBan
: 0 bytesConstParamTy
: 0 bytesInlineAsmSym
: 0 bytes