Skip to content

Commit db4925a

Browse files
committed
---
yaml --- r: 273057 b: refs/heads/beta c: 27217e5 h: refs/heads/master i: 273055: ad27e4c
1 parent 9fc8e4d commit db4925a

File tree

9 files changed

+17
-95
lines changed

9 files changed

+17
-95
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: beb444eaed6b1b387538435e6eb99fa0cd0f0bed
26+
refs/heads/beta: 27217e580f387e4e0926aacd08703ef6e8a2bf91
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustdoc/visit_ast.rs

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use rustc::middle::stability;
2626
use rustc_front::hir;
2727

2828
use core;
29-
use clean::{Clean, Attributes};
3029
use doctree::*;
3130

3231
// looks to me like the first two of these are actually
@@ -183,15 +182,15 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
183182
please_inline: bool) -> Option<hir::ViewPath_> {
184183
match path {
185184
hir::ViewPathSimple(dst, base) => {
186-
if self.maybe_inline_local(id, Some(dst), false, om, please_inline) {
185+
if self.resolve_id(id, Some(dst), false, om, please_inline) {
187186
None
188187
} else {
189188
Some(hir::ViewPathSimple(dst, base))
190189
}
191190
}
192191
hir::ViewPathList(p, paths) => {
193192
let mine = paths.into_iter().filter(|path| {
194-
!self.maybe_inline_local(path.node.id(), None, false, om,
193+
!self.resolve_id(path.node.id(), None, false, om,
195194
please_inline)
196195
}).collect::<hir::HirVec<hir::PathListItem>>();
197196

@@ -202,8 +201,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
202201
}
203202
}
204203

204+
// these are feature gated anyway
205205
hir::ViewPathGlob(base) => {
206-
if self.maybe_inline_local(id, None, true, om, please_inline) {
206+
if self.resolve_id(id, None, true, om, please_inline) {
207207
None
208208
} else {
209209
Some(hir::ViewPathGlob(base))
@@ -213,32 +213,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
213213

214214
}
215215

216-
/// Tries to resolve the target of a `pub use` statement and inlines the
217-
/// target if it is defined locally and would not be documented otherwise,
218-
/// or when it is specifically requested with `please_inline`.
219-
/// (the latter is the case when the import is marked `doc(inline)`)
220-
///
221-
/// Cross-crate inlining occurs later on during crate cleaning
222-
/// and follows different rules.
223-
///
224-
/// Returns true if the target has been inlined.
225-
fn maybe_inline_local(&mut self, id: ast::NodeId, renamed: Option<ast::Name>,
216+
fn resolve_id(&mut self, id: ast::NodeId, renamed: Option<ast::Name>,
226217
glob: bool, om: &mut Module, please_inline: bool) -> bool {
227-
228-
fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
229-
while let Some(id) = cx.map.get_enclosing_scope(node) {
230-
node = id;
231-
let attrs = cx.map.attrs(node).clean(cx);
232-
if attrs.list_def("doc").has_word("hidden") {
233-
return true;
234-
}
235-
if node == ast::CRATE_NODE_ID {
236-
break;
237-
}
238-
}
239-
false
240-
}
241-
242218
let tcx = match self.cx.tcx_opt() {
243219
Some(tcx) => tcx,
244220
None => return false
@@ -250,15 +226,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
250226
let analysis = match self.analysis {
251227
Some(analysis) => analysis, None => return false
252228
};
253-
254-
let is_private = !analysis.access_levels.is_public(def);
255-
let is_hidden = inherits_doc_hidden(self.cx, def_node_id);
256-
257-
// Only inline if requested or if the item would otherwise be stripped
258-
if !please_inline && !is_private && !is_hidden {
229+
if !please_inline && analysis.access_levels.is_public(def) {
259230
return false
260231
}
261-
262232
if !self.view_item_stack.insert(def_node_id) { return false }
263233

264234
let ret = match tcx.map.get(def_node_id) {
@@ -306,10 +276,10 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
306276
let node = if item.vis == hir::Public {
307277
let please_inline = item.attrs.iter().any(|item| {
308278
match item.meta_item_list() {
309-
Some(list) if &item.name()[..] == "doc" => {
279+
Some(list) => {
310280
list.iter().any(|i| &i.name()[..] == "inline")
311281
}
312-
_ => false,
282+
None => false,
313283
}
314284
});
315285
match self.visit_view_path(node, om, item.id, please_inline) {

branches/beta/src/test/run-pass/cci_nested_exe.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// aux-build:cci_nested_lib.rs
1212

1313

14+
#![feature(globs)]
15+
1416
extern crate cci_nested_lib;
1517
use cci_nested_lib::*;
1618

branches/beta/src/test/run-pass/command-before-exec.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// except according to those terms.
1010

1111
// ignore-windows - this is a unix-specific test
12+
// no-prefer-dynamic - this test breaks with dynamic linking as
13+
// some LD_LIBRARY_PATH entries are relative and it cd's to /.
1214

1315
#![feature(process_exec, libc)]
1416

branches/beta/src/test/rustdoc/inline_local/issue-28537.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.

branches/beta/src/test/rustdoc/inline_local/please_inline.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

branches/beta/src/test/rustdoc/recursion1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "lib"]
12+
#![feature(globs)]
1213

1314
mod m {
1415
pub use self::a::Foo;

branches/beta/src/test/rustdoc/recursion2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "lib"]
12+
#![feature(globs)]
1213

1314
mod m {
1415
pub use self::a::Foo;

branches/beta/src/test/rustdoc/recursion3.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(globs)]
12+
1113
pub mod longhands {
1214
pub use super::*;
1315

0 commit comments

Comments
 (0)