Skip to main content

Module transform

Module transform 

Source
Expand description

Transforms instances and types for LLVM CFI and cross-language LLVM CFI support using Itanium C++ ABI mangling.

For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler, see design document in the tracking issue #89653.

Re-exportsยง

use std::iter; ๐Ÿ”’
use rustc_attr_ir::find_attr; ๐Ÿ”’
use rustc_attr_ir::lang_items::LangItem; ๐Ÿ”’
use rustc_hir as hir; ๐Ÿ”’
use rustc_middle::ty; ๐Ÿ”’
use rustc_middle::ty::AssocContainer; ๐Ÿ”’
use rustc_middle::ty::ExistentialPredicateStableCmpExt as _; ๐Ÿ”’
use rustc_middle::ty::Instance; ๐Ÿ”’
use rustc_middle::ty::IntTy; ๐Ÿ”’
use rustc_middle::ty::List; ๐Ÿ”’
use rustc_middle::ty::TraitRef; ๐Ÿ”’
use rustc_middle::ty::Ty; ๐Ÿ”’
use rustc_middle::ty::TyCtxt; ๐Ÿ”’
use rustc_middle::ty::TypeFoldable; ๐Ÿ”’
use rustc_middle::ty::TypeFolder; ๐Ÿ”’
use rustc_middle::ty::TypeSuperFoldable; ๐Ÿ”’
use rustc_middle::ty::TypeVisitableExt; ๐Ÿ”’
use rustc_middle::ty::UintTy; ๐Ÿ”’
use rustc_middle::ty::Unnormalized; ๐Ÿ”’
use rustc_span::def_id::DefId; ๐Ÿ”’
use rustc_span::DUMMY_SP; ๐Ÿ”’
use rustc_span::bug; ๐Ÿ”’
use rustc_trait_selection::traits; ๐Ÿ”’
use tracing::instrument; ๐Ÿ”’
use tracing::instrument; ๐Ÿ”’
use crate::cfi::typeid::TypeIdOptions; ๐Ÿ”’
use crate::cfi::typeid::itanium_cxx_abi::encode::EncodeTyOptions; ๐Ÿ”’

Structsยง

TransformTy ๐Ÿ”’

Functionsยง

may_be_called_through_vtable ๐Ÿ”’
Returns whether a trait method may be called through a vtable.
trait_object_ty ๐Ÿ”’
Returns the trait object type of a trait reference (i.e., a dyn Trait type with the trait as its principal trait, and the associated types of the trait and its supertraits as its projections), for self to be transformed into when performing type erasure.
transform_closure_like ๐Ÿ”’
Performs type erasure for closure-likes (i.e., instances identified by the def id of a closure, coroutine, or coroutine-closure) by transforming self into a trait object of the Fn, FnMut, FnOnce, Coroutine, Future, Iterator, or AsyncIterator trait that defines the call method they are called through, and the instance into a virtual call to that method, to match the type erasure performed during code generation at call sites (see transform_virtual_call). Returns None if the instance is not a closure-like.
transform_drop_glue ๐Ÿ”’
Adjusts the type ids of DropGlues to a synthesized Drop trait object.
transform_impl_method ๐Ÿ”’
Performs type erasure for trait method implementations in impl blocks by transforming self into a trait object of the trait that defines the method, and the instance into a virtual call to the trait method definition it implements, to match the type erasure performed during code generation at call sites (see transform_virtual_call). Returns None if the instance is not a trait method implementation in an impl block that may be called through a vtable.
transform_instance ๐Ÿ”’
Transforms an instance for LLVM CFI and cross-language LLVM CFI support using Itanium C++ ABI mangling.
transform_provided_method ๐Ÿ”’
Performs type erasure for provided (default) trait methods in trait blocks and synthetic FnPtrShims by transforming self into a trait object of the trait that defines the method, and the instance into a virtual call to the trait method definition, to match the type erasure performed during code generation at call sites (see transform_virtual_call). Returns None if the instance is not a provided (default) trait method or a synthetic FnPtrShim that may be called through a vtable.
transform_virtual_call ๐Ÿ”’
Performs type erasure for virtual method calls (i.e., calls to methods through trait objects) by transforming self into a trait object of the trait that defines the method, to match the type erasure performed on declaration/definition (see transform_impl_method, transform_provided_method, and transform_closure_like).
transform_vtable_shim ๐Ÿ”’
Adjusts the type ids of VTableShims to the type id expected in the call sites for the entry in the vtable by transforming self into a trait object of the trait that defines the method, to match the type erasure performed during code generation at call sites (see transform_virtual_call).

Type Aliasesยง

TransformTyOptions ๐Ÿ”’
Options for transform_ty.