@@ -172,7 +172,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
172
172
qualname : qualname,
173
173
declaration : None ,
174
174
span : sub_span. unwrap ( ) ,
175
- scope : self . tcx . map . get_parent ( item. id ) ,
175
+ scope : self . tcx . map . get_enclosing_scope ( item. id ) . unwrap ( ) ,
176
176
} )
177
177
}
178
178
ast:: ItemStatic ( ref typ, mt, ref expr) => {
@@ -191,7 +191,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
191
191
name : get_ident ( item. ident ) . to_string ( ) ,
192
192
qualname : qualname,
193
193
span : sub_span. unwrap ( ) ,
194
- scope : self . tcx . map . get_parent ( item. id ) ,
194
+ scope : self . tcx . map . get_enclosing_scope ( item. id ) . unwrap ( ) ,
195
195
value : value,
196
196
type_value : ty_to_string ( & typ) ,
197
197
} )
@@ -205,7 +205,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
205
205
name : get_ident ( item. ident ) . to_string ( ) ,
206
206
qualname : qualname,
207
207
span : sub_span. unwrap ( ) ,
208
- scope : self . tcx . map . get_parent ( item. id ) ,
208
+ scope : self . tcx . map . get_enclosing_scope ( item. id ) . unwrap ( ) ,
209
209
value : self . span_utils . snippet ( expr. span ) ,
210
210
type_value : ty_to_string ( & typ) ,
211
211
} )
@@ -223,7 +223,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
223
223
name : get_ident ( item. ident ) . to_string ( ) ,
224
224
qualname : qualname,
225
225
span : sub_span. unwrap ( ) ,
226
- scope : self . tcx . map . get_parent ( item. id ) ,
226
+ scope : self . tcx . map . get_enclosing_scope ( item. id ) . unwrap ( ) ,
227
227
filename : filename,
228
228
} )
229
229
} ,
@@ -237,14 +237,14 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
237
237
value : val,
238
238
span : sub_span. unwrap ( ) ,
239
239
qualname : enum_name,
240
- scope : self . tcx . map . get_parent ( item. id ) ,
240
+ scope : self . tcx . map . get_enclosing_scope ( item. id ) . unwrap ( ) ,
241
241
} )
242
242
} ,
243
243
ast:: ItemImpl ( _, _, _, ref trait_ref, ref typ, _) => {
244
244
let mut type_data = None ;
245
245
let sub_span;
246
246
247
- let parent = self . tcx . map . get_parent ( item. id ) ;
247
+ let parent = self . tcx . map . get_enclosing_scope ( item. id ) . unwrap ( ) ;
248
248
249
249
match typ. node {
250
250
// Common case impl for a struct or something basic.
@@ -337,7 +337,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
337
337
return Some ( Data :: VariableRefData ( VariableRefData {
338
338
name : get_ident ( ident. node ) . to_string ( ) ,
339
339
span : sub_span. unwrap ( ) ,
340
- scope : self . tcx . map . get_parent ( expr. id ) ,
340
+ scope : self . tcx . map . get_enclosing_scope ( expr. id ) . unwrap ( ) ,
341
341
ref_id : f. id ,
342
342
} ) ) ;
343
343
}
@@ -360,7 +360,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
360
360
let sub_span = self . span_utils . span_for_last_ident ( path. span ) ;
361
361
Some ( Data :: TypeRefData ( TypeRefData {
362
362
span : sub_span. unwrap ( ) ,
363
- scope : self . tcx . map . get_parent ( expr. id ) ,
363
+ scope : self . tcx . map . get_enclosing_scope ( expr. id ) . unwrap ( ) ,
364
364
ref_id : def_id,
365
365
} ) )
366
366
}
0 commit comments