@@ -35,7 +35,7 @@ use rustc_data_structures::sync::{self, par_iter, Lrc, ParallelIterator};
35
35
use rustc_hir as hir;
36
36
use rustc_hir:: def:: { CtorKind , CtorOf , DefKind , Res } ;
37
37
use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , LocalDefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
38
- use rustc_hir:: { Constness , GlobMap , Node , TraitMap } ;
38
+ use rustc_hir:: { Constness , GlobMap , Node } ;
39
39
use rustc_index:: vec:: { Idx , IndexVec } ;
40
40
use rustc_macros:: HashStable ;
41
41
use rustc_serialize:: { self , Encodable , Encoder } ;
@@ -46,6 +46,7 @@ use rustc_target::abi::Align;
46
46
use syntax:: ast:: { self , Ident , Name } ;
47
47
use syntax:: node_id:: { NodeId , NodeMap , NodeSet } ;
48
48
49
+ use smallvec:: SmallVec ;
49
50
use std:: cell:: RefCell ;
50
51
use std:: cmp:: { self , Ordering } ;
51
52
use std:: fmt;
@@ -123,11 +124,28 @@ mod sty;
123
124
124
125
// Data types
125
126
127
+ #[ derive( Clone , Debug ) ]
128
+ pub struct TraitCandidate {
129
+ pub def_id : DefId ,
130
+ pub import_ids : SmallVec < [ NodeId ; 1 ] > ,
131
+ }
132
+
133
+ impl TraitCandidate {
134
+ fn node_to_hir_id ( self , definitions : & hir_map:: Definitions ) -> hir:: TraitCandidate {
135
+ let TraitCandidate { def_id, import_ids } = self ;
136
+ let import_ids =
137
+ import_ids. into_iter ( ) . map ( |node_id| definitions. node_to_hir_id ( node_id) ) . collect ( ) ;
138
+ hir:: TraitCandidate { def_id, import_ids }
139
+ }
140
+ }
141
+
142
+ pub type TraitMap = NodeMap < Vec < TraitCandidate > > ;
143
+
126
144
pub struct ResolverOutputs {
127
145
pub definitions : hir_map:: Definitions ,
128
146
pub cstore : Box < CrateStoreDyn > ,
129
147
pub extern_crate_map : NodeMap < CrateNum > ,
130
- pub trait_map : TraitMap < NodeId > ,
148
+ pub trait_map : TraitMap ,
131
149
pub maybe_unused_trait_imports : NodeSet ,
132
150
pub maybe_unused_extern_crates : Vec < ( NodeId , Span ) > ,
133
151
pub export_map : ExportMap < NodeId > ,
0 commit comments