3232//! get confused if the spans from leaf AST nodes occur in multiple places
3333//! in the HIR, especially for multiple identifiers.
3434
35- use crate :: arena:: Arena ;
36- use crate :: dep_graph:: DepGraph ;
37- use crate :: hir:: def:: { DefKind , Namespace , PartialRes , PerNS , Res } ;
38- use crate :: hir:: def_id:: { DefId , DefIndex , CRATE_DEF_INDEX } ;
39- use crate :: hir:: map:: { DefKey , DefPathData , Definitions } ;
40- use crate :: hir:: { self , ParamName } ;
41- use crate :: hir:: { ConstArg , GenericArg } ;
42- use crate :: lint;
43- use crate :: lint:: builtin:: { self , ELIDED_LIFETIMES_IN_PATHS } ;
44- use crate :: middle:: cstore:: CrateStore ;
45- use crate :: session:: config:: nightly_options;
46- use crate :: session:: Session ;
47- use crate :: util:: captures:: Captures ;
48- use crate :: util:: common:: FN_OUTPUT_NAME ;
49- use crate :: util:: nodemap:: { DefIdMap , NodeMap } ;
50- use errors:: Applicability ;
35+ #![ feature( array_value_iter) ]
36+
37+ use rustc:: arena:: Arena ;
38+ use rustc:: dep_graph:: DepGraph ;
39+ use rustc:: hir:: def:: { DefKind , Namespace , PartialRes , PerNS , Res } ;
40+ use rustc:: hir:: def_id:: { DefId , DefIndex , CRATE_DEF_INDEX } ;
41+ use rustc:: hir:: map:: { DefKey , DefPathData , Definitions } ;
42+ use rustc:: hir:: { self , ConstArg , GenericArg , ParamName } ;
43+ use rustc:: lint;
44+ use rustc:: lint:: builtin:: { self , ELIDED_LIFETIMES_IN_PATHS } ;
45+ use rustc:: middle:: cstore:: CrateStore ;
46+ use rustc:: session:: config:: nightly_options;
47+ use rustc:: session:: Session ;
48+ use rustc:: util:: captures:: Captures ;
49+ use rustc:: util:: common:: FN_OUTPUT_NAME ;
50+ use rustc:: util:: nodemap:: { DefIdMap , NodeMap } ;
51+ use rustc:: { bug, span_bug} ;
5152use rustc_data_structures:: fx:: FxHashSet ;
5253use rustc_data_structures:: sync:: Lrc ;
54+ use rustc_error_codes:: * ;
55+ use rustc_errors:: Applicability ;
5356use rustc_index:: vec:: IndexVec ;
54-
55- use smallvec :: SmallVec ;
56- use std :: collections :: BTreeMap ;
57- use std :: mem ;
57+ use rustc_span :: hygiene :: ExpnId ;
58+ use rustc_span :: source_map :: { respan , DesugaringKind , ExpnData , ExpnKind , Spanned } ;
59+ use rustc_span :: symbol :: { kw , sym , Symbol } ;
60+ use rustc_span :: Span ;
5861use syntax:: ast;
5962use syntax:: ast:: * ;
6063use syntax:: attr;
61- use syntax:: errors;
6264use syntax:: print:: pprust;
6365use syntax:: ptr:: P as AstP ;
6466use syntax:: sess:: ParseSess ;
65- use syntax:: source_map:: { respan, DesugaringKind , ExpnData , ExpnKind , Spanned } ;
66- use syntax:: symbol:: { kw, sym, Symbol } ;
6767use syntax:: token:: { self , Nonterminal , Token } ;
6868use syntax:: tokenstream:: { TokenStream , TokenTree } ;
6969use syntax:: visit:: { self , Visitor } ;
70- use syntax_pos:: hygiene:: ExpnId ;
71- use syntax_pos:: Span ;
70+ use syntax:: { help, struct_span_err, walk_list} ;
7271
73- use rustc_error_codes:: * ;
72+ use log:: { debug, trace} ;
73+ use smallvec:: { smallvec, SmallVec } ;
74+ use std:: collections:: BTreeMap ;
75+ use std:: mem;
7476
7577macro_rules! arena_vec {
7678 ( $this: expr; $( $x: expr) ,* ) => ( {
@@ -84,7 +86,7 @@ mod item;
8486
8587const HIR_ID_COUNTER_LOCKED : u32 = 0xFFFFFFFF ;
8688
87- pub struct LoweringContext < ' a , ' hir : ' a > {
89+ struct LoweringContext < ' a , ' hir : ' a > {
8890 crate_root : Option < Symbol > ,
8991
9092 /// Used to assign IDs to HIR nodes that do not directly correspond to AST nodes.
@@ -235,13 +237,13 @@ enum ImplTraitPosition {
235237 Other ,
236238}
237239
238- impl < ' b , ' a > ImplTraitContext < ' b , ' a > {
240+ impl < ' a > ImplTraitContext < ' _ , ' a > {
239241 #[ inline]
240242 fn disallowed ( ) -> Self {
241243 ImplTraitContext :: Disallowed ( ImplTraitPosition :: Other )
242244 }
243245
244- fn reborrow ( & ' c mut self ) -> ImplTraitContext < ' c , ' a > {
246+ fn reborrow < ' this > ( & ' this mut self ) -> ImplTraitContext < ' this , ' a > {
245247 use self :: ImplTraitContext :: * ;
246248 match self {
247249 Universal ( params) => Universal ( params) ,
@@ -372,8 +374,8 @@ struct ImplTraitTypeIdVisitor<'a> {
372374 ids : & ' a mut SmallVec < [ NodeId ; 1 ] > ,
373375}
374376
375- impl < ' a , ' b > Visitor < ' a > for ImplTraitTypeIdVisitor < ' b > {
376- fn visit_ty ( & mut self , ty : & ' a Ty ) {
377+ impl Visitor < ' _ > for ImplTraitTypeIdVisitor < ' _ > {
378+ fn visit_ty ( & mut self , ty : & Ty ) {
377379 match ty. kind {
378380 TyKind :: Typeof ( _) | TyKind :: BareFn ( _) => return ,
379381
@@ -383,7 +385,7 @@ impl<'a, 'b> Visitor<'a> for ImplTraitTypeIdVisitor<'b> {
383385 visit:: walk_ty ( self , ty) ;
384386 }
385387
386- fn visit_path_segment ( & mut self , path_span : Span , path_segment : & ' v PathSegment ) {
388+ fn visit_path_segment ( & mut self , path_span : Span , path_segment : & PathSegment ) {
387389 if let Some ( ref p) = path_segment. args {
388390 if let GenericArgs :: Parenthesized ( _) = * * p {
389391 return ;
@@ -687,7 +689,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
687689 self . resolver . get_import_res ( id) . present_items ( )
688690 }
689691
690- fn diagnostic ( & self ) -> & errors :: Handler {
692+ fn diagnostic ( & self ) -> & rustc_errors :: Handler {
691693 self . sess . diagnostic ( )
692694 }
693695
@@ -3288,7 +3290,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
32883290 }
32893291}
32903292
3291- fn body_ids ( bodies : & BTreeMap < hir:: BodyId , hir:: Body < ' hir > > ) -> Vec < hir:: BodyId > {
3293+ fn body_ids ( bodies : & BTreeMap < hir:: BodyId , hir:: Body < ' _ > > ) -> Vec < hir:: BodyId > {
32923294 // Sorting by span ensures that we get things in order within a
32933295 // file, and also puts the files in a sensible order.
32943296 let mut body_ids: Vec < _ > = bodies. keys ( ) . cloned ( ) . collect ( ) ;
@@ -3303,7 +3305,7 @@ struct GenericArgsCtor<'hir> {
33033305 parenthesized : bool ,
33043306}
33053307
3306- impl GenericArgsCtor < ' hir > {
3308+ impl < ' hir > GenericArgsCtor < ' hir > {
33073309 fn is_empty ( & self ) -> bool {
33083310 self . args . is_empty ( ) && self . bindings . is_empty ( ) && !self . parenthesized
33093311 }
0 commit comments