Skip to content

Commit

Permalink
auto merge of #9833 : alexcrichton/rust/fixes, r=brson
Browse files Browse the repository at this point in the history
Commits have all the fun details
  • Loading branch information
bors committed Oct 17, 2013
2 parents 63e097d + fc06f79 commit c92f216
Show file tree
Hide file tree
Showing 27 changed files with 366 additions and 112 deletions.
2 changes: 2 additions & 0 deletions src/libextra/crypto/digest.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Common functionality related to cryptographic digest functions

use std::vec;

use hex::ToHex;
Expand Down
2 changes: 2 additions & 0 deletions src/libextra/crypto/md5.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[allow(missing_doc)];

use std::iter::range_step;

use cryptoutil::{write_u32_le, read_u32v_le, FixedBuffer, FixedBuffer64, StandardPadding};
Expand Down
2 changes: 2 additions & 0 deletions src/libextra/crypto/sha2.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[allow(missing_doc)];

use std::iter::range_step;

use cryptoutil::{write_u64_be, write_u32_be, read_u64v_be, read_u32v_be, add_bytes_to_bits,
Expand Down
5 changes: 5 additions & 0 deletions src/libextra/enum_set.rs
Expand Up @@ -8,6 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! A structure for holding a set of enum variants
//!
//! This module defines a container which uses an efficient bit mask
//! representation to hold C-like enum variants.

#[deriving(Clone, Eq, IterBytes, ToStr)]
/// A specialized Set implementation to use enum types.
pub struct EnumSet<E> {
Expand Down
2 changes: 2 additions & 0 deletions src/libextra/io_util.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[allow(missing_doc)];

use std::io::{Reader, BytesReader};
use std::io;
use std::cast;
Expand Down
1 change: 1 addition & 0 deletions src/libextra/md4.rs
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[allow(missing_doc)];

use std::vec;

Expand Down
4 changes: 3 additions & 1 deletion src/libextra/rl.rs
Expand Up @@ -8,12 +8,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Bindings for the ability to read lines of input from the console

use std::c_str::ToCStr;
use std::libc::{c_char, c_int};
use std::{local_data, str, rt};
use std::unstable::finally::Finally;

pub mod rustrt {
mod rustrt {
use std::libc::{c_char, c_int};

externfn!(fn linenoise(prompt: *c_char) -> *c_char)
Expand Down
2 changes: 2 additions & 0 deletions src/libextra/stats.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[allow(missing_doc)];

use sort;
use std::cmp;
use std::hashmap;
Expand Down
2 changes: 2 additions & 0 deletions src/libextra/sync.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[allow(missing_doc)];

/**
* The concurrency primitives you know and love.
*
Expand Down
2 changes: 2 additions & 0 deletions src/libextra/terminfo/terminfo.rs
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#[allow(missing_doc)];

use std::hashmap::HashMap;

/// A parsed terminfo entry.
Expand Down
2 changes: 2 additions & 0 deletions src/librustc/driver/driver.rs
Expand Up @@ -200,6 +200,7 @@ pub fn phase_2_configure_and_expand(sess: Session,

pub struct CrateAnalysis {
exp_map2: middle::resolve::ExportMap2,
exported_items: middle::privacy::ExportedItems,
ty_cx: ty::ctxt,
maps: astencode::Maps,
reachable: @mut HashSet<ast::NodeId>
Expand Down Expand Up @@ -311,6 +312,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
CrateAnalysis {
exp_map2: exp_map2,
ty_cx: ty_cx,
exported_items: exported_items,
maps: astencode::Maps {
root_map: root_map,
method_map: method_map,
Expand Down
5 changes: 5 additions & 0 deletions src/librustc/middle/lint.rs
Expand Up @@ -955,6 +955,11 @@ impl Visitor<()> for MissingDocLintVisitor {
~"missing documentation for a function");
}

ast::item_mod(*) if it.vis == ast::public => {
self.check_attrs(it.attrs, it.id, it.span,
~"missing documentation for a module");
}

ast::item_enum(ref edef, _) if it.vis == ast::public => {
self.check_attrs(it.attrs, it.id, it.span,
~"missing documentation for an enum");
Expand Down
38 changes: 31 additions & 7 deletions src/librustdoc/core.rs
Expand Up @@ -10,14 +10,17 @@

use rustc;
use rustc::{driver, middle};
use rustc::middle::privacy;

use syntax::ast;
use syntax::ast_util::is_local;
use syntax::diagnostic;
use syntax::parse;
use syntax;

use std::os;
use std::local_data;
use std::hashmap::HashMap;

use visit_ast::RustdocVisitor;
use clean;
Expand All @@ -29,10 +32,19 @@ pub struct DocContext {
sess: driver::session::Session
}

pub struct CrateAnalysis {
exported_items: privacy::ExportedItems,
reexports: HashMap<ast::NodeId, ~[ast::NodeId]>,
}

/// Parses, resolves, and typechecks the given crate
fn get_ast_and_resolve(cpath: &Path, libs: ~[Path]) -> DocContext {
fn get_ast_and_resolve(cpath: &Path,
libs: ~[Path]) -> (DocContext, CrateAnalysis) {
use syntax::codemap::dummy_spanned;
use rustc::driver::driver::*;
use rustc::driver::driver::{file_input, build_configuration,
phase_1_parse_input,
phase_2_configure_and_expand,
phase_3_run_analysis_passes};

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

let mut crate = phase_1_parse_input(sess, cfg.clone(), &input);
crate = phase_2_configure_and_expand(sess, cfg, crate);
let analysis = phase_3_run_analysis_passes(sess, &crate);
let driver::driver::CrateAnalysis {
exported_items, ty_cx, exp_map2, _
} = phase_3_run_analysis_passes(sess, &crate);

let mut reexports = HashMap::new();
for (&module, nodes) in exp_map2.iter() {
reexports.insert(module, nodes.iter()
.filter(|e| e.reexport && is_local(e.def_id))
.map(|e| e.def_id.node)
.to_owned_vec());
}

debug2!("crate: {:?}", crate);
DocContext { crate: crate, tycx: analysis.ty_cx, sess: sess }
return (DocContext { crate: crate, tycx: ty_cx, sess: sess },
CrateAnalysis { reexports: reexports, exported_items: exported_items });
}

pub fn run_core (libs: ~[Path], path: &Path) -> clean::Crate {
let ctxt = @get_ast_and_resolve(path, libs);
pub fn run_core (libs: ~[Path], path: &Path) -> (clean::Crate, CrateAnalysis) {
let (ctxt, analysis) = get_ast_and_resolve(path, libs);
let ctxt = @ctxt;
debug2!("defmap:");
for (k, v) in ctxt.tycx.def_map.iter() {
debug2!("{:?}: {:?}", k, v);
Expand All @@ -77,5 +101,5 @@ pub fn run_core (libs: ~[Path], path: &Path) -> clean::Crate {
let v = @mut RustdocVisitor::new();
v.visit(&ctxt.crate);

v.clean()
(v.clean(), analysis)
}
4 changes: 2 additions & 2 deletions src/librustdoc/html/render.rs
Expand Up @@ -219,7 +219,7 @@ pub fn run(mut crate: clean::Crate, dst: Path) {
};
mkdir(&cx.dst);

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

0 comments on commit c92f216

Please sign in to comment.