Skip to content

Commit 4a2e6df

Browse files
author
Nick Desaulniers
committed
fix merge conflicts due to bit rot
2 parents 0174ef9 + 1310212 commit 4a2e6df

File tree

196 files changed

+3523
-4235
lines changed

Some content is hidden

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

196 files changed

+3523
-4235
lines changed

configure

+5-5
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ validate_opt () {
138138
done
139139
if [ "$arg" = "--help" ]
140140
then
141-
echo ""
141+
echo
142142
echo "No more help available for Configure options,"
143143
echo "check the Wiki or join our IRC channel"
144144
break
@@ -349,11 +349,11 @@ if [ "$1" = "--help" ]
349349
then
350350
HELP=1
351351
shift
352-
echo ""
352+
echo
353353
echo "Usage: $CFG_SELF [options]"
354-
echo ""
354+
echo
355355
echo "Options:"
356-
echo ""
356+
echo
357357
else
358358
msg "recreating config.tmp"
359359
echo '' >config.tmp
@@ -394,7 +394,7 @@ validate_opt
394394

395395
if [ $HELP -eq 1 ]
396396
then
397-
echo ""
397+
echo
398398
exit 0
399399
fi
400400

doc/rust.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -803,19 +803,14 @@ An example of `use` declarations:
803803

804804
~~~~
805805
use std::float::sin;
806-
use std::str::{slice, contains};
807-
use std::option::Some;
806+
use std::option::{Some, None};
808807
809808
fn main() {
810809
// Equivalent to 'info!(std::float::sin(1.0));'
811810
info!(sin(1.0));
812811
813-
// Equivalent to 'info!(std::option::Some(1.0));'
814-
info!(Some(1.0));
815-
816-
// Equivalent to
817-
// 'info!(std::str::contains(std::str::slice("foo", 0, 1), "oo"));'
818-
info!(contains(slice("foo", 0, 1), "oo"));
812+
// Equivalent to 'info!(~[std::option::Some(1.0), std::option::None]);'
813+
info!(~[Some(1.0), None]);
819814
}
820815
~~~~
821816

doc/tutorial-tasks.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,11 @@ a single large vector of floats. Each task needs the full vector to perform its
351351
# use std::vec;
352352
# use std::uint;
353353
# use std::rand;
354+
# use std::iterator::IteratorUtil;
354355
use extra::arc::ARC;
355356
356357
fn pnorm(nums: &~[float], p: uint) -> float {
357-
(vec::foldl(0.0, *nums, |a,b| a+(*b).pow(p as float) )).pow(1f / (p as float))
358+
nums.iter().fold(0.0, |a,b| a+(*b).pow(p as float) ).pow(1f / (p as float))
358359
}
359360
360361
fn main() {

doc/tutorial.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,10 @@ loop {
569569
This code prints out a weird sequence of numbers and stops as soon as
570570
it finds one that can be divided by five.
571571

572-
For more involved iteration, such as enumerating the elements of a
573-
collection, Rust uses [higher-order functions](#closures).
572+
Rust also has a `for` construct. It's different from C's `for` and it works
573+
best when iterating over collections. See the section on [closures](#closures)
574+
to find out how to use `for` and higher-order functions for enumerating
575+
elements of a collection.
574576

575577
# Data structures
576578

@@ -1393,6 +1395,7 @@ assert!(crayons.len() == 3);
13931395
assert!(!crayons.is_empty());
13941396
13951397
// Iterate over a vector, obtaining a pointer to each element
1398+
// (`for` is explained in the next section)
13961399
for crayons.each |crayon| {
13971400
let delicious_crayon_wax = unwrap_crayon(*crayon);
13981401
eat_crayon_wax(delicious_crayon_wax);
@@ -1439,10 +1442,15 @@ call_closure_with_ten(closure);
14391442
~~~~
14401443

14411444
Closures begin with the argument list between vertical bars and are followed by
1442-
a single expression. The types of the arguments are generally omitted,
1443-
as is the return type, because the compiler can almost always infer
1444-
them. In the rare case where the compiler needs assistance, though, the
1445-
arguments and return types may be annotated.
1445+
a single expression. Remember that a block, `{ <expr1>; <expr2>; ... }`, is
1446+
considered a single expression: it evaluates to the result of the last
1447+
expression it contains if that expression is not followed by a semicolon,
1448+
otherwise the block evaluates to `()`.
1449+
1450+
The types of the arguments are generally omitted, as is the return type,
1451+
because the compiler can almost always infer them. In the rare case where the
1452+
compiler needs assistance, though, the arguments and return types may be
1453+
annotated.
14461454

14471455
~~~~
14481456
let square = |x: int| -> uint { x * x as uint };
@@ -2038,7 +2046,7 @@ trait Seq<T> {
20382046
}
20392047
20402048
impl<T> Seq<T> for ~[T] {
2041-
fn len(&self) -> uint { vec::len(*self) }
2049+
fn len(&self) -> uint { self.len() }
20422050
fn iter(&self, b: &fn(v: &T)) {
20432051
for vec::each(*self) |elt| { b(elt); }
20442052
}

mk/rt.mk

+8-1
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,16 @@ $$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
211211
endif
212212

213213
$$(JEMALLOC_LIB_$(1)_$(2)):
214-
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure --disable-experimental
214+
cd $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc; $(S)src/rt/jemalloc/configure \
215+
--disable-experimental --build=$(CFG_BUILD_TRIPLE) --host=$(1) \
216+
EXTRA_CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
217+
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
218+
CC="$$(CC_$(1))" \
219+
CXX="$$(CXX_$(1))" \
220+
AR="$$(AR_$(1))"
215221
$$(Q)$$(MAKE) -C $$(CFG_BUILD_DIR)/rt/$(1)/stage$(2)/jemalloc
216222

223+
217224
# These could go in rt.mk or rustllvm.mk, they're needed for both.
218225

219226
# This regexp has a single $, escaped twice

src/compiletest/compiletest.rc

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub fn parse_config(args: ~[~str]) -> config {
9797
mode: str_mode(getopts::opt_str(matches, "mode")),
9898
run_ignored: getopts::opt_present(matches, "ignored"),
9999
filter:
100-
if vec::len(matches.free) > 0u {
100+
if !matches.free.is_empty() {
101101
option::Some(copy matches.free[0])
102102
} else { option::None },
103103
logfile: getopts::opt_maybe_str(matches, "logfile").map(|s| Path(*s)),
@@ -231,11 +231,11 @@ pub fn is_test(config: &config, testfile: &Path) -> bool {
231231
let mut valid = false;
232232

233233
for valid_extensions.each |ext| {
234-
if str::ends_with(name, *ext) { valid = true; }
234+
if name.ends_with(*ext) { valid = true; }
235235
}
236236

237237
for invalid_prefixes.each |pre| {
238-
if str::starts_with(name, *pre) { valid = false; }
238+
if name.starts_with(*pre) { valid = false; }
239239
}
240240

241241
return valid;

src/compiletest/errors.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use core::prelude::*;
1212

1313
use core::io;
14-
use core::str;
1514

1615
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
1716

@@ -31,15 +30,15 @@ pub fn load_errors(testfile: &Path) -> ~[ExpectedError] {
3130
fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
3231
let error_tag = ~"//~";
3332
let mut idx;
34-
match str::find_str(line, error_tag) {
33+
match line.find_str(error_tag) {
3534
None => return ~[],
36-
Some(nn) => { idx = (nn as uint) + str::len(error_tag); }
35+
Some(nn) => { idx = (nn as uint) + error_tag.len(); }
3736
}
3837

3938
// "//~^^^ kind msg" denotes a message expected
4039
// three lines above current line:
4140
let mut adjust_line = 0u;
42-
let len = str::len(line);
41+
let len = line.len();
4342
while idx < len && line[idx] == ('^' as u8) {
4443
adjust_line += 1u;
4544
idx += 1u;
@@ -52,12 +51,12 @@ fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
5251

5352
// FIXME: #4318 Instead of to_ascii and to_str_ascii, could use
5453
// to_ascii_consume and to_str_consume to not do a unnecessary copy.
55-
let kind = str::slice(line, start_kind, idx);
54+
let kind = line.slice(start_kind, idx);
5655
let kind = kind.to_ascii().to_lower().to_str_ascii();
5756

5857
// Extract msg:
5958
while idx < len && line[idx] == (' ' as u8) { idx += 1u; }
60-
let msg = str::slice(line, idx, len).to_owned();
59+
let msg = line.slice(idx, len).to_owned();
6160

6261
debug!("line=%u kind=%s msg=%s", line_num - adjust_line, kind, msg);
6362

src/compiletest/header.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ use core::prelude::*;
1313
use common::config;
1414
use common;
1515

16+
use core::iterator::IteratorUtil;
1617
use core::io;
1718
use core::os;
18-
use core::str;
1919

2020
pub struct TestProps {
2121
// Lines that should be expected, in order, on standard out
@@ -111,7 +111,7 @@ fn iter_header(testfile: &Path, it: &fn(~str) -> bool) -> bool {
111111
// Assume that any directives will be found before the first
112112
// module or function. This doesn't seem to be an optimization
113113
// with a warm page cache. Maybe with a cold one.
114-
if str::starts_with(ln, "fn") || str::starts_with(ln, "mod") {
114+
if ln.starts_with("fn") || ln.starts_with("mod") {
115115
return false;
116116
} else { if !(it(ln)) { return false; } }
117117
}
@@ -141,8 +141,8 @@ fn parse_check_line(line: &str) -> Option<~str> {
141141
fn parse_exec_env(line: &str) -> Option<(~str, ~str)> {
142142
do parse_name_value_directive(line, ~"exec-env").map |nv| {
143143
// nv is either FOO or FOO=BAR
144-
let mut strs = ~[];
145-
for str::each_splitn_char(*nv, '=', 1u) |s| { strs.push(s.to_owned()); }
144+
let mut strs: ~[~str] = nv.splitn_iter('=', 1).transform(|s| s.to_owned()).collect();
145+
146146
match strs.len() {
147147
1u => (strs.pop(), ~""),
148148
2u => {
@@ -168,16 +168,16 @@ fn parse_pp_exact(line: &str, testfile: &Path) -> Option<Path> {
168168
}
169169

170170
fn parse_name_directive(line: &str, directive: &str) -> bool {
171-
str::contains(line, directive)
171+
line.contains(directive)
172172
}
173173

174174
fn parse_name_value_directive(line: &str,
175175
directive: ~str) -> Option<~str> {
176176
let keycolon = directive + ":";
177-
match str::find_str(line, keycolon) {
177+
match line.find_str(keycolon) {
178178
Some(colon) => {
179-
let value = str::slice(line, colon + str::len(keycolon),
180-
str::len(line)).to_owned();
179+
let value = line.slice(colon + keycolon.len(),
180+
line.len()).to_owned();
181181
debug!("%s: %s", directive, value);
182182
Some(value)
183183
}

src/compiletest/procsrv.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,9 @@
1010

1111
use core::prelude::*;
1212

13-
use core::comm;
14-
use core::io;
15-
use core::libc::c_int;
1613
use core::os;
1714
use core::run;
1815
use core::str;
19-
use core::task;
20-
use core::vec;
2116

2217
#[cfg(target_os = "win32")]
2318
fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
@@ -33,7 +28,7 @@ fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
3328
if k == ~"PATH" { (~"PATH", v + ";" + lib_path + ";" + aux_path) }
3429
else { (k,v) }
3530
};
36-
if str::ends_with(prog, "rustc.exe") {
31+
if prog.ends_with("rustc.exe") {
3732
env.push((~"RUST_THREADS", ~"1"));
3833
}
3934
return env;
@@ -74,4 +69,3 @@ pub fn run(lib_path: &str,
7469
err: str::from_bytes(output.error)
7570
}
7671
}
77-

0 commit comments

Comments
 (0)