@@ -14,14 +14,14 @@ use hir::def::DefKind;
14
14
use rustc_ast:: Mutability ;
15
15
use rustc_data_structures:: fx:: FxHashSet ;
16
16
use rustc_hir as hir;
17
+ use rustc_middle:: bug;
17
18
use rustc_middle:: mir:: interpret:: ValidationErrorKind :: { self , * } ;
18
19
use rustc_middle:: mir:: interpret:: {
19
20
alloc_range, ExpectedKind , InterpError , InvalidMetaKind , Misalignment , PointerKind , Provenance ,
20
21
UnsupportedOpInfo , ValidationErrorInfo ,
21
22
} ;
22
23
use rustc_middle:: ty:: layout:: { LayoutCx , LayoutOf , TyAndLayout } ;
23
24
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
24
- use rustc_middle:: { bug, span_bug} ;
25
25
use rustc_span:: symbol:: { sym, Symbol } ;
26
26
use rustc_target:: abi:: {
27
27
Abi , FieldIdx , FieldsShape , Scalar as ScalarAbi , Size , VariantIdx , Variants , WrappingRange ,
@@ -617,13 +617,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
617
617
if ptr_expected_mutbl == Mutability :: Mut
618
618
&& alloc_actual_mutbl == Mutability :: Not
619
619
{
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.
627
621
throw_validation_failure ! ( self . path, MutableRefToImmutable ) ;
628
622
}
629
623
// In a const, everything must be completely immutable.
0 commit comments