Module clippy_utils::ty

source ·
Expand description

Util methods for rustc_middle::ty

Structs

Enums

A signature for a function like type.

Functions

Gets an iterator over all predicates which apply to the given item.
Comes up with an “at least” guesstimate for the type’s size, not taking into account the layout of type parameters.
Checks whether a type can be partially moved.
Walks into ty and returns true if any inner type is an instance of the given adt constructor.
Walks into ty and returns true if any inner type is an instance of the given type, or adt constructor of the same type.
If the expression is function like, get the signature for it.
Gets the value of the given variant.
Resolves <T as Iterator>::Item for T Do not invoke without first verifying that the type implements Iterator
Get the diagnostic name of a type, e.g. sym::HashMap. To check if a type implements a trait marked with a diagnostic item use implements_trait.
This checks whether a given type is known to implement Debug.
Checks whether this type implements Drop.
Returns true if ty has iter or iter_mut methods
Checks whether a type implements a trait. The function returns false in case the type contains an inference variable.
Same as implements_trait but allows using a ParamEnv different from the lint context.
Check if the given type is either core::ffi::c_void, std::os::raw::c_void, or one of the platform specific libc::<platform>::c_void types in libc.
Return true if the passed typ is isize or usize.
Returns true if the given type is a non aggregate primitive (a bool or char, any integer or floating-point number type). For checking aggregation of primitive types (e.g. tuples and slices of primitive type) see is_recursively_primitive_type
Checks if Ty is normalizable. This function is useful to avoid crashes on layout_of.
Returns true if the given type is a primitive (a bool or char, any integer or floating-point number type, a str, or an array, slice, or tuple of those types).
Checks if the type is equal to a diagnostic item. To check if a type implements a trait marked with a diagnostic item use implements_trait.
Checks if the type is equal to a lang item.
Checks if the type is a reference equals to a diagnostic item
Checks if a given type looks safe to be uninitialized.
Normalizes the named associated type in the given impl or trait impl.
Makes the projection type for the named associated type in the given impl or trait impl.
Checks if type is struct, enum or union type with the given def path.
Checks if the drop order for a type matters. Some std types implement drop solely to deallocate memory. For these types, and composites containing them, changing the drop order won’t result in any observable side effects.
Peels off all references on the type. Returns the underlying type and the number of references removed.
Peels off all references on the type. Returns the underlying type, the number of references removed, and whether the pointer is ultimately mutable or not.
Attempts to read the given constant as though it were an enum value.
Returns true if types a and b are same types having same Const generic args, otherwise returns false
Checks if the type is a type parameter implementing FnOnce, but not FnMut.
If the type is function like, get the signature for it.
Returns true if the given type is an unsafe function.
Gets the struct or enum variant from the given Res
Returns the base type for HIR references and pointers.
Returns the base type for references and raw pointers, and count reference depth.