@@ -65,9 +65,6 @@ struct GuaranteeLifetimeContext<'a> {
65
65
}
66
66
67
67
impl < ' a > GuaranteeLifetimeContext < ' a > {
68
- fn tcx ( & self ) -> & ' a ty:: ctxt {
69
- self . bccx . tcx
70
- }
71
68
72
69
fn check ( & self , cmt : & mc:: cmt , discr_scope : Option < ast:: NodeId > ) -> R {
73
70
//! Main routine. Walks down `cmt` until we find the "guarantor".
@@ -90,29 +87,10 @@ impl<'a> GuaranteeLifetimeContext<'a> {
90
87
Ok ( ( ) )
91
88
}
92
89
93
- mc:: cat_deref( ref base, _, mc:: GcPtr ) => {
94
- let base_scope = self . scope ( base) ;
95
-
96
- // L-Deref-Managed-Imm-User-Root
97
- let omit_root =
98
- self . bccx . is_subregion_of ( self . loan_region , base_scope) &&
99
- self . is_rvalue_or_immutable ( base) &&
100
- !self . is_moved ( base) ;
101
-
102
- if !omit_root {
103
- // L-Deref-Managed-Imm-Compiler-Root
104
- // L-Deref-Managed-Mut-Compiler-Root
105
- Err ( ( ) )
106
- } else {
107
- debug ! ( "omitting root, base={}, base_scope={:?}" ,
108
- base. repr( self . tcx( ) ) , base_scope) ;
109
- Ok ( ( ) )
110
- }
111
- }
112
-
113
90
mc:: cat_downcast( ref base) |
114
91
mc:: cat_deref( ref base, _, mc:: OwnedPtr ) | // L-Deref-Send
115
- mc:: cat_interior( ref base, _) => { // L-Field
92
+ mc:: cat_interior( ref base, _) | // L-Field
93
+ mc:: cat_deref( ref base, _, mc:: GcPtr ) => {
116
94
self . check ( base, discr_scope)
117
95
}
118
96
@@ -174,19 +152,6 @@ impl<'a> GuaranteeLifetimeContext<'a> {
174
152
}
175
153
}
176
154
177
- fn is_rvalue_or_immutable ( & self ,
178
- cmt : & mc:: cmt ) -> bool {
179
- //! We can omit the root on an `@T` value if the location
180
- //! that holds the box is either (1) an rvalue, in which case
181
- //! it is in a non-user-accessible temporary, or (2) an immutable
182
- //! lvalue.
183
-
184
- cmt. mutbl . is_immutable ( ) || match cmt. guarantor ( ) . cat {
185
- mc:: cat_rvalue( ..) => true ,
186
- _ => false
187
- }
188
- }
189
-
190
155
fn check_scope ( & self , max_scope : ty:: Region ) -> R {
191
156
//! Reports an error if `loan_region` is larger than `valid_scope`
192
157
@@ -197,32 +162,6 @@ impl<'a> GuaranteeLifetimeContext<'a> {
197
162
}
198
163
}
199
164
200
- fn is_moved ( & self , cmt : & mc:: cmt ) -> bool {
201
- //! True if `cmt` is something that is potentially moved
202
- //! out of the current stack frame.
203
-
204
- match cmt. guarantor ( ) . cat {
205
- mc:: cat_local( id) |
206
- mc:: cat_arg( id) => {
207
- self . bccx . moved_variables_set . contains ( & id)
208
- }
209
- mc:: cat_rvalue( ..) |
210
- mc:: cat_static_item |
211
- mc:: cat_copied_upvar( ..) |
212
- mc:: cat_deref( ..) |
213
- mc:: cat_upvar( ..) => {
214
- false
215
- }
216
- ref r @ mc:: cat_downcast( ..) |
217
- ref r @ mc:: cat_interior( ..) |
218
- ref r @ mc:: cat_discr( ..) => {
219
- self . tcx ( ) . sess . span_bug (
220
- cmt. span ,
221
- format ! ( "illegal guarantor category: {:?}" , r) ) ;
222
- }
223
- }
224
- }
225
-
226
165
fn scope ( & self , cmt : & mc:: cmt ) -> ty:: Region {
227
166
//! Returns the maximal region scope for the which the
228
167
//! lvalue `cmt` is guaranteed to be valid without any
0 commit comments