be even more precise about "cast" vs "coercion"
This commit is contained in:
@@ -234,8 +234,8 @@ pub enum ConstraintCategory<'tcx> {
|
||||
UseAsStatic,
|
||||
TypeAnnotation,
|
||||
Cast {
|
||||
/// Whether this cast is a coercion.
|
||||
is_coercion: bool,
|
||||
/// Whether this cast is a coercion that was automatically inserted by the compiler.
|
||||
is_implicit_coercion: bool,
|
||||
/// Whether this is an unsizing coercion and if yes, this contains the target type.
|
||||
/// Region variables are erased to ReErased.
|
||||
#[derive_where(skip)]
|
||||
|
||||
@@ -432,7 +432,7 @@ impl<'tcx> Rvalue<'tcx> {
|
||||
| CastKind::IntToFloat
|
||||
| CastKind::FnPtrToPtr
|
||||
| CastKind::PtrToPtr
|
||||
| CastKind::PointerCoercion(_)
|
||||
| CastKind::PointerCoercion(_, _)
|
||||
| CastKind::PointerWithExposedProvenance
|
||||
| CastKind::Transmute,
|
||||
_,
|
||||
|
||||
@@ -579,7 +579,7 @@ pub struct CopyNonOverlapping<'tcx> {
|
||||
pub count: Operand<'tcx>,
|
||||
}
|
||||
|
||||
/// Represents how a `TerminatorKind::Call` was constructed, used for diagnostics
|
||||
/// Represents how a [`TerminatorKind::Call`] was constructed, used for diagnostics.
|
||||
#[derive(Clone, Copy, TyEncodable, TyDecodable, Debug, PartialEq, Hash, HashStable)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub enum CallSource {
|
||||
@@ -1403,7 +1403,7 @@ pub enum CastKind {
|
||||
/// * [`PointerCoercion::MutToConstPointer`]
|
||||
///
|
||||
/// Both are runtime nops, so should be [`CastKind::PtrToPtr`] instead in runtime MIR.
|
||||
PointerCoercion(PointerCoercion),
|
||||
PointerCoercion(PointerCoercion, CoercionSource),
|
||||
IntToInt,
|
||||
FloatToInt,
|
||||
FloatToFloat,
|
||||
@@ -1419,6 +1419,15 @@ pub enum CastKind {
|
||||
Transmute,
|
||||
}
|
||||
|
||||
/// Represents how a [`CastKind::PointerCoercion`] was constructed, used for diagnostics.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||
pub enum CoercionSource {
|
||||
/// The coercion was manually written by the user with an `as` cast.
|
||||
AsCast,
|
||||
/// The coercion was automatically inserted by the compiler.
|
||||
Implicit,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
|
||||
#[derive(TypeFoldable, TypeVisitable)]
|
||||
pub enum AggregateKind<'tcx> {
|
||||
|
||||
Reference in New Issue
Block a user