@@ -15,6 +15,7 @@ use syntax::abi;
15
15
use syntax:: ast;
16
16
use syntax:: ast_util;
17
17
use syntax:: ast_map;
18
+ use syntax:: attr:: AttrMetaMethods ;
18
19
use syntax:: codemap:: Span ;
19
20
20
21
use core;
@@ -133,9 +134,17 @@ impl<'a> RustdocVisitor<'a> {
133
134
if item. vis != ast:: Public {
134
135
return om. view_items . push ( item. clone ( ) ) ;
135
136
}
137
+ let please_inline = item. attrs . iter ( ) . any ( |item| {
138
+ match item. meta_item_list ( ) {
139
+ Some ( list) => {
140
+ list. iter ( ) . any ( |i| i. name ( ) . get ( ) == "inline" )
141
+ }
142
+ None => false ,
143
+ }
144
+ } ) ;
136
145
let item = match item. node {
137
146
ast:: ViewItemUse ( ref vpath) => {
138
- match self . visit_view_path ( * vpath, om) {
147
+ match self . visit_view_path ( * vpath, om, please_inline ) {
139
148
None => return ,
140
149
Some ( path) => {
141
150
ast:: ViewItem {
@@ -151,15 +160,16 @@ impl<'a> RustdocVisitor<'a> {
151
160
}
152
161
153
162
fn visit_view_path ( & mut self , path : @ast:: ViewPath ,
154
- om : & mut Module ) -> Option < @ast:: ViewPath > {
163
+ om : & mut Module ,
164
+ please_inline : bool ) -> Option < @ast:: ViewPath > {
155
165
match path. node {
156
166
ast:: ViewPathSimple ( _, _, id) => {
157
- if self . resolve_id ( id, false , om) { return None }
167
+ if self . resolve_id ( id, false , om, please_inline ) { return None }
158
168
}
159
169
ast:: ViewPathList ( ref p, ref paths, ref b) => {
160
170
let mut mine = Vec :: new ( ) ;
161
171
for path in paths. iter ( ) {
162
- if !self . resolve_id ( path. node . id , false , om) {
172
+ if !self . resolve_id ( path. node . id , false , om, please_inline ) {
163
173
mine. push ( path. clone ( ) ) ;
164
174
}
165
175
}
@@ -173,14 +183,14 @@ impl<'a> RustdocVisitor<'a> {
173
183
174
184
// these are feature gated anyway
175
185
ast:: ViewPathGlob ( _, id) => {
176
- if self . resolve_id ( id, true , om) { return None }
186
+ if self . resolve_id ( id, true , om, please_inline ) { return None }
177
187
}
178
188
}
179
189
return Some ( path) ;
180
190
}
181
191
182
192
fn resolve_id ( & mut self , id : ast:: NodeId , glob : bool ,
183
- om : & mut Module ) -> bool {
193
+ om : & mut Module , please_inline : bool ) -> bool {
184
194
let tcx = match self . cx . maybe_typed {
185
195
core:: Typed ( ref tcx) => tcx,
186
196
core:: NotTyped ( _) => return false
@@ -190,7 +200,9 @@ impl<'a> RustdocVisitor<'a> {
190
200
let analysis = match self . analysis {
191
201
Some ( analysis) => analysis, None => return false
192
202
} ;
193
- if analysis. public_items . contains ( & def. node ) { return false }
203
+ if !please_inline && analysis. public_items . contains ( & def. node ) {
204
+ return false
205
+ }
194
206
195
207
match tcx. map . get ( def. node ) {
196
208
ast_map:: NodeItem ( it) => {
0 commit comments