Skip to content

Commit dd77b6b

Browse files
committed
---
yaml --- r: 81274 b: refs/heads/snap-stage3 c: 350b543 h: refs/heads/master v: v3
1 parent 994e29a commit dd77b6b

File tree

11 files changed

+96
-106
lines changed

11 files changed

+96
-106
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: 23cb72b4599f61fbeab4d8f0af8937e76a3cb364
4+
refs/heads/snap-stage3: 350b5438cd0b2a9ed33c0cdb1b36d7e4cbe1ab2b
55
refs/heads/try: 70152ff55722878cde684ee6462c14c65f2c4729
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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
346+
RUSTC_FLAGS_mips-unknown-linux-gnu := --linker=$(CXX_mips-unknown-linux-gnu) --target-cpu mips32r2 --target-feature +mips32r2,+o32 -Z soft-float
347347

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

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ 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;
267268

268269
let tm = do sess.targ_cfg.target_strs.target_triple.with_c_str |T| {
269270
do sess.opts.target_cpu.with_c_str |CPU| {
@@ -273,7 +274,8 @@ pub mod write {
273274
lib::llvm::CodeModelDefault,
274275
lib::llvm::RelocPIC,
275276
OptLevel,
276-
true
277+
true,
278+
use_softfp
277279
)
278280
}
279281
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ 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;
8384

8485
pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
8586
~[(~"verbose", ~"in general, enable more debug printouts", verbose),
@@ -135,6 +136,7 @@ pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] {
135136
(~"no-vectorize-slp",
136137
~"Don't run LLVM's SLP vectorization passes",
137138
no_vectorize_slp),
139+
(~"soft-float", ~"Generate software floating point library calls", use_softfp),
138140
]
139141
}
140142

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

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

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

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

15951596
ebml_w.end_tag(); // tag_lang_items
15961597
}

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

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

3434
use std::hashmap::HashMap;
35-
use std::iter::Enumerate;
36-
use std::vec;
3735

3836
pub enum LangItem {
3937
FreezeTraitLangItem, // 0
@@ -94,8 +92,8 @@ impl LanguageItems {
9492
}
9593
}
9694

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

10199
pub fn item_name(index: uint) -> &'static str {
@@ -300,7 +298,7 @@ struct LanguageItemCollector<'self> {
300298
crate: &'self Crate,
301299
session: Session,
302300

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

306304
struct LanguageItemVisitor<'self> {
@@ -329,51 +327,51 @@ impl<'self> LanguageItemCollector<'self> {
329327
-> LanguageItemCollector<'a> {
330328
let mut item_refs = HashMap::new();
331329

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",
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",
359357
FailBoundsCheckFnLangItem as uint);
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",
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",
369367
CheckNotBorrowedFnLangItem 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);
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);
377375

378376
LanguageItemCollector {
379377
crate: crate,
@@ -418,8 +416,8 @@ impl<'self> LanguageItemCollector<'self> {
418416
return; // Didn't match.
419417
}
420418

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

425423
match item_index {

branches/snap-stage3/src/libstd/fmt/mod.rs

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ format!("The number is {:d}", 1) // => ~"The number is 1"
4040
format!("{:?}", ~[3, 4]) // => ~"~[3, 4]"
4141
format!("{value}", value=4) // => ~"4"
4242
format!("{} {}", 1, 2) // => ~"1 2"
43-
```
43+
```
4444
4545
From these, you can see that the first argument is a format string. It is
4646
required by the compiler for this to be a string literal; it cannot be a
@@ -56,21 +56,6 @@ example, the format string `{} {} {}` would take three parameters, and they
5656
would be formatted in the same order as they're given. The format string
5757
`{2} {1} {0}`, however, would format arguments in reverse order.
5858
59-
Things can get a little tricky once you start intermingling the two types of
60-
positional specifiers. The "next argument" specifier can be thought of as an
61-
iterator over the argument. Each time a "next argument" specifier is seen, the
62-
iterator advances. This leads to behavior like this:
63-
64-
```rust
65-
format!("{1} {} {0} {}", 1, 2) // => ~"2 1 1 2"
66-
```
67-
68-
The internal iterator over the argument has not been advanced by the time the
69-
first `{}` is seen, so it prints the first argument. Then upon reaching the
70-
second `{}`, the iterator has advanced forward to the second argument.
71-
Essentially, parameters which explicitly name their argument do not affect
72-
parameters which do not name an argument in terms of positional specifiers.
73-
7459
A format string is required to use all of its arguments, otherwise it is a
7560
compile-time error. You may refer to the same argument more than once in the
7661
format string, although it must always be referred to with the same type.
@@ -82,17 +67,9 @@ function, but the `format!` macro is a syntax extension which allows it to
8267
leverage named parameters. Named parameters are listed at the end of the
8368
argument list and have the syntax:
8469
85-
```
70+
```
8671
identifier '=' expression
87-
```
88-
89-
For example, the following `format!` expressions all use named argument:
90-
91-
```rust
92-
format!("{argument}", argument = "test") // => ~"test"
93-
format!("{name} {}", 1, name = 2) // => ~"2 1"
94-
format!("{a:s} {c:d} {b:?}", a="a", b=(), c=3) // => ~"a 3 ()"
95-
```
72+
```
9673
9774
It is illegal to put positional parameters (those without names) after arguments
9875
which have names. Like positional parameters, it is illegal to provided named
@@ -107,9 +84,9 @@ and if all references to one argument do not provide a type, then the format `?`
10784
is used (the type's rust-representation is printed). For example, this is an
10885
invalid format string:
10986
110-
```
87+
```
11188
{0:d} {0:s}
112-
```
89+
```
11390
11491
Because the first argument is both referred to as an integer as well as a
11592
string.
@@ -123,9 +100,9 @@ must have the type `uint`. Although a `uint` can be printed with `{:u}`, it is
123100
illegal to reference an argument as such. For example, this is another invalid
124101
format string:
125102
126-
```
103+
```
127104
{:.*s} {0:u}
128-
```
105+
```
129106
130107
### Formatting traits
131108
@@ -159,7 +136,7 @@ method of the signature:
159136
160137
```rust
161138
fn fmt(value: &T, f: &mut std::fmt::Formatter);
162-
```
139+
```
163140
164141
Your type will be passed by-reference in `value`, and then the function should
165142
emit output into the `f.buf` stream. It is up to each format trait
@@ -180,7 +157,7 @@ writeln! // same as write but appends a newline
180157
print! // the format string is printed to the standard output
181158
println! // same as print but appends a newline
182159
format_args! // described below.
183-
```
160+
```
184161
185162
186163
#### `write!`
@@ -195,7 +172,7 @@ use std::rt::io;
195172
196173
let mut w = io::mem::MemWriter::new();
197174
write!(&mut w as &mut io::Writer, "Hello {}!", "world");
198-
```
175+
```
199176
200177
#### `print!`
201178
@@ -206,7 +183,7 @@ output. Example usage is:
206183
```rust
207184
print!("Hello {}!", "world");
208185
println!("I have a newline {}", "character at the end");
209-
```
186+
```
210187
211188
#### `format_args!`
212189
This is a curious macro which is used to safely pass around
@@ -222,7 +199,7 @@ use std::fmt;
222199
format_args!(fmt::format, "this returns {}", "~str");
223200
format_args!(|args| { fmt::write(my_writer, args) }, "some {}", "args");
224201
format_args!(my_fn, "format {}", "string");
225-
```
202+
```
226203
227204
The first argument of the `format_args!` macro is a function (or closure) which
228205
takes one argument of type `&fmt::Arguments`. This structure can then be
@@ -261,7 +238,7 @@ example:
261238
262239
```rust
263240
format!("{0, select, other{#}}", "hello") // => ~"hello"
264-
```
241+
```
265242
266243
This example is the equivalent of `{0:s}` essentially.
267244
@@ -270,9 +247,9 @@ This example is the equivalent of `{0:s}` essentially.
270247
The select method is a switch over a `&str` parameter, and the parameter *must*
271248
be of the type `&str`. An example of the syntax is:
272249
273-
```
250+
```
274251
{0, select, male{...} female{...} other{...}}
275-
```
252+
```
276253
277254
Breaking this down, the `0`-th argument is selected upon with the `select`
278255
method, and then a number of cases follow. Each case is preceded by an
@@ -289,9 +266,9 @@ The plural method is a switch statement over a `uint` parameter, and the
289266
parameter *must* be a `uint`. A plural method in its full glory can be specified
290267
as:
291268
292-
```
269+
```
293270
{0, plural, offset=1 =1{...} two{...} many{...} other{...}}
294-
```
271+
```
295272
296273
To break this down, the first `0` indicates that this method is selecting over
297274
the value of the first positional parameter to the format string. Next, the
@@ -317,7 +294,7 @@ should not be too alien. Arguments are formatted with python-like syntax,
317294
meaning that arguments are surrounded by `{}` instead of the C-like `%`. The
318295
actual grammar for the formatting syntax is:
319296
320-
```
297+
```
321298
format_string := <text> [ format <text> ] *
322299
format := '{' [ argument ] [ ':' format_spec ] [ ',' function_spec ] '}'
323300
argument := integer | identifier
@@ -338,7 +315,7 @@ plural := 'plural' ',' [ 'offset:' integer ] ( selector arm ) *
338315
selector := '=' integer | keyword
339316
keyword := 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'
340317
arm := '{' format_string '}'
341-
```
318+
```
342319
343320
## Formatting Parameters
344321

0 commit comments

Comments
 (0)