Skip to content

Commit 4ba2071

Browse files
committed
---
yaml --- r: 113181 b: refs/heads/snap-stage3 c: 52955dd h: refs/heads/master i: 113179: bbb59e5 v: v3
1 parent fb44aa2 commit 4ba2071

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: abdacecdf86b4b5a4f432560445a24e1c5f4751b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: eb084b1818bb220928d1c99e241192f2cd98b069
4+
refs/heads/snap-stage3: 52955dd661bdbb37778ff32da5746e1012119ba3
55
refs/heads/try: 7c6c492fb2af9a85f21ff952942df3523b22fd17
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustdoc/visit_ast.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use syntax::abi;
1515
use syntax::ast;
1616
use syntax::ast_util;
1717
use syntax::ast_map;
18+
use syntax::attr::AttrMetaMethods;
1819
use syntax::codemap::Span;
1920

2021
use core;
@@ -133,9 +134,17 @@ impl<'a> RustdocVisitor<'a> {
133134
if item.vis != ast::Public {
134135
return om.view_items.push(item.clone());
135136
}
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+
});
136145
let item = match item.node {
137146
ast::ViewItemUse(ref vpath) => {
138-
match self.visit_view_path(*vpath, om) {
147+
match self.visit_view_path(*vpath, om, please_inline) {
139148
None => return,
140149
Some(path) => {
141150
ast::ViewItem {
@@ -151,15 +160,16 @@ impl<'a> RustdocVisitor<'a> {
151160
}
152161

153162
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> {
155165
match path.node {
156166
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 }
158168
}
159169
ast::ViewPathList(ref p, ref paths, ref b) => {
160170
let mut mine = Vec::new();
161171
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) {
163173
mine.push(path.clone());
164174
}
165175
}
@@ -173,14 +183,14 @@ impl<'a> RustdocVisitor<'a> {
173183

174184
// these are feature gated anyway
175185
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 }
177187
}
178188
}
179189
return Some(path);
180190
}
181191

182192
fn resolve_id(&mut self, id: ast::NodeId, glob: bool,
183-
om: &mut Module) -> bool {
193+
om: &mut Module, please_inline: bool) -> bool {
184194
let tcx = match self.cx.maybe_typed {
185195
core::Typed(ref tcx) => tcx,
186196
core::NotTyped(_) => return false
@@ -190,7 +200,9 @@ impl<'a> RustdocVisitor<'a> {
190200
let analysis = match self.analysis {
191201
Some(analysis) => analysis, None => return false
192202
};
193-
if analysis.public_items.contains(&def.node) { return false }
203+
if !please_inline && analysis.public_items.contains(&def.node) {
204+
return false
205+
}
194206

195207
match tcx.map.get(def.node) {
196208
ast_map::NodeItem(it) => {

0 commit comments

Comments
 (0)