Skip to content

Commit cbf4531

Browse files
committed
---
yaml --- r: 81275 b: refs/heads/snap-stage3 c: e523f99 h: refs/heads/master i: 81273: 994e29a 81271: d287aa8 v: v3
1 parent dd77b6b commit cbf4531

File tree

13 files changed

+215
-140
lines changed

13 files changed

+215
-140
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: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 350b5438cd0b2a9ed33c0cdb1b36d7e4cbe1ab2b
4+
refs/heads/snap-stage3: e523f99fb9e63d3079404abc3df9d4a208b17a8a
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/docs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ RUSTDOC = $(HBIN2_H_$(CFG_BUILD_TRIPLE))/rustdoc$(X_$(CFG_BUILD_TRIPLE))
227227
define libdoc
228228
doc/$(1)/index.html: $$(RUSTDOC) $$(TLIB2_T_$(3)_H_$(3))/$(CFG_STDLIB_$(3))
229229
@$$(call E, rustdoc: $$@)
230-
$(Q)$(RUSTDOC) html $(2)
230+
$(Q)$(RUSTDOC) $(2)
231231

232232
DOCS += doc/$(1)/index.html
233233
endef

branches/snap-stage3/mk/platform.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ CFG_PATH_MUNGE_mips-unknown-linux-gnu := true
343343
CFG_LDPATH_mips-unknown-linux-gnu :=
344344
CFG_RUN_mips-unknown-linux-gnu=
345345
CFG_RUN_TARG_mips-unknown-linux-gnu=
346-
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32 -Z soft-float
346+
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32
347347

348348
# i686-pc-mingw32 configuration
349349
CC_i686-pc-mingw32=$(CC)

branches/snap-stage3/src/librustc/back/link.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ pub mod write {
264264
session::Default => lib::llvm::CodeGenLevelDefault,
265265
session::Aggressive => lib::llvm::CodeGenLevelAggressive,
266266
};
267-
let use_softfp = sess.opts.debugging_opts & session::use_softfp != 0;
268267

269268
let tm = do sess.targ_cfg.target_strs.target_triple.with_c_str |T| {
270269
do sess.opts.target_cpu.with_c_str |CPU| {
@@ -274,8 +273,7 @@ pub mod write {
274273
lib::llvm::CodeModelDefault,
275274
lib::llvm::RelocPIC,
276275
OptLevel,
277-
true,
278-
use_softfp
276+
true
279277
)
280278
}
281279
}

branches/snap-stage3/src/librustc/driver/session.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ pub static print_llvm_passes: uint = 1 << 26;
8080
pub static no_vectorize_loops: uint = 1 << 27;
8181
pub static no_vectorize_slp: uint = 1 << 28;
8282
pub static no_prepopulate_passes: uint = 1 << 29;
83-
pub static use_softfp: uint = 1 << 30;
8483

8584
pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
8685
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
@@ -136,7 +135,6 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
136135
(~"no-vectorize-slp",
137136
~"Don't run LLVM's SLP vectorization passes",
138137
no_vectorize_slp),
139-
(~"soft-float", ~"Generate software floating point library calls", use_softfp),
140138
]
141139
}
142140

branches/snap-stage3/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,8 +2149,7 @@ pub mod llvm {
21492149
Model: CodeGenModel,
21502150
Reloc: RelocMode,
21512151
Level: CodeGenOptLevel,
2152-
EnableSegstk: bool,
2153-
UseSoftFP: bool) -> TargetMachineRef;
2152+
EnableSegstk: bool) -> TargetMachineRef;
21542153
pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
21552154
pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef,
21562155
PM: PassManagerRef,

branches/snap-stage3/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,7 @@ fn encode_crate_deps(ecx: &EncodeContext,
15741574
fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
15751575
ebml_w.start_tag(tag_lang_items);
15761576

1577-
do ecx.tcx.lang_items.each_item |def_id, i| {
1577+
for (i, def_id) in ecx.tcx.lang_items.items() {
15781578
for id in def_id.iter() {
15791579
if id.crate == LOCAL_CRATE {
15801580
ebml_w.start_tag(tag_lang_items_item);
@@ -1590,8 +1590,7 @@ fn encode_lang_items(ecx: &EncodeContext, ebml_w: &mut writer::Encoder) {
15901590
ebml_w.end_tag(); // tag_lang_items_item
15911591
}
15921592
}
1593-
true
1594-
};
1593+
}
15951594

15961595
ebml_w.end_tag(); // tag_lang_items
15971596
}

branches/snap-stage3/src/librustc/middle/lang_items.rs

Lines changed: 50 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ use syntax::visit;
3232
use syntax::visit::Visitor;
3333

3434
use std::hashmap::HashMap;
35+
use std::iter::Enumerate;
36+
use std::vec;
3537

3638
pub enum LangItem {
3739
FreezeTraitLangItem, // 0
@@ -92,8 +94,8 @@ impl LanguageItems {
9294
}
9395
}
9496

95-
pub fn each_item(&self, f: &fn(Option<DefId>, uint) -> bool) -> bool {
96-
self.items.iter().enumerate().advance(|(i, &item)| f(item, i))
97+
pub fn items<'a>(&'a self) -> Enumerate<vec::VecIterator<'a, Option<DefId>>> {
98+
self.items.iter().enumerate()
9799
}
98100

99101
pub fn item_name(index: uint) -> &'static str {
@@ -298,7 +300,7 @@ struct LanguageItemCollector<'self> {
298300
crate: &'self Crate,
299301
session: Session,
300302

301-
item_refs: HashMap<@str, uint>,
303+
item_refs: HashMap<&'static str, uint>,
302304
}
303305

304306
struct LanguageItemVisitor<'self> {
@@ -327,51 +329,51 @@ impl<'self> LanguageItemCollector<'self> {
327329
-> LanguageItemCollector<'a> {
328330
let mut item_refs = HashMap::new();
329331

330-
item_refs.insert(@"freeze", FreezeTraitLangItem as uint);
331-
item_refs.insert(@"send", SendTraitLangItem as uint);
332-
item_refs.insert(@"sized", SizedTraitLangItem as uint);
333-
334-
item_refs.insert(@"drop", DropTraitLangItem as uint);
335-
336-
item_refs.insert(@"add", AddTraitLangItem as uint);
337-
item_refs.insert(@"sub", SubTraitLangItem as uint);
338-
item_refs.insert(@"mul", MulTraitLangItem as uint);
339-
item_refs.insert(@"div", DivTraitLangItem as uint);
340-
item_refs.insert(@"rem", RemTraitLangItem as uint);
341-
item_refs.insert(@"neg", NegTraitLangItem as uint);
342-
item_refs.insert(@"not", NotTraitLangItem as uint);
343-
item_refs.insert(@"bitxor", BitXorTraitLangItem as uint);
344-
item_refs.insert(@"bitand", BitAndTraitLangItem as uint);
345-
item_refs.insert(@"bitor", BitOrTraitLangItem as uint);
346-
item_refs.insert(@"shl", ShlTraitLangItem as uint);
347-
item_refs.insert(@"shr", ShrTraitLangItem as uint);
348-
item_refs.insert(@"index", IndexTraitLangItem as uint);
349-
350-
item_refs.insert(@"eq", EqTraitLangItem as uint);
351-
item_refs.insert(@"ord", OrdTraitLangItem as uint);
352-
353-
item_refs.insert(@"str_eq", StrEqFnLangItem as uint);
354-
item_refs.insert(@"uniq_str_eq", UniqStrEqFnLangItem as uint);
355-
item_refs.insert(@"fail_", FailFnLangItem as uint);
356-
item_refs.insert(@"fail_bounds_check",
332+
item_refs.insert("freeze", FreezeTraitLangItem as uint);
333+
item_refs.insert("send", SendTraitLangItem as uint);
334+
item_refs.insert("sized", SizedTraitLangItem as uint);
335+
336+
item_refs.insert("drop", DropTraitLangItem as uint);
337+
338+
item_refs.insert("add", AddTraitLangItem as uint);
339+
item_refs.insert("sub", SubTraitLangItem as uint);
340+
item_refs.insert("mul", MulTraitLangItem as uint);
341+
item_refs.insert("div", DivTraitLangItem as uint);
342+
item_refs.insert("rem", RemTraitLangItem as uint);
343+
item_refs.insert("neg", NegTraitLangItem as uint);
344+
item_refs.insert("not", NotTraitLangItem as uint);
345+
item_refs.insert("bitxor", BitXorTraitLangItem as uint);
346+
item_refs.insert("bitand", BitAndTraitLangItem as uint);
347+
item_refs.insert("bitor", BitOrTraitLangItem as uint);
348+
item_refs.insert("shl", ShlTraitLangItem as uint);
349+
item_refs.insert("shr", ShrTraitLangItem as uint);
350+
item_refs.insert("index", IndexTraitLangItem as uint);
351+
352+
item_refs.insert("eq", EqTraitLangItem as uint);
353+
item_refs.insert("ord", OrdTraitLangItem as uint);
354+
355+
item_refs.insert("str_eq", StrEqFnLangItem as uint);
356+
item_refs.insert("uniq_str_eq", UniqStrEqFnLangItem as uint);
357+
item_refs.insert("fail_", FailFnLangItem as uint);
358+
item_refs.insert("fail_bounds_check",
357359
FailBoundsCheckFnLangItem as uint);
358-
item_refs.insert(@"exchange_malloc", ExchangeMallocFnLangItem as uint);
359-
item_refs.insert(@"closure_exchange_malloc", ClosureExchangeMallocFnLangItem as uint);
360-
item_refs.insert(@"exchange_free", ExchangeFreeFnLangItem as uint);
361-
item_refs.insert(@"malloc", MallocFnLangItem as uint);
362-
item_refs.insert(@"free", FreeFnLangItem as uint);
363-
item_refs.insert(@"borrow_as_imm", BorrowAsImmFnLangItem as uint);
364-
item_refs.insert(@"borrow_as_mut", BorrowAsMutFnLangItem as uint);
365-
item_refs.insert(@"return_to_mut", ReturnToMutFnLangItem as uint);
366-
item_refs.insert(@"check_not_borrowed",
360+
item_refs.insert("exchange_malloc", ExchangeMallocFnLangItem as uint);
361+
item_refs.insert("closure_exchange_malloc", ClosureExchangeMallocFnLangItem as uint);
362+
item_refs.insert("exchange_free", ExchangeFreeFnLangItem as uint);
363+
item_refs.insert("malloc", MallocFnLangItem as uint);
364+
item_refs.insert("free", FreeFnLangItem as uint);
365+
item_refs.insert("borrow_as_imm", BorrowAsImmFnLangItem as uint);
366+
item_refs.insert("borrow_as_mut", BorrowAsMutFnLangItem as uint);
367+
item_refs.insert("return_to_mut", ReturnToMutFnLangItem as uint);
368+
item_refs.insert("check_not_borrowed",
367369
CheckNotBorrowedFnLangItem as uint);
368-
item_refs.insert(@"strdup_uniq", StrDupUniqFnLangItem as uint);
369-
item_refs.insert(@"record_borrow", RecordBorrowFnLangItem as uint);
370-
item_refs.insert(@"unrecord_borrow", UnrecordBorrowFnLangItem as uint);
371-
item_refs.insert(@"start", StartFnLangItem as uint);
372-
item_refs.insert(@"ty_desc", TyDescStructLangItem as uint);
373-
item_refs.insert(@"ty_visitor", TyVisitorTraitLangItem as uint);
374-
item_refs.insert(@"opaque", OpaqueStructLangItem as uint);
370+
item_refs.insert("strdup_uniq", StrDupUniqFnLangItem as uint);
371+
item_refs.insert("record_borrow", RecordBorrowFnLangItem as uint);
372+
item_refs.insert("unrecord_borrow", UnrecordBorrowFnLangItem as uint);
373+
item_refs.insert("start", StartFnLangItem as uint);
374+
item_refs.insert("ty_desc", TyDescStructLangItem as uint);
375+
item_refs.insert("ty_visitor", TyVisitorTraitLangItem as uint);
376+
item_refs.insert("opaque", OpaqueStructLangItem as uint);
375377

376378
LanguageItemCollector {
377379
crate: crate,
@@ -416,8 +418,8 @@ impl<'self> LanguageItemCollector<'self> {
416418
return; // Didn't match.
417419
}
418420

419-
let item_index = self.item_refs.find(&value).map_move(|x| *x);
420-
// prevent borrow checker from considering ^~~~~~~~~~~
421+
let item_index = self.item_refs.find_equiv(&value).map_move(|x| *x);
422+
// prevent borrow checker from considering ^~~~~~~~~~~
421423
// self to be borrowed (annoying)
422424

423425
match item_index {

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

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct Cache {
7676
struct SourceCollector<'self> {
7777
seen: HashSet<~str>,
7878
dst: Path,
79-
cx: &'self Context,
79+
cx: &'self mut Context,
8080
}
8181

8282
struct Item<'self> { cx: &'self Context, item: &'self clean::Item, }
@@ -179,15 +179,15 @@ pub fn run(mut crate: clean::Crate, dst: Path) {
179179
w.flush();
180180
}
181181

182-
if cx.include_sources {
182+
{
183183
let dst = cx.dst.push("src");
184184
mkdir(&dst);
185185
let dst = dst.push(crate.name);
186186
mkdir(&dst);
187187
let mut folder = SourceCollector {
188188
dst: dst,
189189
seen: HashSet::new(),
190-
cx: &cx,
190+
cx: &mut cx,
191191
};
192192
crate = folder.fold_crate(crate);
193193
}
@@ -229,16 +229,28 @@ fn clean_srcpath(src: &str, f: &fn(&str)) {
229229

230230
impl<'self> DocFolder for SourceCollector<'self> {
231231
fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
232-
if !self.seen.contains(&item.source.filename) {
233-
self.emit_source(item.source.filename);
232+
if self.cx.include_sources && !self.seen.contains(&item.source.filename) {
233+
// If it turns out that we couldn't read this file, then we probably
234+
// can't read any of the files (generating html output from json or
235+
// something like that), so just don't include sources for the
236+
// entire crate. The other option is maintaining this mapping on a
237+
// per-file basis, but that's probably not worth it...
238+
self.cx.include_sources = self.emit_source(item.source.filename);
234239
self.seen.insert(item.source.filename.clone());
240+
241+
if !self.cx.include_sources {
242+
println!("warning: source code was requested to be rendered, \
243+
but `{}` is a missing source file.",
244+
item.source.filename);
245+
println!(" skipping rendering of source code");
246+
}
235247
}
236248
self.fold_item_recur(item)
237249
}
238250
}
239251

240252
impl<'self> SourceCollector<'self> {
241-
fn emit_source(&self, filename: &str) {
253+
fn emit_source(&mut self, filename: &str) -> bool {
242254
let p = Path(filename);
243255

244256
// Read the contents of the file
@@ -251,7 +263,11 @@ impl<'self> SourceCollector<'self> {
251263
// If we couldn't open this file, then just returns because it
252264
// probably means that it's some standard library macro thing and we
253265
// can't have the source to it anyway.
254-
let mut r = match r { Some(r) => r, None => return };
266+
let mut r = match r {
267+
Some(r) => r,
268+
// eew macro hacks
269+
None => return filename == "<std-macros>"
270+
};
255271

256272
// read everything
257273
loop {
@@ -283,6 +299,7 @@ impl<'self> SourceCollector<'self> {
283299
};
284300
layout::render(&mut w as &mut io::Writer, &self.cx.layout,
285301
&page, &(""), &Source(contents.as_slice()));
302+
return true;
286303
}
287304
}
288305

@@ -1050,7 +1067,7 @@ fn render_method(w: &mut io::Writer, meth: &clean::Item, withlink: bool) {
10501067

10511068
fn item_struct(w: &mut io::Writer, it: &clean::Item, s: &clean::Struct) {
10521069
write!(w, "<pre class='struct'>");
1053-
render_struct(w, it, Some(&s.generics), s.struct_type, s.fields, "");
1070+
render_struct(w, it, Some(&s.generics), s.struct_type, s.fields, "", true);
10541071
write!(w, "</pre>");
10551072

10561073
document(w, it);
@@ -1082,8 +1099,10 @@ fn item_enum(w: &mut io::Writer, it: &clean::Item, e: &clean::Enum) {
10821099
write!(w, "),\n");
10831100
}
10841101
clean::StructVariant(ref s) => {
1102+
write!(w, " ");
10851103
render_struct(w, v, None, s.struct_type, s.fields,
1086-
" ");
1104+
" ", false);
1105+
write!(w, ",\n");
10871106
}
10881107
}
10891108
}
@@ -1102,17 +1121,19 @@ fn render_struct(w: &mut io::Writer, it: &clean::Item,
11021121
g: Option<&clean::Generics>,
11031122
ty: doctree::StructType,
11041123
fields: &[clean::Item],
1105-
tab: &str) {
1106-
write!(w, "{}struct {}",
1124+
tab: &str,
1125+
structhead: bool) {
1126+
write!(w, "{}{}{}",
11071127
VisSpace(it.visibility),
1128+
if structhead {"struct "} else {""},
11081129
it.name.get_ref().as_slice());
11091130
match g {
11101131
Some(g) => write!(w, "{}", *g),
11111132
None => {}
11121133
}
11131134
match ty {
11141135
doctree::Plain => {
1115-
write!(w, " \\{\n");
1136+
write!(w, " \\{\n{}", tab);
11161137
for field in fields.iter() {
11171138
match field.inner {
11181139
clean::StructFieldItem(ref ty) => {

0 commit comments

Comments
 (0)