@@ -13,8 +13,8 @@ use std::fmt;
1313use std:: ptr;
1414
1515use rustc_ast:: ast:: Mutability ;
16- use rustc_hir:: def_id:: DefId ;
1716use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
17+ use rustc_hir:: def_id:: DefId ;
1818use rustc_middle:: ty:: { self , Instance , ParamEnv , TyCtxt } ;
1919use rustc_target:: abi:: { Align , HasDataLayout , Size , TargetDataLayout } ;
2020
@@ -119,12 +119,8 @@ pub struct Memory<'mir, 'tcx, M: Machine<'mir, 'tcx>> {
119119 pub tcx : TyCtxt < ' tcx > ,
120120}
121121
122-
123122/// Return the `tcx` allocation containing the initial value of the given static
124- pub fn get_static (
125- tcx : TyCtxt < ' tcx > ,
126- def_id : DefId ,
127- ) -> InterpResult < ' tcx , & ' tcx Allocation > {
123+ pub fn get_static ( tcx : TyCtxt < ' tcx > , def_id : DefId ) -> InterpResult < ' tcx , & ' tcx Allocation > {
128124 trace ! ( "get_static: Need to compute {:?}" , def_id) ;
129125 let instance = Instance :: mono ( tcx, def_id) ;
130126 let gid = GlobalId { instance, promoted : None } ;
@@ -162,7 +158,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
162158 ///
163159 /// This function can fail only if `ptr` points to an `extern static`.
164160 #[ inline]
165- pub fn global_base_pointer ( & self , mut ptr : Pointer ) -> InterpResult < ' tcx , Pointer < M :: PointerTag > > {
161+ pub fn global_base_pointer (
162+ & self ,
163+ mut ptr : Pointer ,
164+ ) -> InterpResult < ' tcx , Pointer < M :: PointerTag > > {
166165 // We need to handle `extern static`.
167166 let ptr = match self . tcx . get_global_alloc ( ptr. alloc_id ) {
168167 Some ( GlobalAlloc :: Static ( def_id) ) if self . tcx . is_thread_local_static ( def_id) => {
@@ -197,7 +196,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
197196 }
198197 } ;
199198 // Functions are global allocations, so make sure we get the right base pointer.
200- // We know this is not an `extern static` so this cannmot fail.
199+ // We know this is not an `extern static` so this cannot fail.
201200 self . global_base_pointer ( Pointer :: from ( id) ) . unwrap ( )
202201 }
203202
@@ -659,7 +658,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
659658 if ptr. offset . bytes ( ) != 0 {
660659 throw_ub ! ( InvalidFunctionPointer ( ptr. erase_tag( ) ) )
661660 }
662- self . get_fn_alloc ( ptr. alloc_id ) . ok_or_else ( || err_ub ! ( InvalidFunctionPointer ( ptr. erase_tag( ) ) ) . into ( ) )
661+ self . get_fn_alloc ( ptr. alloc_id )
662+ . ok_or_else ( || err_ub ! ( InvalidFunctionPointer ( ptr. erase_tag( ) ) ) . into ( ) )
663663 }
664664
665665 pub fn mark_immutable ( & mut self , id : AllocId ) -> InterpResult < ' tcx > {
0 commit comments