32
32
//! get confused if the spans from leaf AST nodes occur in multiple places
33
33
//! in the HIR, especially for multiple identifiers.
34
34
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} ;
51
52
use rustc_data_structures:: fx:: FxHashSet ;
52
53
use rustc_data_structures:: sync:: Lrc ;
54
+ use rustc_error_codes:: * ;
55
+ use rustc_errors:: Applicability ;
53
56
use 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 ;
58
61
use syntax:: ast;
59
62
use syntax:: ast:: * ;
60
63
use syntax:: attr;
61
- use syntax:: errors;
62
64
use syntax:: print:: pprust;
63
65
use syntax:: ptr:: P as AstP ;
64
66
use syntax:: sess:: ParseSess ;
65
- use syntax:: source_map:: { respan, DesugaringKind , ExpnData , ExpnKind , Spanned } ;
66
- use syntax:: symbol:: { kw, sym, Symbol } ;
67
67
use syntax:: token:: { self , Nonterminal , Token } ;
68
68
use syntax:: tokenstream:: { TokenStream , TokenTree } ;
69
69
use syntax:: visit:: { self , Visitor } ;
70
- use syntax_pos:: hygiene:: ExpnId ;
71
- use syntax_pos:: Span ;
70
+ use syntax:: { help, struct_span_err, walk_list} ;
72
71
73
- use rustc_error_codes:: * ;
72
+ use log:: { debug, trace} ;
73
+ use smallvec:: { smallvec, SmallVec } ;
74
+ use std:: collections:: BTreeMap ;
75
+ use std:: mem;
74
76
75
77
macro_rules! arena_vec {
76
78
( $this: expr; $( $x: expr) ,* ) => ( {
@@ -84,7 +86,7 @@ mod item;
84
86
85
87
const HIR_ID_COUNTER_LOCKED : u32 = 0xFFFFFFFF ;
86
88
87
- pub struct LoweringContext < ' a , ' hir : ' a > {
89
+ struct LoweringContext < ' a , ' hir : ' a > {
88
90
crate_root : Option < Symbol > ,
89
91
90
92
/// Used to assign IDs to HIR nodes that do not directly correspond to AST nodes.
@@ -235,13 +237,13 @@ enum ImplTraitPosition {
235
237
Other ,
236
238
}
237
239
238
- impl < ' b , ' a > ImplTraitContext < ' b , ' a > {
240
+ impl < ' a > ImplTraitContext < ' _ , ' a > {
239
241
#[ inline]
240
242
fn disallowed ( ) -> Self {
241
243
ImplTraitContext :: Disallowed ( ImplTraitPosition :: Other )
242
244
}
243
245
244
- fn reborrow ( & ' c mut self ) -> ImplTraitContext < ' c , ' a > {
246
+ fn reborrow < ' this > ( & ' this mut self ) -> ImplTraitContext < ' this , ' a > {
245
247
use self :: ImplTraitContext :: * ;
246
248
match self {
247
249
Universal ( params) => Universal ( params) ,
@@ -372,8 +374,8 @@ struct ImplTraitTypeIdVisitor<'a> {
372
374
ids : & ' a mut SmallVec < [ NodeId ; 1 ] > ,
373
375
}
374
376
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 ) {
377
379
match ty. kind {
378
380
TyKind :: Typeof ( _) | TyKind :: BareFn ( _) => return ,
379
381
@@ -383,7 +385,7 @@ impl<'a, 'b> Visitor<'a> for ImplTraitTypeIdVisitor<'b> {
383
385
visit:: walk_ty ( self , ty) ;
384
386
}
385
387
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 ) {
387
389
if let Some ( ref p) = path_segment. args {
388
390
if let GenericArgs :: Parenthesized ( _) = * * p {
389
391
return ;
@@ -687,7 +689,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
687
689
self . resolver . get_import_res ( id) . present_items ( )
688
690
}
689
691
690
- fn diagnostic ( & self ) -> & errors :: Handler {
692
+ fn diagnostic ( & self ) -> & rustc_errors :: Handler {
691
693
self . sess . diagnostic ( )
692
694
}
693
695
@@ -3288,7 +3290,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
3288
3290
}
3289
3291
}
3290
3292
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 > {
3292
3294
// Sorting by span ensures that we get things in order within a
3293
3295
// file, and also puts the files in a sensible order.
3294
3296
let mut body_ids: Vec < _ > = bodies. keys ( ) . cloned ( ) . collect ( ) ;
@@ -3303,7 +3305,7 @@ struct GenericArgsCtor<'hir> {
3303
3305
parenthesized : bool ,
3304
3306
}
3305
3307
3306
- impl GenericArgsCtor < ' hir > {
3308
+ impl < ' hir > GenericArgsCtor < ' hir > {
3307
3309
fn is_empty ( & self ) -> bool {
3308
3310
self . args . is_empty ( ) && self . bindings . is_empty ( ) && !self . parenthesized
3309
3311
}
0 commit comments