pub(crate) enum RibKind<'a> {
    NormalRibKind,
    AssocItemRibKind,
    ClosureOrAsyncRibKind,
    ItemRibKind(HasGenericParams),
    ConstantItemRibKind(ConstantHasGenericsOption<(Ident, ConstantItemKind)>),
    ModuleRibKind(&'a ModuleData<'a>),
    MacroDefinition(DefId),
    ForwardGenericParamBanRibKind,
    ConstParamTyRibKind,
    InlineAsmSymRibKind,
}
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.

ItemRibKind(HasGenericParams)

We passed through an item scope. Disallow upvars.

ConstantItemRibKind(ConstantHasGenericsOption<(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.

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.

InlineAsmSymRibKind

We are inside a sym inline assembly operand. Can only refer to globals.

Implementations

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

This rib forbids referring to labels defined in upwards ribs.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion 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:

  • NormalRibKind: 0 bytes
  • AssocItemRibKind: 0 bytes
  • ClosureOrAsyncRibKind: 0 bytes
  • ItemRibKind: 15 bytes
  • ConstantItemRibKind: 19 bytes
  • ModuleRibKind: 15 bytes
  • MacroDefinition: 11 bytes
  • ForwardGenericParamBanRibKind: 0 bytes
  • ConstParamTyRibKind: 0 bytes
  • InlineAsmSymRibKind: 0 bytes