-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Remove mir::CastKind::Misc
#102675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove mir::CastKind::Misc
#102675
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { | |
let res = self.pointer_from_exposed_address_cast(&src, cast_ty)?; | ||
self.write_immediate(res, dest)?; | ||
} | ||
|
||
Misc => { | ||
// FIXME: We shouldn't use `misc_cast` for these but handle them separately. | ||
IntToInt | FloatToInt | FloatToFloat | IntToFloat | FnPtrToPtr | PtrToPtr => { | ||
let src = self.read_immediate(src)?; | ||
let res = self.misc_cast(&src, cast_ty)?; | ||
|
||
self.write_immediate(res, dest)?; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -557,7 +557,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { | |
} | ||
Rvalue::Cast(kind, operand, target_type) => { | ||
match kind { | ||
CastKind::Misc => { | ||
CastKind::DynStar => { | ||
// FIXME(dyn-star): make sure nothing needs to be done here. | ||
} | ||
// Nothing to check here | ||
CastKind::PointerFromExposedAddress | ||
| CastKind::PointerExposeAddress | ||
| CastKind::Pointer(_) => {} | ||
_ => { | ||
|
||
let op_ty = operand.ty(self.body, self.tcx); | ||
if op_ty.is_enum() { | ||
self.fail( | ||
|
@@ -568,13 +575,6 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { | |
); | ||
} | ||
} | ||
CastKind::DynStar => { | ||
// FIXME(dyn-star): make sure nothing needs to be done here. | ||
} | ||
// Nothing to check here | ||
CastKind::PointerFromExposedAddress | ||
| CastKind::PointerExposeAddress | ||
| CastKind::Pointer(_) => {} | ||
} | ||
} | ||
Rvalue::Repeat(_, _) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1149,8 +1149,12 @@ pub enum CastKind { | |
Pointer(PointerCast), | ||
/// Cast into a dyn* object. | ||
DynStar, | ||
/// Remaining unclassified casts. | ||
Misc, | ||
IntToInt, | ||
FloatToInt, | ||
FloatToFloat, | ||
IntToFloat, | ||
PtrToPtr, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocking request from the peanut gallery: It's not obvious to me how There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "FIXME: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't investigated the behavior of (_, _) => CastKind::Misc, |
||
FnPtrToPtr, | ||
} | ||
|
||
#[derive(Clone, Debug, PartialEq, Eq, TyEncodable, TyDecodable, Hash, HashStable)] | ||
|
Uh oh!
There was an error while loading. Please reload this page.