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<'_>

source

pub(crate) fn contains_params(&self) -> bool

Whether this rib kind contains generic parameters, as opposed to local variables.

source

fn is_label_barrier(self) -> bool

This rib forbids referring to labels defined in upwards ribs.

Trait Implementations§

source§

impl<'a> Clone for RibKind<'a>

source§

fn clone(&self) -> RibKind<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for RibKind<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

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 bytes
  • AssocItem: 0 bytes
  • ClosureOrAsync: 0 bytes
  • Item: 15 bytes
  • ConstantItem: 19 bytes
  • Module: 15 bytes
  • MacroDefinition: 11 bytes
  • ForwardGenericParamBan: 0 bytes
  • ConstParamTy: 0 bytes
  • InlineAsmSym: 0 bytes