@@ -14,14 +14,14 @@ use hir::def::DefKind;
1414use rustc_ast:: Mutability ;
1515use rustc_data_structures:: fx:: FxHashSet ;
1616use rustc_hir as hir;
17+ use rustc_middle:: bug;
1718use rustc_middle:: mir:: interpret:: ValidationErrorKind :: { self , * } ;
1819use rustc_middle:: mir:: interpret:: {
1920 alloc_range, ExpectedKind , InterpError , InvalidMetaKind , Misalignment , PointerKind , Provenance ,
2021 UnsupportedOpInfo , ValidationErrorInfo ,
2122} ;
2223use rustc_middle:: ty:: layout:: { LayoutCx , LayoutOf , TyAndLayout } ;
2324use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
24- use rustc_middle:: { bug, span_bug} ;
2525use rustc_span:: symbol:: { sym, Symbol } ;
2626use rustc_target:: abi:: {
2727 Abi , FieldIdx , FieldsShape , Scalar as ScalarAbi , Size , VariantIdx , Variants , WrappingRange ,
@@ -617,13 +617,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
617617 if ptr_expected_mutbl == Mutability :: Mut
618618 && alloc_actual_mutbl == Mutability :: Not
619619 {
620- if !self . ecx . tcx . sess . opts . unstable_opts . unleash_the_miri_inside_of_you
621- {
622- span_bug ! (
623- self . ecx. tcx. span,
624- "the static const safety checks accepted mutable references they should not have accepted"
625- ) ;
626- }
620+ // This can actually occur with transmutes.
627621 throw_validation_failure ! ( self . path, MutableRefToImmutable ) ;
628622 }
629623 // In a const, everything must be completely immutable.
0 commit comments