@@ -141,7 +141,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
141141 let prefix_iter = || parent_prefix. iter ( ) . cloned ( )
142142 . chain ( use_tree. prefix . segments . iter ( ) . map ( |seg| seg. ident ) ) ;
143143 let prefix_start = prefix_iter ( ) . next ( ) ;
144- let starts_with_non_keyword = prefix_start. map_or ( false , |ident| {
144+ let starts_with_non_keyword = prefix_start. map_or ( false , |( ident, _ ) | {
145145 !ident. is_path_segment_keyword ( )
146146 } ) ;
147147
@@ -202,13 +202,13 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
202202 let source = prefix_start. unwrap ( ) ;
203203
204204 // Helper closure to emit a canary with the given base path.
205- let emit = |this : & mut Self , base : Option < Ident > | {
205+ let emit = |this : & mut Self , base : Option < ( Ident , Option < NodeId > ) > | {
206206 let subclass = SingleImport {
207207 target : Ident {
208208 name : keywords:: Underscore . name ( ) . gensymed ( ) ,
209- span : source. span ,
209+ span : source. 0 . span ,
210210 } ,
211- source,
211+ source : source . 0 ,
212212 result : PerNS {
213213 type_ns : Cell :: new ( Err ( Undetermined ) ) ,
214214 value_ns : Cell :: new ( Err ( Undetermined ) ) ,
@@ -219,7 +219,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
219219 this. add_import_directive (
220220 base. into_iter ( ) . collect ( ) ,
221221 subclass. clone ( ) ,
222- source. span ,
222+ source. 0 . span ,
223223 id,
224224 root_use_tree. span ,
225225 root_id,
@@ -230,15 +230,15 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
230230 } ;
231231
232232 // A single simple `self::x` canary.
233- emit ( self , Some ( Ident {
233+ emit ( self , Some ( ( Ident {
234234 name : keywords:: SelfValue . name ( ) ,
235- span : source. span ,
236- } ) ) ;
235+ span : source. 0 . span ,
236+ } , source . 1 ) ) ) ;
237237
238238 // One special unprefixed canary per block scope around
239239 // the import, to detect items unreachable by `self::x`.
240240 let orig_current_module = self . current_module ;
241- let mut span = source. span . modern ( ) ;
241+ let mut span = source. 0 . span . modern ( ) ;
242242 loop {
243243 match self . current_module . kind {
244244 ModuleKind :: Block ( ..) => emit ( self , None ) ,
@@ -265,10 +265,10 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
265265
266266 if nested {
267267 // Correctly handle `self`
268- if source. name == keywords:: SelfValue . name ( ) {
268+ if source. 0 . name == keywords:: SelfValue . name ( ) {
269269 type_ns_only = true ;
270270
271- let empty_prefix = module_path. last ( ) . map_or ( true , |ident| {
271+ let empty_prefix = module_path. last ( ) . map_or ( true , |( ident, _ ) | {
272272 ident. name == keywords:: CrateRoot . name ( )
273273 } ) ;
274274 if empty_prefix {
@@ -284,20 +284,20 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
284284 // Replace `use foo::self;` with `use foo;`
285285 source = module_path. pop ( ) . unwrap ( ) ;
286286 if rename. is_none ( ) {
287- ident = source;
287+ ident = source. 0 ;
288288 }
289289 }
290290 } else {
291291 // Disallow `self`
292- if source. name == keywords:: SelfValue . name ( ) {
292+ if source. 0 . name == keywords:: SelfValue . name ( ) {
293293 resolve_error ( self ,
294294 use_tree. span ,
295295 ResolutionError :: SelfImportsOnlyAllowedWithin ) ;
296296 }
297297
298298 // Disallow `use $crate;`
299- if source. name == keywords:: DollarCrate . name ( ) && module_path. is_empty ( ) {
300- let crate_root = self . resolve_crate_root ( source) ;
299+ if source. 0 . name == keywords:: DollarCrate . name ( ) && module_path. is_empty ( ) {
300+ let crate_root = self . resolve_crate_root ( source. 0 ) ;
301301 let crate_name = match crate_root. kind {
302302 ModuleKind :: Def ( _, name) => name,
303303 ModuleKind :: Block ( ..) => unreachable ! ( ) ,
@@ -307,11 +307,11 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
307307 // while the current crate doesn't have a valid `crate_name`.
308308 if crate_name != keywords:: Invalid . name ( ) {
309309 // `crate_name` should not be interpreted as relative.
310- module_path. push ( Ident {
310+ module_path. push ( ( Ident {
311311 name : keywords:: CrateRoot . name ( ) ,
312- span : source. span ,
313- } ) ;
314- source. name = crate_name;
312+ span : source. 0 . span ,
313+ } , Some ( self . session . next_node_id ( ) ) ) ) ;
314+ source. 0 . name = crate_name;
315315 }
316316 if rename. is_none ( ) {
317317 ident. name = crate_name;
@@ -332,7 +332,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
332332
333333 let subclass = SingleImport {
334334 target : ident,
335- source,
335+ source : source . 0 ,
336336 result : PerNS {
337337 type_ns : Cell :: new ( Err ( Undetermined ) ) ,
338338 value_ns : Cell :: new ( Err ( Undetermined ) ) ,
@@ -393,6 +393,17 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
393393 }
394394
395395 for & ( ref tree, id) in items {
396+ let prefix = ast:: Path {
397+ segments : module_path. iter ( )
398+ . map ( |ident| {
399+ let mut seg = ast:: PathSegment :: from_ident ( ident. 0 ) ;
400+ seg. id = self . session . next_node_id ( ) ;
401+ seg
402+ } )
403+ . collect ( ) ,
404+ span : path. span ,
405+ } ;
406+
396407 self . build_reduced_graph_for_use_tree (
397408 root_use_tree,
398409 root_id,
0 commit comments