diff options
| author | Lukas Markeffsky <@> | 2024-09-15 16:47:42 +0200 |
|---|---|---|
| committer | Lukas Markeffsky <@> | 2024-09-24 22:17:55 +0200 |
| commit | 46ecb23198fa83136a266cb5a18675d2d342ab18 (patch) | |
| tree | 7708e1bcb9a223316a7fe8535ed0702c95214778 /compiler/rustc_const_eval | |
| parent | 67bb749c2e1cf503fee64842963dd3e72a417a3f (diff) | |
| download | rust-46ecb23198fa83136a266cb5a18675d2d342ab18.tar.gz rust-46ecb23198fa83136a266cb5a18675d2d342ab18.zip | |
unify dyn* coercions with other pointer coercions
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/check_consts/check.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/cast.rs | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs index 2c33ff9d219..dc7cdee00b2 100644 --- a/compiler/rustc_const_eval/src/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/check_consts/check.rs @@ -447,8 +447,12 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { // These are all okay; they only change the type, not the data. } - Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize), _, _) => { - // Unsizing is implemented for CTFE. + Rvalue::Cast( + CastKind::PointerCoercion(PointerCoercion::Unsize | PointerCoercion::DynStar), + _, + _, + ) => { + // Unsizing and `dyn*` coercions are implemented for CTFE. } Rvalue::Cast(CastKind::PointerExposeProvenance, _, _) => { @@ -458,10 +462,6 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { // Since no pointer can ever get exposed (rejected above), this is easy to support. } - Rvalue::Cast(CastKind::DynStar, _, _) => { - // `dyn*` coercion is implemented for CTFE. - } - Rvalue::Cast(_, _, _) => {} Rvalue::NullaryOp( diff --git a/compiler/rustc_const_eval/src/interpret/cast.rs b/compiler/rustc_const_eval/src/interpret/cast.rs index 70d074cfdc5..25fb5f12d61 100644 --- a/compiler/rustc_const_eval/src/interpret/cast.rs +++ b/compiler/rustc_const_eval/src/interpret/cast.rs @@ -125,7 +125,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { } } - CastKind::DynStar => { + CastKind::PointerCoercion(PointerCoercion::DynStar) => { if let ty::Dynamic(data, _, ty::DynStar) = cast_ty.kind() { // Initial cast from sized to dyn trait let vtable = self.get_vtable_ptr(src.layout.ty, data)?; |
