1616use middle:: borrowck:: * ;
1717use mc = middle:: mem_categorization;
1818use middle:: ty;
19- use syntax:: ast:: { MutImmutable , MutMutable } ;
2019use syntax:: ast;
2120use syntax:: codemap:: Span ;
22- use util:: ppaux:: { note_and_explain_region} ;
2321
2422type R = Result < ( ) , ( ) > ;
2523
@@ -89,12 +87,11 @@ impl<'a> GuaranteeLifetimeContext<'a> {
8987 Ok ( ( ) )
9088 }
9189
92- mc:: cat_deref( base, derefs, mc:: gc_ptr( ptr_mutbl ) ) => {
90+ mc:: cat_deref( base, derefs, mc:: gc_ptr) => {
9391 let base_scope = self . scope ( base) ;
9492
9593 // L-Deref-Managed-Imm-User-Root
9694 let omit_root = (
97- ptr_mutbl == MutImmutable &&
9895 self . bccx . is_subregion_of ( self . loan_region , base_scope) &&
9996 self . is_rvalue_or_immutable ( base) &&
10097 !self . is_moved ( base)
@@ -103,7 +100,7 @@ impl<'a> GuaranteeLifetimeContext<'a> {
103100 if !omit_root {
104101 // L-Deref-Managed-Imm-Compiler-Root
105102 // L-Deref-Managed-Mut-Compiler-Root
106- self . check_root ( cmt, base, derefs, ptr_mutbl , discr_scope)
103+ self . check_root ( cmt, base, derefs, discr_scope)
107104 } else {
108105 debug ! ( "omitting root, base={}, base_scope={:?}" ,
109106 base. repr( self . tcx( ) ) , base_scope) ;
@@ -192,14 +189,12 @@ impl<'a> GuaranteeLifetimeContext<'a> {
192189 cmt_deref : mc:: cmt ,
193190 cmt_base : mc:: cmt ,
194191 derefs : uint ,
195- ptr_mutbl : ast:: Mutability ,
196192 discr_scope : Option < ast:: NodeId > ) -> R {
197- debug ! ( "check_root(cmt_deref={}, cmt_base={}, derefs={:?}, ptr_mutbl={:?}, \
193+ debug ! ( "check_root(cmt_deref={}, cmt_base={}, derefs={:?}, \
198194 discr_scope={:?})",
199195 cmt_deref. repr( self . tcx( ) ) ,
200196 cmt_base. repr( self . tcx( ) ) ,
201197 derefs,
202- ptr_mutbl,
203198 discr_scope) ;
204199
205200 // Make sure that the loan does not exceed the maximum time
@@ -235,19 +230,6 @@ impl<'a> GuaranteeLifetimeContext<'a> {
235230 }
236231 } ;
237232
238- // If we are borrowing the inside of an `@mut` box,
239- // we need to dynamically mark it to prevent incompatible
240- // borrows from happening later.
241- let opt_dyna = match ptr_mutbl {
242- MutImmutable => None ,
243- MutMutable => {
244- match self . loan_mutbl {
245- MutableMutability => Some ( DynaMut ) ,
246- ImmutableMutability | ConstMutability => Some ( DynaImm )
247- }
248- }
249- } ;
250-
251233 // FIXME(#3511) grow to the nearest cleanup scope---this can
252234 // cause observable errors if freezing!
253235 if !self . bccx . tcx . region_maps . is_cleanup_scope ( root_scope) {
@@ -256,29 +238,12 @@ impl<'a> GuaranteeLifetimeContext<'a> {
256238 let cleanup_scope =
257239 self . bccx . tcx . region_maps . cleanup_scope ( root_scope) ;
258240
259- if opt_dyna. is_some ( ) {
260- self . tcx ( ) . sess . span_warn (
261- self . span ,
262- format ! ( "Dynamic freeze scope artifically extended \
263- (see Issue \\ #6248)") ) ;
264- note_and_explain_region (
265- self . bccx . tcx ,
266- "managed value only needs to be frozen for " ,
267- ty:: ReScope ( root_scope) ,
268- "..." ) ;
269- note_and_explain_region (
270- self . bccx . tcx ,
271- "...but due to Issue #6248, it will be frozen for " ,
272- ty:: ReScope ( cleanup_scope) ,
273- "" ) ;
274- }
275-
276241 root_scope = cleanup_scope;
277242 }
278243
279244 // Add a record of what is required
280245 let rm_key = root_map_key { id : cmt_deref. id , derefs : derefs} ;
281- let root_info = RootInfo { scope : root_scope, freeze : opt_dyna } ;
246+ let root_info = RootInfo { scope : root_scope} ;
282247
283248 let mut root_map = self . bccx . root_map . borrow_mut ( ) ;
284249 root_map. get ( ) . insert ( rm_key, root_info) ;
@@ -357,7 +322,7 @@ impl<'a> GuaranteeLifetimeContext<'a> {
357322 }
358323 mc:: cat_downcast( cmt) |
359324 mc:: cat_deref( cmt, _, mc:: uniq_ptr) |
360- mc:: cat_deref( cmt, _, mc:: gc_ptr( .. ) ) |
325+ mc:: cat_deref( cmt, _, mc:: gc_ptr) |
361326 mc:: cat_interior( cmt, _) |
362327 mc:: cat_stack_upvar( cmt) |
363328 mc:: cat_discr( cmt, _) => {
0 commit comments