Skip to content

Commit 4da85f4

Browse files
committed
---
yaml --- r: 161142 b: refs/heads/snap-stage3 c: 41fb8f7 h: refs/heads/master v: v3
1 parent f71b6c9 commit 4da85f4

File tree

8 files changed

+183
-193
lines changed

8 files changed

+183
-193
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: 4eb72d268f337a8f117c86a2ac1b98336cab9e9d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: cd7584743710aa2355eb7e09146fea7c338a27e5
4+
refs/heads/snap-stage3: 41fb8f77ee10221db319096ee45a56a29f013564
55
refs/heads/try: 0f0d21c1eb5c7be04d323e0b06faf252ad790af6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/AUTHORS.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ Cole Mickens <[email protected]>
121121
Colin Davidson <[email protected]>
122122
Colin Sherratt <[email protected]>
123123
Conrad Kleinespel <[email protected]>
124-
Corey Farwell <[email protected]>
125124
Corey Ford <[email protected]>
126125
Corey Richardson <[email protected]>
127126

branches/snap-stage3/src/libcore/char.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ pub trait Char {
270270
/// Panics if given a radix > 36.
271271
fn from_digit(num: uint, radix: uint) -> Option<Self>;
272272

273+
/// Converts from `u32` to a `char`
274+
fn from_u32(i: u32) -> Option<char>;
275+
273276
/// Returns the hexadecimal Unicode escape of a character.
274277
///
275278
/// The rules are as follows:
@@ -319,6 +322,9 @@ impl Char for char {
319322

320323
fn from_digit(num: uint, radix: uint) -> Option<char> { from_digit(num, radix) }
321324

325+
#[inline]
326+
fn from_u32(i: u32) -> Option<char> { from_u32(i) }
327+
322328
fn escape_unicode(&self, f: |char|) { escape_unicode(*self, f) }
323329

324330
fn escape_default(&self, f: |char|) { escape_default(*self, f) }

branches/snap-stage3/src/librustc_back/target/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl Target {
250250
} );
251251
($key_name:ident, list) => ( {
252252
let name = (stringify!($key_name)).replace("_", "-");
253-
obj.find(name[]).map(|o| o.as_array()
253+
obj.find(name[]).map(|o| o.as_list()
254254
.map(|v| base.options.$key_name = v.iter()
255255
.map(|a| a.as_string().unwrap().to_string()).collect()
256256
)

branches/snap-stage3/src/librustdoc/html/render.rs

Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ pub struct Context {
101101
/// real location of an item. This is used to allow external links to
102102
/// publicly reused items to redirect to the right location.
103103
pub render_redirect_pages: bool,
104-
/// All the passes that were run on this crate.
105-
pub passes: HashSet<String>,
106104
}
107105

108106
/// Indicates where an external crate can be found.
@@ -192,7 +190,6 @@ pub struct Cache {
192190
parent_stack: Vec<ast::DefId>,
193191
search_index: Vec<IndexItem>,
194192
privmod: bool,
195-
remove_priv: bool,
196193
public_items: NodeSet,
197194

198195
// In rare case where a structure is defined in one module but implemented
@@ -239,13 +236,9 @@ local_data_key!(pub cache_key: Arc<Cache>)
239236
local_data_key!(pub current_location_key: Vec<String> )
240237

241238
/// Generates the documentation for `crate` into the directory `dst`
242-
pub fn run(mut krate: clean::Crate,
243-
external_html: &ExternalHtml,
244-
dst: Path,
245-
passes: HashSet<String>) -> io::IoResult<()> {
239+
pub fn run(mut krate: clean::Crate, external_html: &ExternalHtml, dst: Path) -> io::IoResult<()> {
246240
let mut cx = Context {
247241
dst: dst,
248-
passes: passes,
249242
current: Vec::new(),
250243
root_path: String::new(),
251244
sidebar: HashMap::new(),
@@ -327,7 +320,6 @@ pub fn run(mut krate: clean::Crate,
327320
search_index: Vec::new(),
328321
extern_locations: HashMap::new(),
329322
primitive_locations: HashMap::new(),
330-
remove_priv: cx.passes.contains("strip-private"),
331323
privmod: false,
332324
public_items: public_items,
333325
orphan_methods: Vec::new(),
@@ -775,7 +767,7 @@ impl DocFolder for Cache {
775767
let orig_privmod = match item.inner {
776768
clean::ModuleItem(..) => {
777769
let prev = self.privmod;
778-
self.privmod = prev || (self.remove_priv && item.visibility != Some(ast::Public));
770+
self.privmod = prev || item.visibility != Some(ast::Public);
779771
prev
780772
}
781773
_ => self.privmod,
@@ -1200,7 +1192,7 @@ impl Context {
12001192
// these modules are recursed into, but not rendered normally (a
12011193
// flag on the context).
12021194
if !self.render_redirect_pages {
1203-
self.render_redirect_pages = self.ignore_private_item(&item);
1195+
self.render_redirect_pages = ignore_private_item(&item);
12041196
}
12051197

12061198
match item.inner {
@@ -1219,7 +1211,7 @@ impl Context {
12191211
clean::ModuleItem(m) => m,
12201212
_ => unreachable!()
12211213
};
1222-
this.sidebar = this.build_sidebar(&m);
1214+
this.sidebar = build_sidebar(&m);
12231215
for item in m.items.into_iter() {
12241216
f(this,item);
12251217
}
@@ -1238,40 +1230,6 @@ impl Context {
12381230
_ => Ok(())
12391231
}
12401232
}
1241-
1242-
fn build_sidebar(&self, m: &clean::Module) -> HashMap<String, Vec<String>> {
1243-
let mut map = HashMap::new();
1244-
for item in m.items.iter() {
1245-
if self.ignore_private_item(item) { continue }
1246-
1247-
let short = shortty(item).to_static_str();
1248-
let myname = match item.name {
1249-
None => continue,
1250-
Some(ref s) => s.to_string(),
1251-
};
1252-
let v = match map.entry(short.to_string()) {
1253-
Vacant(entry) => entry.set(Vec::with_capacity(1)),
1254-
Occupied(entry) => entry.into_mut(),
1255-
};
1256-
v.push(myname);
1257-
}
1258-
1259-
for (_, items) in map.iter_mut() {
1260-
items.as_mut_slice().sort();
1261-
}
1262-
return map;
1263-
}
1264-
1265-
fn ignore_private_item(&self, it: &clean::Item) -> bool {
1266-
match it.inner {
1267-
clean::ModuleItem(ref m) => {
1268-
(m.items.len() == 0 && it.doc_value().is_none()) ||
1269-
(self.passes.contains("strip-private") && it.visibility != Some(ast::Public))
1270-
}
1271-
clean::PrimitiveItem(..) => it.visibility != Some(ast::Public),
1272-
_ => false,
1273-
}
1274-
}
12751233
}
12761234

12771235
impl<'a> Item<'a> {
@@ -1485,7 +1443,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
14851443
try!(document(w, item));
14861444

14871445
let mut indices = range(0, items.len()).filter(|i| {
1488-
!cx.ignore_private_item(&items[*i])
1446+
!ignore_private_item(&items[*i])
14891447
}).collect::<Vec<uint>>();
14901448

14911449
fn cmp(i1: &clean::Item, i2: &clean::Item, idx1: uint, idx2: uint) -> Ordering {
@@ -2199,6 +2157,29 @@ impl<'a> fmt::Show for Sidebar<'a> {
21992157
}
22002158
}
22012159

2160+
fn build_sidebar(m: &clean::Module) -> HashMap<String, Vec<String>> {
2161+
let mut map = HashMap::new();
2162+
for item in m.items.iter() {
2163+
if ignore_private_item(item) { continue }
2164+
2165+
let short = shortty(item).to_static_str();
2166+
let myname = match item.name {
2167+
None => continue,
2168+
Some(ref s) => s.to_string(),
2169+
};
2170+
let v = match map.entry(short.to_string()) {
2171+
Vacant(entry) => entry.set(Vec::with_capacity(1)),
2172+
Occupied(entry) => entry.into_mut(),
2173+
};
2174+
v.push(myname);
2175+
}
2176+
2177+
for (_, items) in map.iter_mut() {
2178+
items.as_mut_slice().sort();
2179+
}
2180+
return map;
2181+
}
2182+
22022183
impl<'a> fmt::Show for Source<'a> {
22032184
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
22042185
let Source(s) = *self;
@@ -2233,6 +2214,17 @@ fn item_primitive(w: &mut fmt::Formatter,
22332214
render_methods(w, it)
22342215
}
22352216

2217+
fn ignore_private_item(it: &clean::Item) -> bool {
2218+
match it.inner {
2219+
clean::ModuleItem(ref m) => {
2220+
(m.items.len() == 0 && it.doc_value().is_none()) ||
2221+
it.visibility != Some(ast::Public)
2222+
}
2223+
clean::PrimitiveItem(..) => it.visibility != Some(ast::Public),
2224+
_ => false,
2225+
}
2226+
}
2227+
22362228
fn get_basic_keywords() -> &'static str {
22372229
"rust, rustlang, rust-lang"
22382230
}

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

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ static DEFAULT_PASSES: &'static [&'static str] = &[
8686

8787
local_data_key!(pub analysiskey: core::CrateAnalysis)
8888

89-
struct Output {
90-
krate: clean::Crate,
91-
json_plugins: Vec<plugins::PluginJson>,
92-
passes: Vec<String>,
93-
}
89+
type Output = (clean::Crate, Vec<plugins::PluginJson> );
9490

9591
pub fn main() {
9692
std::os::set_exit_status(main_args(std::os::args().as_slice()));
@@ -233,26 +229,24 @@ pub fn main_args(args: &[String]) -> int {
233229
(false, false) => {}
234230
}
235231

236-
let out = match acquire_input(input, externs, &matches) {
237-
Ok(out) => out,
232+
let (krate, res) = match acquire_input(input, externs, &matches) {
233+
Ok(pair) => pair,
238234
Err(s) => {
239235
println!("input error: {}", s);
240236
return 1;
241237
}
242238
};
243-
let Output { krate, json_plugins, passes, } = out;
239+
244240
info!("going to format");
245241
match matches.opt_str("w").as_ref().map(|s| s.as_slice()) {
246242
Some("html") | None => {
247-
match html::render::run(krate, &external_html, output.unwrap_or(Path::new("doc")),
248-
passes.into_iter().collect()) {
243+
match html::render::run(krate, &external_html, output.unwrap_or(Path::new("doc"))) {
249244
Ok(()) => {}
250245
Err(e) => panic!("failed to generate documentation: {}", e),
251246
}
252247
}
253248
Some("json") => {
254-
match json_output(krate, json_plugins,
255-
output.unwrap_or(Path::new("doc.json"))) {
249+
match json_output(krate, res, output.unwrap_or(Path::new("doc.json"))) {
256250
Ok(()) => {}
257251
Err(e) => panic!("failed to write json: {}", e),
258252
}
@@ -403,8 +397,7 @@ fn rust_input(cratefile: &str, externs: core::Externs, matches: &getopts::Matche
403397

404398
// Run everything!
405399
info!("Executing passes/plugins");
406-
let (krate, json) = pm.run_plugins(krate);
407-
return Output { krate: krate, json_plugins: json, passes: passes, };
400+
return pm.run_plugins(krate);
408401
}
409402

410403
/// This input format purely deserializes the json output file. No passes are
@@ -442,7 +435,7 @@ fn json_input(input: &str) -> Result<Output, String> {
442435
// FIXME: this should read from the "plugins" field, but currently
443436
// Json doesn't implement decodable...
444437
let plugin_output = Vec::new();
445-
Ok(Output { krate: krate, json_plugins: plugin_output, passes: Vec::new(), })
438+
Ok((krate, plugin_output))
446439
}
447440
Ok(..) => {
448441
Err("malformed json input: expected an object at the \

0 commit comments

Comments
 (0)