@@ -6,8 +6,8 @@ use std::borrow::{Borrow, Cow};
6
6
use std:: hash:: Hash ;
7
7
use std:: collections:: hash_map:: Entry ;
8
8
9
- use rustc:: hir:: { self , def_id:: DefId } ;
10
9
use rustc:: hir:: def:: Def ;
10
+ use rustc:: hir:: def_id:: DefId ;
11
11
use rustc:: mir:: interpret:: { ConstEvalErr , ErrorHandled } ;
12
12
use rustc:: mir;
13
13
use rustc:: ty:: { self , TyCtxt , query:: TyCtxtAt } ;
@@ -158,9 +158,8 @@ fn eval_body_using_ecx<'mir, 'tcx>(
158
158
ecx. run ( ) ?;
159
159
160
160
// Intern the result
161
- let internally_mutable = !layout. ty . is_freeze ( tcx, param_env, mir. span ) ;
162
- let is_static = tcx. is_static ( cid. instance . def_id ( ) ) ;
163
- let mutability = if is_static == Some ( hir:: Mutability :: MutMutable ) || internally_mutable {
161
+ let mutability = if tcx. is_mutable_static ( cid. instance . def_id ( ) ) ||
162
+ !layout. ty . is_freeze ( tcx, param_env, mir. span ) {
164
163
Mutability :: Mutable
165
164
} else {
166
165
Mutability :: Immutable
@@ -533,7 +532,7 @@ fn validate_and_turn_into_const<'a, 'tcx>(
533
532
}
534
533
// Now that we validated, turn this into a proper constant.
535
534
let def_id = cid. instance . def . def_id ( ) ;
536
- if tcx. is_static ( def_id) . is_some ( ) || cid. promoted . is_some ( ) {
535
+ if tcx. is_static ( def_id) || cid. promoted . is_some ( ) {
537
536
Ok ( mplace_to_const ( & ecx, mplace) )
538
537
} else {
539
538
Ok ( op_to_const ( & ecx, mplace. into ( ) ) )
@@ -628,7 +627,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
628
627
} ) . map_err ( |error| {
629
628
let err = error_to_const_error ( & ecx, error) ;
630
629
// errors in statics are always emitted as fatal errors
631
- if tcx. is_static ( def_id) . is_some ( ) {
630
+ if tcx. is_static ( def_id) {
632
631
// Ensure that if the above error was either `TooGeneric` or `Reported`
633
632
// an error must be reported.
634
633
let reported_err = tcx. sess . track_errors ( || {
0 commit comments