## CompilerInterface

# Trait CompilerInterface

Source

    pub(crate) trait CompilerInterface {
    Show 88 methods    // Required methods
        fn entry_fn(&self) -> Option<CrateItem>;
        fn all_local_items(&self) -> CrateItems;
        fn mir_body(&self, item: DefId) -> Body;
        fn has_body(&self, item: DefId) -> bool;
        fn foreign_modules(&self, crate_num: CrateNum) -> Vec<ForeignModuleDef>;
        fn crate_functions(&self, crate_num: CrateNum) -> Vec<FnDef>;
        fn crate_statics(&self, crate_num: CrateNum) -> Vec<StaticDef>;
        fn foreign_module(&self, mod_def: ForeignModuleDef) -> ForeignModule;
        fn foreign_items(&self, mod_def: ForeignModuleDef) -> Vec<ForeignDef>;
        fn all_trait_decls(&self) -> TraitDecls;
        fn trait_decls(&self, crate_num: CrateNum) -> TraitDecls;
        fn trait_decl(&self, trait_def: &TraitDef) -> TraitDecl;
        fn all_trait_impls(&self) -> ImplTraitDecls;
        fn trait_impls(&self, crate_num: CrateNum) -> ImplTraitDecls;
        fn trait_impl(&self, trait_impl: &ImplDef) -> ImplTrait;
        fn generics_of(&self, def_id: DefId) -> Generics;
        fn predicates_of(&self, def_id: DefId) -> GenericPredicates;
        fn explicit_predicates_of(&self, def_id: DefId) -> GenericPredicates;
        fn local_crate(&self) -> Crate;
        fn external_crates(&self) -> Vec<Crate>;
        fn find_crates(&self, name: &str) -> Vec<Crate>;
        fn def_name(&self, def_id: DefId, trimmed: bool) -> Symbol;
        fn tool_attrs(&self, def_id: DefId, attr: &[Symbol]) -> Vec<Attribute>;
        fn all_tool_attrs(&self, def_id: DefId) -> Vec<Attribute>;
        fn span_to_string(&self, span: Span) -> String;
        fn get_filename(&self, span: &Span) -> Filename;
        fn get_lines(&self, span: &Span) -> LineInfo;
        fn item_kind(&self, item: CrateItem) -> ItemKind;
        fn is_foreign_item(&self, item: DefId) -> bool;
        fn foreign_item_kind(&self, def: ForeignDef) -> ForeignItemKind;
        fn adt_kind(&self, def: AdtDef) -> AdtKind;
        fn adt_is_box(&self, def: AdtDef) -> bool;
        fn adt_is_simd(&self, def: AdtDef) -> bool;
        fn adt_is_cstr(&self, def: AdtDef) -> bool;
        fn adt_repr(&self, def: AdtDef) -> ReprOptions;
        fn fn_sig(&self, def: FnDef, args: &GenericArgs) -> PolyFnSig;
        fn intrinsic(&self, item: DefId) -> Option<IntrinsicDef>;
        fn intrinsic_name(&self, def: IntrinsicDef) -> Symbol;
        fn closure_sig(&self, args: &GenericArgs) -> PolyFnSig;
        fn adt_variants_len(&self, def: AdtDef) -> usize;
        fn adt_discr_for_variant(&self, adt: AdtDef, variant: VariantIdx) -> Discr;
        fn coroutine_discr_for_variant(
            &self,
            coroutine: CoroutineDef,
            args: &GenericArgs,
            variant: VariantIdx,
        ) -> Discr;
        fn variant_name(&self, def: VariantDef) -> Symbol;
        fn variant_fields(&self, def: VariantDef) -> Vec<FieldDef>;
        fn eval_target_usize(&self, cnst: &MirConst) -> Result<u64, Error>;
        fn eval_target_usize_ty(&self, cnst: &TyConst) -> Result<u64, Error>;
        fn try_new_const_zst(&self, ty: Ty) -> Result<MirConst, Error>;
        fn new_const_str(&self, value: &str) -> MirConst;
        fn new_const_bool(&self, value: bool) -> MirConst;
        fn try_new_const_uint(
            &self,
            value: u128,
            uint_ty: UintTy,
        ) -> Result<MirConst, Error>;
        fn try_new_ty_const_uint(
            &self,
            value: u128,
            uint_ty: UintTy,
        ) -> Result<TyConst, Error>;
        fn new_rigid_ty(&self, kind: RigidTy) -> Ty;
        fn new_box_ty(&self, ty: Ty) -> Ty;
        fn def_ty(&self, item: DefId) -> Ty;
        fn def_ty_with_args(&self, item: DefId, args: &GenericArgs) -> Ty;
        fn mir_const_pretty(&self, cnst: &MirConst) -> String;
        fn span_of_an_item(&self, def_id: DefId) -> Span;
        fn ty_const_pretty(&self, ct: TyConstId) -> String;
        fn ty_pretty(&self, ty: Ty) -> String;
        fn ty_kind(&self, ty: Ty) -> TyKind;
        fn rigid_ty_discriminant_ty(&self, ty: &RigidTy) -> Ty;
        fn instance_body(&self, instance: InstanceDef) -> Option<Body>;
        fn instance_ty(&self, instance: InstanceDef) -> Ty;
        fn instance_args(&self, def: InstanceDef) -> GenericArgs;
        fn instance_def_id(&self, instance: InstanceDef) -> DefId;
        fn instance_mangled_name(&self, instance: InstanceDef) -> Symbol;
        fn is_empty_drop_shim(&self, def: InstanceDef) -> bool;
        fn mono_instance(&self, def_id: DefId) -> Instance;
        fn requires_monomorphization(&self, def_id: DefId) -> bool;
        fn resolve_instance(
            &self,
            def: FnDef,
            args: &GenericArgs,
        ) -> Option<Instance>;
        fn resolve_drop_in_place(&self, ty: Ty) -> Instance;
        fn resolve_for_fn_ptr(
            &self,
            def: FnDef,
            args: &GenericArgs,
        ) -> Option<Instance>;
        fn resolve_closure(
            &self,
            def: ClosureDef,
            args: &GenericArgs,
            kind: ClosureKind,
        ) -> Option<Instance>;
        fn eval_static_initializer(
            &self,
            def: StaticDef,
        ) -> Result<Allocation, Error>;
        fn eval_instance(
            &self,
            def: InstanceDef,
            const_ty: Ty,
        ) -> Result<Allocation, Error>;
        fn global_alloc(&self, id: AllocId) -> GlobalAlloc;
        fn vtable_allocation(&self, global_alloc: &GlobalAlloc) -> Option<AllocId>;
        fn krate(&self, def_id: DefId) -> Crate;
        fn instance_name(&self, def: InstanceDef, trimmed: bool) -> Symbol;
        fn target_info(&self) -> MachineInfo;
        fn instance_abi(&self, def: InstanceDef) -> Result<FnAbi, Error>;
        fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error>;
        fn ty_layout(&self, ty: Ty) -> Result<Layout, Error>;
        fn layout_shape(&self, id: Layout) -> LayoutShape;
        fn place_pretty(&self, place: &Place) -> String;
        fn binop_ty(&self, bin_op: BinOp, rhs: Ty, lhs: Ty) -> Ty;
        fn unop_ty(&self, un_op: UnOp, arg: Ty) -> Ty;
        fn associated_items(&self, def_id: DefId) -> AssocItems;
    }

Expand description

Public API for querying compiler information.

All queries are delegated to `rustc_public_bridge::context::CompilerCtxt` that provides similar APIs but based on internal rustc constructs.

Do not use this directly. This is currently used in the macro expansion.

## Required Methods§

Source

#### fn entry_fn(&self) -> Option<CrateItem>

Source

#### fn all_local_items(&self) -> CrateItems

Retrieve all items of the local crate that have a MIR associated with them.

Source

#### fn mir_body(&self, item: DefId) -> Body

Retrieve the body of a function. This function will panic if the body is not available.

Source

#### fn has_body(&self, item: DefId) -> bool

Check whether the body of a function is available.

Source

#### fn foreign_modules(&self, crate_num: CrateNum) -> Vec<ForeignModuleDef>

Source

#### fn crate_functions(&self, crate_num: CrateNum) -> Vec<FnDef>

Retrieve all functions defined in this crate.

Source

#### fn crate_statics(&self, crate_num: CrateNum) -> Vec<StaticDef>

Retrieve all static items defined in this crate.

Source

#### fn foreign_module(&self, mod_def: ForeignModuleDef) -> ForeignModule

Source

#### fn foreign_items(&self, mod_def: ForeignModuleDef) -> Vec<ForeignDef>

Source

#### fn all_trait_decls(&self) -> TraitDecls

Source

#### fn trait_decls(&self, crate_num: CrateNum) -> TraitDecls

Source

#### fn trait_decl(&self, trait_def: &TraitDef) -> TraitDecl

Source

#### fn all_trait_impls(&self) -> ImplTraitDecls

Source

#### fn trait_impls(&self, crate_num: CrateNum) -> ImplTraitDecls

Source

#### fn trait_impl(&self, trait_impl: &ImplDef) -> ImplTrait

Source

#### fn generics_of(&self, def_id: DefId) -> Generics

Source

#### fn predicates_of(&self, def_id: DefId) -> GenericPredicates

Source

#### fn explicit_predicates_of(&self, def_id: DefId) -> GenericPredicates

Source

#### fn local_crate(&self) -> Crate

Get information about the local crate.

Source

#### fn external_crates(&self) -> Vec<Crate>

Retrieve a list of all external crates.

Source

#### fn find_crates(&self, name: &str) -> Vec<Crate>

Find a crate with the given name.

Source

#### fn def_name(&self, def_id: DefId, trimmed: bool) -> Symbol

Returns the name of given `DefId`

Source

#### fn tool_attrs(&self, def_id: DefId, attr: &[Symbol]) -> Vec<Attribute>

Return registered tool attributes with the given attribute name.

FIXME(jdonszelmann): may panic on non-tool attributes. After more attribute work, non-tool attributes will simply return an empty list.

Single segmented name like `#[clippy]` is specified as `&["clippy".to_string()]`. Multi-segmented name like `#[rustfmt::skip]` is specified as `&["rustfmt".to_string(), "skip".to_string()]`.

Source

#### fn all_tool_attrs(&self, def_id: DefId) -> Vec<Attribute>

Get all tool attributes of a definition.

Source

#### fn span_to_string(&self, span: Span) -> String

Returns printable, human readable form of `Span`

Source

#### fn get_filename(&self, span: &Span) -> Filename

Return filename from given `Span`, for diagnostic purposes

Source

#### fn get_lines(&self, span: &Span) -> LineInfo

Return lines corresponding to this `Span`

Source

#### fn item_kind(&self, item: CrateItem) -> ItemKind

Returns the `kind` of given `DefId`

Source

#### fn is_foreign_item(&self, item: DefId) -> bool

Returns whether this is a foreign item.

Source

#### fn foreign_item_kind(&self, def: ForeignDef) -> ForeignItemKind

Returns the kind of a given foreign item.

Source

#### fn adt_kind(&self, def: AdtDef) -> AdtKind

Returns the kind of a given algebraic data type

Source

#### fn adt_is_box(&self, def: AdtDef) -> bool

Returns if the ADT is a box.

Source

#### fn adt_is_simd(&self, def: AdtDef) -> bool

Returns whether this ADT is simd.

Source

#### fn adt_is_cstr(&self, def: AdtDef) -> bool

Returns whether this definition is a C string.

Source

#### fn adt_repr(&self, def: AdtDef) -> ReprOptions

Returns the representation options for this ADT.

Source

#### fn fn_sig(&self, def: FnDef, args: &GenericArgs) -> PolyFnSig

Retrieve the function signature for the given generic arguments.

Source

#### fn intrinsic(&self, item: DefId) -> Option<IntrinsicDef>

Retrieve the intrinsic definition if the item corresponds one.

Source

#### fn intrinsic_name(&self, def: IntrinsicDef) -> Symbol

Retrieve the plain function name of an intrinsic.

Source

#### fn closure_sig(&self, args: &GenericArgs) -> PolyFnSig

Retrieve the closure signature for the given generic arguments.

Source

#### fn adt_variants_len(&self, def: AdtDef) -> usize

The number of variants in this ADT.

Source

#### fn adt_discr_for_variant(&self, adt: AdtDef, variant: VariantIdx) -> Discr

Discriminant for a given variant index of AdtDef.

Source

#### fn coroutine_discr_for_variant( &self, coroutine: CoroutineDef, args: &GenericArgs, variant: VariantIdx, ) -> Discr

Discriminant for a given variand index and args of a coroutine.

Source

#### fn variant_name(&self, def: VariantDef) -> Symbol

The name of a variant.

Source

#### fn variant_fields(&self, def: VariantDef) -> Vec<FieldDef>

Source

#### fn eval_target_usize(&self, cnst: &MirConst) -> Result<u64, Error>

Evaluate constant as a target usize.

Source

#### fn eval_target_usize_ty(&self, cnst: &TyConst) -> Result<u64, Error>

Source

#### fn try_new_const_zst(&self, ty: Ty) -> Result<MirConst, Error>

Create a new zero-sized constant.

Source

#### fn new_const_str(&self, value: &str) -> MirConst

Create a new constant that represents the given string value.

Source

#### fn new_const_bool(&self, value: bool) -> MirConst

Create a new constant that represents the given boolean value.

Source

#### fn try_new_const_uint( &self, value: u128, uint_ty: UintTy, ) -> Result<MirConst, Error>

Create a new constant that represents the given value.

Source

#### fn try_new_ty_const_uint( &self, value: u128, uint_ty: UintTy, ) -> Result<TyConst, Error>

Source

#### fn new_rigid_ty(&self, kind: RigidTy) -> Ty

Create a new type from the given kind.

Source

#### fn new_box_ty(&self, ty: Ty) -> Ty

Create a new box type, `Box<T>`, for the given inner type `T`.

Source

#### fn def_ty(&self, item: DefId) -> Ty

Returns the type of given crate item.

Source

#### fn def_ty_with_args(&self, item: DefId, args: &GenericArgs) -> Ty

Returns the type of given definition instantiated with the given arguments.

Source

#### fn mir_const_pretty(&self, cnst: &MirConst) -> String

Returns literal value of a const as a string.

Source

#### fn span_of_an_item(&self, def_id: DefId) -> Span

`Span` of an item

Source

#### fn ty_const_pretty(&self, ct: TyConstId) -> String

Source

#### fn ty_pretty(&self, ty: Ty) -> String

Obtain the representation of a type.

Source

#### fn ty_kind(&self, ty: Ty) -> TyKind

Obtain the kind of a type.

Source

#### fn rigid_ty_discriminant_ty(&self, ty: &RigidTy) -> Ty

Source

#### fn instance_body(&self, instance: InstanceDef) -> Option<Body>

Get the body of an Instance which is already monomorphized.

Source

#### fn instance_ty(&self, instance: InstanceDef) -> Ty

Get the instance type with generic instantiations applied and lifetimes erased.

Source

#### fn instance_args(&self, def: InstanceDef) -> GenericArgs

Get the instantiation types.

Source

#### fn instance_def_id(&self, instance: InstanceDef) -> DefId

Get the instance.

Source

#### fn instance_mangled_name(&self, instance: InstanceDef) -> Symbol

Get the instance mangled name.

Source

#### fn is_empty_drop_shim(&self, def: InstanceDef) -> bool

Check if this is an empty DropGlue shim.

Source

#### fn mono_instance(&self, def_id: DefId) -> Instance

Convert a non-generic crate item into an instance. This function will panic if the item is generic.

Source

#### fn requires_monomorphization(&self, def_id: DefId) -> bool

Item requires monomorphization.

Source

#### fn resolve_instance(&self, def: FnDef, args: &GenericArgs) -> Option<Instance>

Resolve an instance from the given function definition and generic arguments.

Source

#### fn resolve_drop_in_place(&self, ty: Ty) -> Instance

Resolve an instance for drop_in_place for the given type.

Source

#### fn resolve_for_fn_ptr(&self, def: FnDef, args: &GenericArgs) -> Option<Instance>

Resolve instance for a function pointer.

Source

#### fn resolve_closure( &self, def: ClosureDef, args: &GenericArgs, kind: ClosureKind, ) -> Option<Instance>

Resolve instance for a closure with the requested type.

Source

#### fn eval_static_initializer(&self, def: StaticDef) -> Result<Allocation, Error>

Evaluate a static’s initializer.

Source

#### fn eval_instance( &self, def: InstanceDef, const_ty: Ty, ) -> Result<Allocation, Error>

Try to evaluate an instance into a constant.

Source

#### fn global_alloc(&self, id: AllocId) -> GlobalAlloc

Retrieve global allocation for the given allocation ID.

Source

#### fn vtable_allocation(&self, global_alloc: &GlobalAlloc) -> Option<AllocId>

Retrieve the id for the virtual table.

Source

#### fn krate(&self, def_id: DefId) -> Crate

Source

#### fn instance_name(&self, def: InstanceDef, trimmed: bool) -> Symbol

Source

#### fn target_info(&self) -> MachineInfo

Return information about the target machine.

Source

#### fn instance_abi(&self, def: InstanceDef) -> Result<FnAbi, Error>

Get an instance ABI.

Source

#### fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error>

Get the ABI of a function pointer.

Source

#### fn ty_layout(&self, ty: Ty) -> Result<Layout, Error>

Get the layout of a type.

Source

#### fn layout_shape(&self, id: Layout) -> LayoutShape

Get the layout shape.

Source

#### fn place_pretty(&self, place: &Place) -> String

Get a debug string representation of a place.

Source

#### fn binop_ty(&self, bin_op: BinOp, rhs: Ty, lhs: Ty) -> Ty

Get the resulting type of binary operation.

Source

#### fn unop_ty(&self, un_op: UnOp, arg: Ty) -> Ty

Get the resulting type of unary operation.

Source

#### fn associated_items(&self, def_id: DefId) -> AssocItems

Get all associated items of a definition.

## Implementations on Foreign Types§

Source§

### impl<'tcx> CompilerInterface for Container<'tcx, BridgeTys>

Source§

#### fn all_local_items(&self) -> CrateItems

Retrieve all items of the local crate that have a MIR associated with them.

Source§

#### fn mir_body(&self, item: DefId) -> Body

Retrieve the body of a function. This function will panic if the body is not available.

Source§

#### fn has_body(&self, item: DefId) -> bool

Check whether the body of a function is available.

Source§

#### fn crate_functions(&self, crate_num: CrateNum) -> Vec<FnDef>

Retrieve all functions defined in this crate.

Source§

#### fn crate_statics(&self, crate_num: CrateNum) -> Vec<StaticDef>

Retrieve all static items defined in this crate.

Source§

#### fn local_crate(&self) -> Crate

Get information about the local crate.

Source§

#### fn external_crates(&self) -> Vec<Crate>

Retrieve a list of all external crates.

Source§

#### fn find_crates(&self, name: &str) -> Vec<Crate>

Find a crate with the given name.

Source§

#### fn def_name(&self, def_id: DefId, trimmed: bool) -> Symbol

Returns the name of given `DefId`.

Source§

#### fn tool_attrs(&self, def_id: DefId, attr: &[Symbol]) -> Vec<Attribute>

Return registered tool attributes with the given attribute name.

FIXME(jdonszelmann): may panic on non-tool attributes. After more attribute work, non-tool attributes will simply return an empty list.

Single segmented name like `#[clippy]` is specified as `&["clippy".to_string()]`. Multi-segmented name like `#[rustfmt::skip]` is specified as `&["rustfmt".to_string(), "skip".to_string()]`.

Source§

#### fn all_tool_attrs(&self, def_id: DefId) -> Vec<Attribute>

Get all tool attributes of a definition.

Source§

#### fn span_to_string(&self, span: Span) -> String

Returns printable, human readable form of `Span`.

Source§

#### fn get_filename(&self, span: &Span) -> Filename

Return filename from given `Span`, for diagnostic purposes.

Source§

#### fn get_lines(&self, span: &Span) -> LineInfo

Return lines corresponding to this `Span`.

Source§

#### fn item_kind(&self, item: CrateItem) -> ItemKind

Returns the `kind` of given `DefId`.

Source§

#### fn is_foreign_item(&self, item: DefId) -> bool

Returns whether this is a foreign item.

Source§

#### fn foreign_item_kind(&self, def: ForeignDef) -> ForeignItemKind

Returns the kind of a given foreign item.

Source§

#### fn adt_kind(&self, def: AdtDef) -> AdtKind

Returns the kind of a given algebraic data type.

Source§

#### fn adt_is_box(&self, def: AdtDef) -> bool

Returns if the ADT is a box.

Source§

#### fn adt_is_simd(&self, def: AdtDef) -> bool

Returns whether this ADT is simd.

Source§

#### fn adt_is_cstr(&self, def: AdtDef) -> bool

Returns whether this definition is a C string.

Source§

#### fn adt_repr(&self, def: AdtDef) -> ReprOptions

Returns the representation options for this ADT

Source§

#### fn fn_sig(&self, def: FnDef, args: &GenericArgs) -> PolyFnSig

Retrieve the function signature for the given generic arguments.

Source§

#### fn intrinsic(&self, item: DefId) -> Option<IntrinsicDef>

Retrieve the intrinsic definition if the item corresponds one.

Source§

#### fn intrinsic_name(&self, def: IntrinsicDef) -> Symbol

Retrieve the plain function name of an intrinsic.

Source§

#### fn closure_sig(&self, args: &GenericArgs) -> PolyFnSig

Retrieve the closure signature for the given generic arguments.

Source§

#### fn adt_variants_len(&self, def: AdtDef) -> usize

The number of variants in this ADT.

Source§

#### fn adt_discr_for_variant(&self, adt: AdtDef, variant: VariantIdx) -> Discr

Discriminant for a given variant index of AdtDef.

Source§

#### fn coroutine_discr_for_variant( &self, coroutine: CoroutineDef, args: &GenericArgs, variant: VariantIdx, ) -> Discr

Discriminant for a given variand index and args of a coroutine.

Source§

#### fn variant_name(&self, def: VariantDef) -> Symbol

The name of a variant.

Source§

#### fn eval_target_usize(&self, mir_const: &MirConst) -> Result<u64, Error>

Evaluate constant as a target usize.

Source§

#### fn try_new_const_zst(&self, ty: Ty) -> Result<MirConst, Error>

Create a new zero-sized constant.

Source§

#### fn new_const_str(&self, value: &str) -> MirConst

Create a new constant that represents the given string value.

Source§

#### fn new_const_bool(&self, value: bool) -> MirConst

Create a new constant that represents the given boolean value.

Source§

#### fn try_new_const_uint( &self, value: u128, uint_ty: UintTy, ) -> Result<MirConst, Error>

Create a new constant that represents the given value.

Source§

#### fn new_rigid_ty(&self, kind: RigidTy) -> Ty

Create a new type from the given kind.

Source§

#### fn new_box_ty(&self, ty: Ty) -> Ty

Create a new box type, `Box<T>`, for the given inner type `T`.

Source§

#### fn def_ty(&self, item: DefId) -> Ty

Returns the type of given crate item.

Source§

#### fn def_ty_with_args(&self, item: DefId, args: &GenericArgs) -> Ty

Returns the type of given definition instantiated with the given arguments.

Source§

#### fn mir_const_pretty(&self, cnst: &MirConst) -> String

Returns literal value of a const as a string.

Source§

#### fn span_of_an_item(&self, def_id: DefId) -> Span

`Span` of an item.

Source§

#### fn ty_pretty(&self, ty: Ty) -> String

Obtain the representation of a type.

Source§

#### fn ty_kind(&self, ty: Ty) -> TyKind

Obtain the kind of a type.

Source§

#### fn rigid_ty_discriminant_ty(&self, ty: &RigidTy) -> Ty

Get the discriminant Ty for this Ty if there’s one.

Source§

#### fn instance_body(&self, instance: InstanceDef) -> Option<Body>

Get the body of an Instance which is already monomorphized.

Source§

#### fn instance_ty(&self, instance: InstanceDef) -> Ty

Get the instance type with generic instantiations applied and lifetimes erased.

Source§

#### fn instance_args(&self, def: InstanceDef) -> GenericArgs

Get the instantiation types.

Source§

#### fn instance_def_id(&self, instance: InstanceDef) -> DefId

Get the instance.

Source§

#### fn instance_mangled_name(&self, instance: InstanceDef) -> Symbol

Get the instance mangled name.

Source§

#### fn is_empty_drop_shim(&self, def: InstanceDef) -> bool

Check if this is an empty DropGlue shim.

Source§

#### fn mono_instance(&self, def_id: DefId) -> Instance

Convert a non-generic crate item into an instance. This function will panic if the item is generic.

Source§

#### fn requires_monomorphization(&self, def_id: DefId) -> bool

Item requires monomorphization.

Source§

#### fn resolve_instance(&self, def: FnDef, args: &GenericArgs) -> Option<Instance>

Resolve an instance from the given function definition and generic arguments.

Source§

#### fn resolve_drop_in_place(&self, ty: Ty) -> Instance

Resolve an instance for drop_in_place for the given type.

Source§

#### fn resolve_for_fn_ptr(&self, def: FnDef, args: &GenericArgs) -> Option<Instance>

Resolve instance for a function pointer.

Source§

#### fn resolve_closure( &self, def: ClosureDef, args: &GenericArgs, kind: ClosureKind, ) -> Option<Instance>

Resolve instance for a closure with the requested type.

Source§

#### fn eval_static_initializer(&self, def: StaticDef) -> Result<Allocation, Error>

Evaluate a static’s initializer.

Source§

#### fn eval_instance( &self, def: InstanceDef, const_ty: Ty, ) -> Result<Allocation, Error>

Try to evaluate an instance into a constant.

Source§

#### fn global_alloc(&self, id: AllocId) -> GlobalAlloc

Retrieve global allocation for the given allocation ID.

Source§

#### fn vtable_allocation(&self, global_alloc: &GlobalAlloc) -> Option<AllocId>

Retrieve the id for the virtual table.

Source§

#### fn target_info(&self) -> MachineInfo

Return information about the target machine.

Source§

#### fn instance_abi(&self, def: InstanceDef) -> Result<FnAbi, Error>

Get an instance ABI.

Source§

#### fn fn_ptr_abi(&self, fn_ptr: PolyFnSig) -> Result<FnAbi, Error>

Get the ABI of a function pointer.

Source§

#### fn ty_layout(&self, ty: Ty) -> Result<Layout, Error>

Get the layout of a type.

Source§

#### fn layout_shape(&self, id: Layout) -> LayoutShape

Get the layout shape.

Source§

#### fn place_pretty(&self, place: &Place) -> String

Get a debug string representation of a place.

Source§

#### fn binop_ty(&self, bin_op: BinOp, rhs: Ty, lhs: Ty) -> Ty

Get the resulting type of binary operation.

Source§

#### fn unop_ty(&self, un_op: UnOp, arg: Ty) -> Ty

Get the resulting type of unary operation.

Source§

#### fn associated_items(&self, def_id: DefId) -> AssocItems

Get all associated items of a definition.

Source§

#### fn entry_fn(&self) -> Option<CrateItem>

Source§

#### fn foreign_modules(&self, crate_num: CrateNum) -> Vec<ForeignModuleDef>

Source§

#### fn foreign_module(&self, mod_def: ForeignModuleDef) -> ForeignModule

Source§

#### fn foreign_items(&self, mod_def: ForeignModuleDef) -> Vec<ForeignDef>

Source§

#### fn all_trait_decls(&self) -> TraitDecls

Source§

#### fn trait_decls(&self, crate_num: CrateNum) -> TraitDecls

Source§

#### fn trait_decl(&self, trait_def: &TraitDef) -> TraitDecl

Source§

#### fn all_trait_impls(&self) -> ImplTraitDecls

Source§

#### fn trait_impls(&self, crate_num: CrateNum) -> ImplTraitDecls

Source§

#### fn trait_impl(&self, trait_impl: &ImplDef) -> ImplTrait

Source§

#### fn generics_of(&self, def_id: DefId) -> Generics

Source§

#### fn predicates_of(&self, def_id: DefId) -> GenericPredicates

Source§

#### fn explicit_predicates_of(&self, def_id: DefId) -> GenericPredicates

Source§

#### fn variant_fields(&self, def: VariantDef) -> Vec<FieldDef>

Source§

#### fn eval_target_usize_ty(&self, ty_const: &TyConst) -> Result<u64, Error>

Source§

#### fn try_new_ty_const_uint( &self, value: u128, uint_ty: UintTy, ) -> Result<TyConst, Error>

Source§

#### fn ty_const_pretty(&self, ct: TyConstId) -> String

Source§

#### fn krate(&self, def_id: DefId) -> Crate

Source§

#### fn instance_name(&self, def: InstanceDef, trimmed: bool) -> Symbol

## Implementors§