@@ -6,8 +6,8 @@ use std::borrow::{Borrow, Cow};
66use std:: hash:: Hash ;
77use std:: collections:: hash_map:: Entry ;
88
9- use rustc:: hir:: { self , def_id:: DefId } ;
109use rustc:: hir:: def:: Def ;
10+ use rustc:: hir:: def_id:: DefId ;
1111use rustc:: mir:: interpret:: { ConstEvalErr , ErrorHandled } ;
1212use rustc:: mir;
1313use rustc:: ty:: { self , TyCtxt , query:: TyCtxtAt } ;
@@ -158,9 +158,8 @@ fn eval_body_using_ecx<'mir, 'tcx>(
158158 ecx. run ( ) ?;
159159
160160 // 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 ) {
164163 Mutability :: Mutable
165164 } else {
166165 Mutability :: Immutable
@@ -533,7 +532,7 @@ fn validate_and_turn_into_const<'a, 'tcx>(
533532 }
534533 // Now that we validated, turn this into a proper constant.
535534 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 ( ) {
537536 Ok ( mplace_to_const ( & ecx, mplace) )
538537 } else {
539538 Ok ( op_to_const ( & ecx, mplace. into ( ) ) )
@@ -628,7 +627,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
628627 } ) . map_err ( |error| {
629628 let err = error_to_const_error ( & ecx, error) ;
630629 // 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) {
632631 // Ensure that if the above error was either `TooGeneric` or `Reported`
633632 // an error must be reported.
634633 let reported_err = tcx. sess . track_errors ( || {
0 commit comments