Skip to content

Commit ca46955

Browse files
committed
---
yaml --- r: 67245 b: refs/heads/master c: 172ea83 h: refs/heads/master i: 67243: d5a8c59 v: v3
1 parent a369a0e commit ca46955

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1135
-1051
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9c3679a9a2caeacdd16735c64ab4837721287e64
2+
refs/heads/master: 172ea83adc1e97d1f2fbe72326d1381bf80760bd
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 18e3db7392d2d0697b7e27d6d986139960144d85
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9

trunk/doc/tutorial.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ types.
499499
> items.
500500
501501
~~~~
502-
# use std::float;
503-
# use std::num::atan;
502+
use std::float;
503+
use std::num::atan;
504504
fn angle(vector: (float, float)) -> float {
505505
let pi = float::consts::pi;
506506
match vector {
@@ -555,7 +555,7 @@ while cake_amount > 0 {
555555
`loop` denotes an infinite loop, and is the preferred way of writing `while true`:
556556

557557
~~~~
558-
# use std::int;
558+
use std::int;
559559
let mut x = 5;
560560
loop {
561561
x += x - 3;
@@ -701,7 +701,7 @@ get at their contents. All variant constructors can be used as
701701
patterns, as in this definition of `area`:
702702

703703
~~~~
704-
# use std::float;
704+
use std::float;
705705
# struct Point {x: float, y: float}
706706
# enum Shape { Circle(Point, float), Rectangle(Point, Point) }
707707
fn area(sh: Shape) -> float {
@@ -733,7 +733,7 @@ fn point_from_direction(dir: Direction) -> Point {
733733
Enum variants may also be structs. For example:
734734

735735
~~~~
736-
# use std::float;
736+
use std::float;
737737
# struct Point { x: float, y: float }
738738
# fn square(x: float) -> float { x * x }
739739
enum Shape {
@@ -1599,7 +1599,8 @@ lists back to back. Since that is so unsightly, empty argument lists
15991599
may be omitted from `do` expressions.
16001600

16011601
~~~~
1602-
# use std::task::spawn;
1602+
use std::task::spawn;
1603+
16031604
do spawn {
16041605
debug!("Kablam!");
16051606
}
@@ -1728,7 +1729,7 @@ impl Circle {
17281729
To call such a method, just prefix it with the type name and a double colon:
17291730

17301731
~~~~
1731-
# use std::float::consts::pi;
1732+
use std::float::consts::pi;
17321733
struct Circle { radius: float }
17331734
impl Circle {
17341735
fn new(area: float) -> Circle { Circle { radius: (area / pi).sqrt() } }
@@ -1774,7 +1775,7 @@ illegal to copy and pass by value.
17741775
Generic `type`, `struct`, and `enum` declarations follow the same pattern:
17751776

17761777
~~~~
1777-
# use std::hashmap::HashMap;
1778+
use std::hashmap::HashMap;
17781779
type Set<T> = HashMap<T, ()>;
17791780
17801781
struct Stack<T> {
@@ -2000,7 +2001,7 @@ name and a double colon. The compiler uses type inference to decide which
20002001
implementation to use.
20012002

20022003
~~~~
2003-
# use std::float::consts::pi;
2004+
use std::float::consts::pi;
20042005
trait Shape { fn new(area: float) -> Self; }
20052006
struct Circle { radius: float }
20062007
struct Square { length: float }
@@ -2156,7 +2157,7 @@ trait Circle : Shape { fn radius(&self) -> float; }
21562157
Now, we can implement `Circle` on a type only if we also implement `Shape`.
21572158

21582159
~~~~
2159-
# use std::float::consts::pi;
2160+
use std::float::consts::pi;
21602161
# trait Shape { fn area(&self) -> float; }
21612162
# trait Circle : Shape { fn radius(&self) -> float; }
21622163
# struct Point { x: float, y: float }
@@ -2191,7 +2192,7 @@ fn radius_times_area<T: Circle>(c: T) -> float {
21912192
Likewise, supertrait methods may also be called on trait objects.
21922193

21932194
~~~ {.xfail-test}
2194-
# use std::float::consts::pi;
2195+
use std::float::consts::pi;
21952196
# trait Shape { fn area(&self) -> float; }
21962197
# trait Circle : Shape { fn radius(&self) -> float; }
21972198
# struct Point { x: float, y: float }

trunk/src/libextra/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ mod test {
194194
195195
#[test]
196196
fn test_interface_unwrap() {
197-
let f = from_value(~"fail");
197+
let mut f = from_value(~"fail");
198198
assert_eq!(f.unwrap(), ~"fail");
199199
}
200200

trunk/src/libextra/getopts.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> {
457457
let vals = opt_vals(mm, nm);
458458
if vals.is_empty() { return None::<~str>; }
459459
return match vals[0] { Val(ref s) => Some::<~str>((*s).clone()),
460-
_ => Some::<~str>(def.to_owned()) }
460+
_ => Some::<~str>(str::to_owned(def)) }
461461
}
462462

463463
#[deriving(Eq)]
@@ -497,10 +497,10 @@ pub mod groups {
497497
desc: &str, hint: &str) -> OptGroup {
498498
let len = short_name.len();
499499
assert!(len == 1 || len == 0);
500-
return OptGroup { short_name: short_name.to_owned(),
501-
long_name: long_name.to_owned(),
502-
hint: hint.to_owned(),
503-
desc: desc.to_owned(),
500+
return OptGroup { short_name: str::to_owned(short_name),
501+
long_name: str::to_owned(long_name),
502+
hint: str::to_owned(hint),
503+
desc: str::to_owned(desc),
504504
hasarg: Yes,
505505
occur: Req};
506506
}
@@ -510,10 +510,10 @@ pub mod groups {
510510
desc: &str, hint: &str) -> OptGroup {
511511
let len = short_name.len();
512512
assert!(len == 1 || len == 0);
513-
return OptGroup {short_name: short_name.to_owned(),
514-
long_name: long_name.to_owned(),
515-
hint: hint.to_owned(),
516-
desc: desc.to_owned(),
513+
return OptGroup {short_name: str::to_owned(short_name),
514+
long_name: str::to_owned(long_name),
515+
hint: str::to_owned(hint),
516+
desc: str::to_owned(desc),
517517
hasarg: Yes,
518518
occur: Optional};
519519
}
@@ -523,10 +523,10 @@ pub mod groups {
523523
desc: &str) -> OptGroup {
524524
let len = short_name.len();
525525
assert!(len == 1 || len == 0);
526-
return OptGroup {short_name: short_name.to_owned(),
527-
long_name: long_name.to_owned(),
526+
return OptGroup {short_name: str::to_owned(short_name),
527+
long_name: str::to_owned(long_name),
528528
hint: ~"",
529-
desc: desc.to_owned(),
529+
desc: str::to_owned(desc),
530530
hasarg: No,
531531
occur: Optional};
532532
}
@@ -536,10 +536,10 @@ pub mod groups {
536536
desc: &str, hint: &str) -> OptGroup {
537537
let len = short_name.len();
538538
assert!(len == 1 || len == 0);
539-
return OptGroup {short_name: short_name.to_owned(),
540-
long_name: long_name.to_owned(),
541-
hint: hint.to_owned(),
542-
desc: desc.to_owned(),
539+
return OptGroup {short_name: str::to_owned(short_name),
540+
long_name: str::to_owned(long_name),
541+
hint: str::to_owned(hint),
542+
desc: str::to_owned(desc),
543543
hasarg: Maybe,
544544
occur: Optional};
545545
}
@@ -552,10 +552,10 @@ pub mod groups {
552552
desc: &str, hint: &str) -> OptGroup {
553553
let len = short_name.len();
554554
assert!(len == 1 || len == 0);
555-
return OptGroup {short_name: short_name.to_owned(),
556-
long_name: long_name.to_owned(),
557-
hint: hint.to_owned(),
558-
desc: desc.to_owned(),
555+
return OptGroup {short_name: str::to_owned(short_name),
556+
long_name: str::to_owned(long_name),
557+
hint: str::to_owned(hint),
558+
desc: str::to_owned(desc),
559559
hasarg: Yes,
560560
occur: Multi};
561561
}
@@ -678,7 +678,7 @@ pub mod groups {
678678
row
679679
});
680680

681-
return brief.to_owned() +
681+
return str::to_owned(brief) +
682682
"\n\nOptions:\n" +
683683
rows.collect::<~[~str]>().connect("\n") +
684684
"\n\n";

trunk/src/libextra/rl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub mod rustrt {
3232

3333
/// Add a line to history
3434
pub unsafe fn add_history(line: &str) -> bool {
35-
do line.as_c_str |buf| {
35+
do str::as_c_str(line) |buf| {
3636
rustrt::linenoiseHistoryAdd(buf) == 1 as c_int
3737
}
3838
}
@@ -44,21 +44,21 @@ pub unsafe fn set_history_max_len(len: int) -> bool {
4444

4545
/// Save line history to a file
4646
pub unsafe fn save_history(file: &str) -> bool {
47-
do file.as_c_str |buf| {
47+
do str::as_c_str(file) |buf| {
4848
rustrt::linenoiseHistorySave(buf) == 1 as c_int
4949
}
5050
}
5151

5252
/// Load line history from a file
5353
pub unsafe fn load_history(file: &str) -> bool {
54-
do file.as_c_str |buf| {
54+
do str::as_c_str(file) |buf| {
5555
rustrt::linenoiseHistoryLoad(buf) == 1 as c_int
5656
}
5757
}
5858

5959
/// Print out a prompt and then wait for input and return it
6060
pub unsafe fn read(prompt: &str) -> Option<~str> {
61-
do prompt.as_c_str |buf| {
61+
do str::as_c_str(prompt) |buf| {
6262
let line = rustrt::linenoise(buf);
6363

6464
if line.is_null() { None }
@@ -80,7 +80,7 @@ pub unsafe fn complete(cb: CompletionCb) {
8080

8181
unsafe {
8282
do cb(str::raw::from_c_str(line)) |suggestion| {
83-
do suggestion.as_c_str |buf| {
83+
do str::as_c_str(suggestion) |buf| {
8484
rustrt::linenoiseAddCompletion(completions, buf);
8585
}
8686
}

trunk/src/libextra/terminfo/parm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ priv fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
545545
String(s) => {
546546
match op {
547547
FormatString => {
548-
let mut s = s.to_bytes_with_null();
548+
let mut s = s.as_bytes_with_null_consume();
549549
s.pop(); // remove the null
550550
if flags.precision > 0 && flags.precision < s.len() {
551551
s.truncate(flags.precision);

trunk/src/libextra/time.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ mod tests {
10271027
10281028
fn test(s: &str, format: &str) -> bool {
10291029
match strptime(s, format) {
1030-
Ok(ref tm) => tm.strftime(format) == s.to_owned(),
1030+
Ok(ref tm) => tm.strftime(format) == str::to_owned(s),
10311031
Err(e) => fail!(e)
10321032
}
10331033
}

trunk/src/librustc/back/link.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ pub fn WriteOutputFile(sess: Session,
7676
OptLevel: c_int,
7777
EnableSegmentedStacks: bool) {
7878
unsafe {
79-
do Triple.as_c_str |Triple| {
80-
do Feature.as_c_str |Feature| {
81-
do Output.as_c_str |Output| {
79+
do str::as_c_str(Triple) |Triple| {
80+
do str::as_c_str(Feature) |Feature| {
81+
do str::as_c_str(Output) |Output| {
8282
let result = llvm::LLVMRustWriteOutputFile(
8383
PM,
8484
M,
@@ -263,16 +263,16 @@ pub mod write {
263263
output_type_bitcode => {
264264
if opts.optimize != session::No {
265265
let filename = output.with_filetype("no-opt.bc");
266-
do filename.to_str().as_c_str |buf| {
267-
llvm::LLVMWriteBitcodeToFile(llmod, buf);
268-
}
266+
str::as_c_str(filename.to_str(), |buf| {
267+
llvm::LLVMWriteBitcodeToFile(llmod, buf)
268+
});
269269
}
270270
}
271271
_ => {
272272
let filename = output.with_filetype("bc");
273-
do filename.to_str().as_c_str |buf| {
274-
llvm::LLVMWriteBitcodeToFile(llmod, buf);
275-
}
273+
str::as_c_str(filename.to_str(), |buf| {
274+
llvm::LLVMWriteBitcodeToFile(llmod, buf)
275+
});
276276
}
277277
}
278278
}
@@ -333,9 +333,9 @@ pub mod write {
333333
// Always output the bitcode file with --save-temps
334334

335335
let filename = output.with_filetype("opt.bc");
336-
do filename.to_str().as_c_str |buf| {
336+
str::as_c_str(filename.to_str(), |buf| {
337337
llvm::LLVMWriteBitcodeToFile(llmod, buf)
338-
};
338+
});
339339
// Save the assembly file if -S is used
340340
if output_type == output_type_assembly {
341341
WriteOutputFile(
@@ -391,15 +391,13 @@ pub mod write {
391391

392392
if output_type == output_type_llvm_assembly {
393393
// Given options "-S --emit-llvm": output LLVM assembly
394-
do output.to_str().as_c_str |buf_o| {
395-
llvm::LLVMRustAddPrintModulePass(pm.llpm, llmod, buf_o);
396-
}
394+
str::as_c_str(output.to_str(), |buf_o| {
395+
llvm::LLVMRustAddPrintModulePass(pm.llpm, llmod, buf_o)});
397396
} else {
398397
// If only a bitcode file is asked for by using the
399398
// '--emit-llvm' flag, then output it here
400-
do output.to_str().as_c_str |buf| {
401-
llvm::LLVMWriteBitcodeToFile(llmod, buf);
402-
}
399+
str::as_c_str(output.to_str(),
400+
|buf| llvm::LLVMWriteBitcodeToFile(llmod, buf) );
403401
}
404402

405403
llvm::LLVMDisposeModule(llmod);

trunk/src/librustc/back/passes.rs

Lines changed: 2 additions & 1 deletion
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+
use std::str;
1112
use std::io;
1213

1314
use driver::session::{OptLevel, No, Less, Aggressive};
@@ -173,7 +174,7 @@ pub fn populate_pass_manager(sess: Session, pm: &mut PassManager, pass_list:&[~s
173174
}
174175

175176
pub fn create_pass(name:&str) -> Option<PassRef> {
176-
do name.as_c_str |s| {
177+
do str::as_c_str(name) |s| {
177178
unsafe {
178179
let p = llvm::LLVMCreatePass(s);
179180
if p.is_null() {

trunk/src/librustc/lib/llvm.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use std::hashmap::HashMap;
1313
use std::libc::{c_uint, c_ushort};
1414
use std::option;
15+
use std::str;
1516

1617
use middle::trans::type_::Type;
1718

@@ -2286,9 +2287,10 @@ pub struct TargetData {
22862287
}
22872288

22882289
pub fn mk_target_data(string_rep: &str) -> TargetData {
2289-
let lltd = do string_rep.as_c_str |buf| {
2290-
unsafe { llvm::LLVMCreateTargetData(buf) }
2291-
};
2290+
let lltd =
2291+
str::as_c_str(string_rep, |buf| unsafe {
2292+
llvm::LLVMCreateTargetData(buf)
2293+
});
22922294

22932295
TargetData {
22942296
lltd: lltd,

trunk/src/librustc/metadata/filesearch.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use std::option;
1313
use std::os;
1414
use std::result;
15+
use std::str;
1516

1617
// A module for searching for libraries
1718
// FIXME (#2658): I'm not happy how this module turned out. Should
@@ -82,7 +83,7 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
8283
@FileSearchImpl {
8384
sysroot: sysroot,
8485
addl_lib_search_paths: addl_lib_search_paths,
85-
target_triple: target_triple.to_owned()
86+
target_triple: str::to_owned(target_triple)
8687
} as @FileSearch
8788
}
8889

@@ -109,7 +110,7 @@ pub fn search<T>(filesearch: @FileSearch, pick: pick<T>) -> Option<T> {
109110

110111
pub fn relative_target_lib_path(target_triple: &str) -> Path {
111112
Path(libdir()).push_many([~"rustc",
112-
target_triple.to_owned(),
113+
str::to_owned(target_triple),
113114
libdir()])
114115
}
115116

0 commit comments

Comments
 (0)