Skip to content

Commit c92f216

Browse files
committed
auto merge of #9833 : alexcrichton/rust/fixes, r=brson
Commits have all the fun details
2 parents 63e097d + fc06f79 commit c92f216

File tree

27 files changed

+366
-112
lines changed

27 files changed

+366
-112
lines changed

src/libextra/crypto/digest.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+
//! Common functionality related to cryptographic digest functions
12+
1113
use std::vec;
1214

1315
use hex::ToHex;

src/libextra/crypto/md5.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+
#[allow(missing_doc)];
12+
1113
use std::iter::range_step;
1214

1315
use cryptoutil::{write_u32_le, read_u32v_le, FixedBuffer, FixedBuffer64, StandardPadding};

src/libextra/crypto/sha2.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+
#[allow(missing_doc)];
12+
1113
use std::iter::range_step;
1214

1315
use cryptoutil::{write_u64_be, write_u32_be, read_u64v_be, read_u32v_be, add_bytes_to_bits,

src/libextra/enum_set.rs

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

11+
//! A structure for holding a set of enum variants
12+
//!
13+
//! This module defines a container which uses an efficient bit mask
14+
//! representation to hold C-like enum variants.
15+
1116
#[deriving(Clone, Eq, IterBytes, ToStr)]
1217
/// A specialized Set implementation to use enum types.
1318
pub struct EnumSet<E> {

src/libextra/io_util.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+
#[allow(missing_doc)];
12+
1113
use std::io::{Reader, BytesReader};
1214
use std::io;
1315
use std::cast;

src/libextra/md4.rs

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

11+
#[allow(missing_doc)];
1112

1213
use std::vec;
1314

src/libextra/rl.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
//! Bindings for the ability to read lines of input from the console
12+
1113
use std::c_str::ToCStr;
1214
use std::libc::{c_char, c_int};
1315
use std::{local_data, str, rt};
1416
use std::unstable::finally::Finally;
1517

16-
pub mod rustrt {
18+
mod rustrt {
1719
use std::libc::{c_char, c_int};
1820

1921
externfn!(fn linenoise(prompt: *c_char) -> *c_char)

src/libextra/stats.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+
#[allow(missing_doc)];
12+
1113
use sort;
1214
use std::cmp;
1315
use std::hashmap;

src/libextra/sync.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+
#[allow(missing_doc)];
12+
1113
/**
1214
* The concurrency primitives you know and love.
1315
*

src/libextra/terminfo/terminfo.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+
#[allow(missing_doc)];
12+
1113
use std::hashmap::HashMap;
1214

1315
/// A parsed terminfo entry.

src/librustc/driver/driver.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ pub fn phase_2_configure_and_expand(sess: Session,
200200

201201
pub struct CrateAnalysis {
202202
exp_map2: middle::resolve::ExportMap2,
203+
exported_items: middle::privacy::ExportedItems,
203204
ty_cx: ty::ctxt,
204205
maps: astencode::Maps,
205206
reachable: @mut HashSet<ast::NodeId>
@@ -311,6 +312,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
311312
CrateAnalysis {
312313
exp_map2: exp_map2,
313314
ty_cx: ty_cx,
315+
exported_items: exported_items,
314316
maps: astencode::Maps {
315317
root_map: root_map,
316318
method_map: method_map,

src/librustc/middle/lint.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,11 @@ impl Visitor<()> for MissingDocLintVisitor {
955955
~"missing documentation for a function");
956956
}
957957

958+
ast::item_mod(*) if it.vis == ast::public => {
959+
self.check_attrs(it.attrs, it.id, it.span,
960+
~"missing documentation for a module");
961+
}
962+
958963
ast::item_enum(ref edef, _) if it.vis == ast::public => {
959964
self.check_attrs(it.attrs, it.id, it.span,
960965
~"missing documentation for an enum");

src/librustdoc/core.rs

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@
1010

1111
use rustc;
1212
use rustc::{driver, middle};
13+
use rustc::middle::privacy;
1314

1415
use syntax::ast;
16+
use syntax::ast_util::is_local;
1517
use syntax::diagnostic;
1618
use syntax::parse;
1719
use syntax;
1820

1921
use std::os;
2022
use std::local_data;
23+
use std::hashmap::HashMap;
2124

2225
use visit_ast::RustdocVisitor;
2326
use clean;
@@ -29,10 +32,19 @@ pub struct DocContext {
2932
sess: driver::session::Session
3033
}
3134

35+
pub struct CrateAnalysis {
36+
exported_items: privacy::ExportedItems,
37+
reexports: HashMap<ast::NodeId, ~[ast::NodeId]>,
38+
}
39+
3240
/// Parses, resolves, and typechecks the given crate
33-
fn get_ast_and_resolve(cpath: &Path, libs: ~[Path]) -> DocContext {
41+
fn get_ast_and_resolve(cpath: &Path,
42+
libs: ~[Path]) -> (DocContext, CrateAnalysis) {
3443
use syntax::codemap::dummy_spanned;
35-
use rustc::driver::driver::*;
44+
use rustc::driver::driver::{file_input, build_configuration,
45+
phase_1_parse_input,
46+
phase_2_configure_and_expand,
47+
phase_3_run_analysis_passes};
3648

3749
let parsesess = parse::new_parse_sess(None);
3850
let input = file_input(cpath.clone());
@@ -60,14 +72,26 @@ fn get_ast_and_resolve(cpath: &Path, libs: ~[Path]) -> DocContext {
6072

6173
let mut crate = phase_1_parse_input(sess, cfg.clone(), &input);
6274
crate = phase_2_configure_and_expand(sess, cfg, crate);
63-
let analysis = phase_3_run_analysis_passes(sess, &crate);
75+
let driver::driver::CrateAnalysis {
76+
exported_items, ty_cx, exp_map2, _
77+
} = phase_3_run_analysis_passes(sess, &crate);
78+
79+
let mut reexports = HashMap::new();
80+
for (&module, nodes) in exp_map2.iter() {
81+
reexports.insert(module, nodes.iter()
82+
.filter(|e| e.reexport && is_local(e.def_id))
83+
.map(|e| e.def_id.node)
84+
.to_owned_vec());
85+
}
6486

6587
debug2!("crate: {:?}", crate);
66-
DocContext { crate: crate, tycx: analysis.ty_cx, sess: sess }
88+
return (DocContext { crate: crate, tycx: ty_cx, sess: sess },
89+
CrateAnalysis { reexports: reexports, exported_items: exported_items });
6790
}
6891

69-
pub fn run_core (libs: ~[Path], path: &Path) -> clean::Crate {
70-
let ctxt = @get_ast_and_resolve(path, libs);
92+
pub fn run_core (libs: ~[Path], path: &Path) -> (clean::Crate, CrateAnalysis) {
93+
let (ctxt, analysis) = get_ast_and_resolve(path, libs);
94+
let ctxt = @ctxt;
7195
debug2!("defmap:");
7296
for (k, v) in ctxt.tycx.def_map.iter() {
7397
debug2!("{:?}: {:?}", k, v);
@@ -77,5 +101,5 @@ pub fn run_core (libs: ~[Path], path: &Path) -> clean::Crate {
77101
let v = @mut RustdocVisitor::new();
78102
v.visit(&ctxt.crate);
79103

80-
v.clean()
104+
(v.clean(), analysis)
81105
}

src/librustdoc/html/render.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub fn run(mut crate: clean::Crate, dst: Path) {
219219
};
220220
mkdir(&cx.dst);
221221

222-
match crate.module.get_ref().doc_list() {
222+
match crate.module.as_ref().map(|m| m.doc_list().unwrap_or(&[])) {
223223
Some(attrs) => {
224224
for attr in attrs.iter() {
225225
match *attr {
@@ -581,7 +581,7 @@ impl DocFolder for Cache {
581581
clean::StructItem(*) | clean::EnumItem(*) |
582582
clean::TypedefItem(*) | clean::TraitItem(*) |
583583
clean::FunctionItem(*) | clean::ModuleItem(*) |
584-
clean::VariantItem(*) => {
584+
clean::ForeignFunctionItem(*) | clean::VariantItem(*) => {
585585
self.paths.insert(item.id, (self.stack.clone(), shortty(&item)));
586586
}
587587
_ => {}

0 commit comments

Comments
 (0)