Enum rustc_resolve::late::RibKind
source · [−]pub(crate) enum RibKind<'a> {
NormalRibKind,
AssocItemRibKind,
ClosureOrAsyncRibKind,
FnItemRibKind,
ItemRibKind(HasGenericParams),
ConstantItemRibKind(bool, Option<(Ident, ConstantItemKind)>),
ModuleRibKind(&'a ModuleData<'a>),
MacroDefinition(DefId),
ForwardGenericParamBanRibKind,
ConstParamTyRibKind,
}Expand description
The rib kind restricts certain accesses,
e.g. to a Res::Local of an outer item.
Variants
NormalRibKind
No restriction needs to be applied.
AssocItemRibKind
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).
ClosureOrAsyncRibKind
We passed through a closure. Disallow labels.
FnItemRibKind
We passed through a function definition. Disallow upvars. Permit only those const parameters that are specified in the function’s generics.
ItemRibKind(HasGenericParams)
We passed through an item scope. Disallow upvars.
ConstantItemRibKind(bool, Option<(Ident, ConstantItemKind)>)
We’re in a constant item. Can’t refer to dynamic stuff.
The bool indicates if this constant may reference generic parameters
and is used to only allow generic parameters to be used in trivial constant expressions.
ModuleRibKind(&'a ModuleData<'a>)
We passed through a module.
MacroDefinition(DefId)
We passed through a macro_rules! statement
ForwardGenericParamBanRibKind
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.
ConstParamTyRibKind
We are inside of the type of a const parameter. Can’t refer to any parameters.
Implementations
sourceimpl 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.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
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:
NormalRibKind: 0 bytesAssocItemRibKind: 0 bytesClosureOrAsyncRibKind: 0 bytesFnItemRibKind: 0 bytesItemRibKind: 1 byteConstantItemRibKind: 19 bytesModuleRibKind: 15 bytesMacroDefinition: 11 bytesForwardGenericParamBanRibKind: 0 bytesConstParamTyRibKind: 0 bytes