Type Alias rustc_middle::query::queries::def_kind::ProvidedValue
source · pub type ProvidedValue<'tcx> = DefKind;
Expand description
This type alias specifies the type returned from query providers and the type
used for decoding. For regular queries this is the declared returned type V
,
but arena_cache
will use <V as Deref>::Target
instead.
Aliased Type§
enum ProvidedValue<'tcx> {
Show 31 variants
Mod,
Struct,
Union,
Enum,
Variant,
Trait,
TyAlias,
ForeignTy,
TraitAlias,
AssocTy,
TyParam,
Fn,
Const,
ConstParam,
Static {
safety: Safety,
mutability: Mutability,
nested: bool,
},
Ctor(CtorOf, CtorKind),
AssocFn,
AssocConst,
Macro(MacroKind),
ExternCrate,
Use,
ForeignMod,
AnonConst,
InlineConst,
OpaqueTy,
Field,
LifetimeParam,
GlobalAsm,
Impl {
of_trait: bool,
},
Closure,
SyntheticCoroutineBody,
}
Variants§
Mod
Struct
Refers to the struct itself, [DefKind::Ctor
] refers to its constructor if it exists.
Union
Enum
Variant
Refers to the variant itself, [DefKind::Ctor
] refers to its constructor if it exists.
Trait
TyAlias
Type alias: type Foo = Bar;
ForeignTy
Type from an extern
block.
TraitAlias
Trait alias: trait IntIterator = Iterator<Item = i32>;
AssocTy
Associated type: trait MyTrait { type Assoc; }
TyParam
Type parameter: the T
in struct Vec<T> { ... }
Fn
Const
ConstParam
Constant generic parameter: struct Foo<const N: usize> { ... }
Static
Fields
mutability: Mutability
Whether it’s a static mut
or just a static
.
Ctor(CtorOf, CtorKind)
Refers to the struct or enum variant’s constructor.
The reason Ctor
exists in addition to [DefKind::Struct
] and
[DefKind::Variant
] is because structs and enum variants exist
in the type namespace, whereas struct and enum variant constructors
exist in the value namespace.
You may wonder why enum variants exist in the type namespace as opposed to the value namespace. Check out RFC 2593 for intuition on why that is.
AssocFn
Associated function: impl MyStruct { fn associated() {} }
or trait Foo { fn associated() {} }
AssocConst
Associated constant: trait MyTrait { const ASSOC: usize; }
Macro(MacroKind)
ExternCrate
Use
ForeignMod
An extern
block.
AnonConst
Anonymous constant, e.g. the 1 + 2
in [u8; 1 + 2]
InlineConst
An inline constant, e.g. const { 1 + 2 }
OpaqueTy
Opaque type, aka impl Trait
.
Field
A field in a struct, enum or union. e.g.
bar
instruct Foo { bar: u8 }
Foo::Bar::0
inenum Foo { Bar(u8) }
LifetimeParam
Lifetime parameter: the 'a
in struct Foo<'a> { ... }
GlobalAsm
A use of global_asm!
.
Impl
Closure
A closure, coroutine, or coroutine-closure.
These are all represented with the same ExprKind::Closure
in the AST and HIR,
which makes it difficult to distinguish these during def collection. Therefore,
we treat them all the same, and code which needs to distinguish them can match
or hir::ClosureKind
or type_of
.
SyntheticCoroutineBody
The definition of a synthetic coroutine body created by the lowering of a coroutine-closure, such as an async closure.
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: 3 bytes
Size for each variant:
Mod
: 0 bytesStruct
: 0 bytesUnion
: 0 bytesEnum
: 0 bytesVariant
: 0 bytesTrait
: 0 bytesTyAlias
: 0 bytesForeignTy
: 0 bytesTraitAlias
: 0 bytesAssocTy
: 0 bytesTyParam
: 0 bytesFn
: 0 bytesConst
: 0 bytesConstParam
: 0 bytesStatic
: 3 bytesCtor
: 2 bytesAssocFn
: 0 bytesAssocConst
: 0 bytesMacro
: 1 byteExternCrate
: 0 bytesUse
: 0 bytesForeignMod
: 0 bytesAnonConst
: 0 bytesInlineConst
: 0 bytesOpaqueTy
: 0 bytesField
: 0 bytesLifetimeParam
: 0 bytesGlobalAsm
: 0 bytesImpl
: 1 byteClosure
: 0 bytesSyntheticCoroutineBody
: 0 bytes