Skip to content

Commit 4243cad

Browse files
committed
auto merge of #12535 : alexcrichton/rust/rollup, r=alexcrichton
Closes #12474 (rustc: Don't error on the rlib symlinks) r=brson Closes #12475 (Use lines_any() when parsing output form "ar") r=brson Closes #12476 (Remove some obsolete ignored tests) r=alexcrichton Closes #12481 (Make .swap_remove return Option<T>) r=brson Closes #12485 (Remove some non-essential trait re-exports from the prelude.) r=brson Closes #12489 (Handle multibyte characters in source files better) r=alexcrichton Closes #12494 (Mark by-value parameters that are passed on the stack as nocapture) r=nmatsakis Closes #12497 (syntax: allow stmt/expr macro invocations to be delimited by {}) r=alexcrichton Closes #12508 (Match binding is assignment) r=nmatsakis Closes #12513 (Run the travis build as one large command) r=huonw Closes #12515 (Update source code layout in src/) r=alexcrichton Closes #12521 (Tutorial: Add std::num::sqrt to the example) r=cmr Closes #12529 (test: single-variant enum can't be dereferenced) r=huonw
2 parents 043c972 + 7d85546 commit 4243cad

Some content is hidden

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

54 files changed

+443
-174
lines changed

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ before_script:
3939
# manually disables bringing in these two libraries, but the stock LLVM was
4040
# apparently built with these options. We provide these options when building so
4141
# the `rustc` binary can successfully link.
42-
script:
43-
- make tidy
44-
- RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1
45-
- make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
42+
#
43+
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
44+
# everything in one large command instead of multiple commands.
45+
script: |
46+
make tidy &&
47+
RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1 &&
48+
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
4649
4750
env:
4851
- NO_BENCH=1

src/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ Source layout:
1010
| `libgreen/` | The M:N runtime library |
1111
| `libnative/` | The 1:1 runtime library |
1212
| `libsyntax/` | The Rust parser and pretty-printer |
13+
| `libcollections/` | A collection of useful data structures and containers |
14+
| `libnum/` | Extended number support library (complex, rational, etc) |
15+
| `libtest/` | Rust's test-runner code |
16+
| ------------------- | --------------------------------------------------------- |
17+
| `libarena/` | The arena (a fast but limited) memory allocator |
18+
| `libflate/` | Simple compression library |
19+
| `libfourcc/` | Data format identifier library |
20+
| `libgetopts/` | Get command-line-options library |
21+
| `libglob/` | Unix glob patterns library |
22+
| `libsemver/` | Rust's semantic versioning library |
23+
| `libserialize/` | Encode-Decode types library |
24+
| `libsync/` | Concurrency mechanisms and primitives |
25+
| `libterm/` | ANSI color library for terminals |
26+
| `libtime/` | Time operations library |
27+
| `libuuid/` | UUID's handling code |
1328
| ------------------- | --------------------------------------------------------- |
1429
| `rt/` | The runtime system |
1530
| `rt/rust_*.c` | - Some of the runtime services |
@@ -31,8 +46,13 @@ Source layout:
3146
| ------------------- | --------------------------------------------------------- |
3247
| `librustdoc/` | The Rust API documentation tool |
3348
| `libuv/` | The libuv submodule |
49+
| `librustuv/` | Rust libuv support code |
3450
| ------------------- | --------------------------------------------------------- |
3551
| `llvm/` | The LLVM submodule |
3652
| `rustllvm/` | LLVM support code |
3753
| ------------------- | --------------------------------------------------------- |
3854
| `etc/` | Scripts, editors support, misc |
55+
56+
57+
NOTE: This list (especially the second part of the table which contains modules and libraries)
58+
is highly volatile and subject to change.

src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,8 +1420,8 @@ bad, but often copies are expensive. So we’d like to define a function
14201420
that takes the points by pointer. We can use references to do this:
14211421
14221422
~~~
1423+
use std::num::sqrt;
14231424
# struct Point { x: f64, y: f64 }
1424-
# fn sqrt(f: f64) -> f64 { 0.0 }
14251425
fn compute_distance(p1: &Point, p2: &Point) -> f64 {
14261426
let x_d = p1.x - p2.x;
14271427
let y_d = p1.y - p2.y;

src/libcollections/hashmap.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
//! ```
5454
5555
use std::cmp::max;
56+
use std::default::Default;
5657
use std::fmt;
5758
use std::hash::{Hash, Hasher, sip};
5859
use std::iter::{FilterMap, Chain, Repeat, Zip};

src/libextra/url.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::cmp::Eq;
1616
use std::fmt;
1717
use std::hash::{Hash, sip};
1818
use std::io::BufReader;
19+
use std::from_str::FromStr;
1920
use std::uint;
2021

2122
use collections::HashMap;

src/libgreen/stack.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl StackPool {
139139
pub fn take_stack(&mut self, min_size: uint) -> Stack {
140140
// Ideally this would be a binary search
141141
match self.stacks.iter().position(|s| min_size <= s.min_size) {
142-
Some(idx) => self.stacks.swap_remove(idx),
142+
Some(idx) => self.stacks.swap_remove(idx).unwrap(),
143143
None => Stack::new(min_size)
144144
}
145145
}

src/libnum/bigint.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use Integer;
2020

2121
use std::cmp;
2222
use std::fmt;
23+
use std::from_str::FromStr;
2324
use std::num::{Bitwise, ToPrimitive, FromPrimitive};
2425
use std::num::{Zero, One, ToStrRadix, FromStrRadix};
2526
use std::rand::Rng;
@@ -1397,8 +1398,9 @@ mod biguint_tests {
13971398
use super::{Plus, BigInt, RandBigInt, ToBigInt};
13981399
13991400
use std::cmp::{Less, Equal, Greater};
1401+
use std::from_str::FromStr;
14001402
use std::i64;
1401-
use std::num::{Zero, One, FromStrRadix};
1403+
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
14021404
use std::num::{ToPrimitive, FromPrimitive};
14031405
use std::rand::{task_rng};
14041406
use std::str;
@@ -2056,7 +2058,7 @@ mod bigint_tests {
20562058

20572059
use std::cmp::{Less, Equal, Greater};
20582060
use std::i64;
2059-
use std::num::{Zero, One, FromStrRadix};
2061+
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
20602062
use std::num::{ToPrimitive, FromPrimitive};
20612063
use std::rand::{task_rng};
20622064
use std::u64;

src/libnum/rational.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ impl<T: FromStrRadix + Clone + Integer + Ord>
333333
mod test {
334334

335335
use super::{Ratio, Rational, BigRational};
336-
use std::num::{Zero,One,FromStrRadix,FromPrimitive};
336+
use std::num::{Zero, One, FromStrRadix, FromPrimitive, ToStrRadix};
337337
use std::from_str::FromStr;
338338

339339
pub static _0 : Rational = Ratio { numer: 0, denom: 1};

src/librustc/back/archive.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ impl Archive {
145145
/// Lists all files in an archive
146146
pub fn files(&self) -> ~[~str] {
147147
let output = run_ar(self.sess, "t", None, [&self.dst]);
148-
str::from_utf8(output.output).unwrap().lines().map(|s| s.to_owned()).collect()
148+
let output = str::from_utf8(output.output).unwrap();
149+
// use lines_any because windows delimits output with `\r\n` instead of
150+
// just `\n`
151+
output.lines_any().map(|s| s.to_owned()).collect()
149152
}
150153

151154
fn add_archive(&mut self, archive: &Path, name: &str,

src/librustc/metadata/loader.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ pub struct ArchiveMetadata {
6767
priv data: &'static [u8],
6868
}
6969

70+
// FIXME(#11857) this should be a "real" realpath
71+
fn realpath(p: &Path) -> Path {
72+
use std::os;
73+
use std::io::fs;
74+
75+
let path = os::make_absolute(p);
76+
match fs::readlink(&path) {
77+
Ok(p) => p,
78+
Err(..) => path
79+
}
80+
}
81+
7082
impl Context {
7183
pub fn load_library_crate(&self, root_ident: Option<~str>) -> Library {
7284
match self.find_library_crate() {
@@ -121,7 +133,7 @@ impl Context {
121133
(HashSet::new(), HashSet::new())
122134
});
123135
let (ref mut rlibs, _) = *slot;
124-
rlibs.insert(path.clone());
136+
rlibs.insert(realpath(path));
125137
FileMatches
126138
}
127139
None => {
@@ -138,7 +150,7 @@ impl Context {
138150
(HashSet::new(), HashSet::new())
139151
});
140152
let (_, ref mut dylibs) = *slot;
141-
dylibs.insert(path.clone());
153+
dylibs.insert(realpath(path));
142154
FileMatches
143155
}
144156
None => {

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,8 @@ fn gather_loans_in_local(this: &mut GatherLoanCtxt,
160160
})
161161
}
162162
Some(init) => {
163-
// Variable declarations with initializers are considered "assigns":
164-
let tcx = this.bccx.tcx;
165-
pat_util::pat_bindings(tcx.def_map, local.pat, |_, id, span, _| {
166-
gather_moves::gather_assignment(this.bccx,
167-
&this.move_data,
168-
id,
169-
span,
170-
@LpVar(id),
171-
id);
172-
});
163+
// Variable declarations with initializers are considered "assigns",
164+
// which is handled by `gather_pat`:
173165
let init_cmt = this.bccx.cat_expr(init);
174166
this.gather_pat(init_cmt, local.pat, None);
175167
}
@@ -811,6 +803,17 @@ impl<'a> GatherLoanCtxt<'a> {
811803
self.bccx.cat_pattern(discr_cmt, root_pat, |cmt, pat| {
812804
match pat.node {
813805
ast::PatIdent(bm, _, _) if self.pat_is_binding(pat) => {
806+
// Each match binding is effectively an assignment.
807+
let tcx = self.bccx.tcx;
808+
pat_util::pat_bindings(tcx.def_map, pat, |_, id, span, _| {
809+
gather_moves::gather_assignment(self.bccx,
810+
&self.move_data,
811+
id,
812+
span,
813+
@LpVar(id),
814+
id);
815+
});
816+
814817
match bm {
815818
ast::BindByRef(mutbl) => {
816819
// ref x or ref x @ p --- creates a ptr which must

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
282282
if !type_is_immediate(ccx, arg_ty) {
283283
unsafe {
284284
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
285+
llvm::LLVMAddAttribute(llarg, lib::llvm::NoCaptureAttribute as c_uint);
285286
}
286287
}
287288
}

src/libstd/bool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ impl Default for bool {
295295
mod tests {
296296
use prelude::*;
297297
use super::all_values;
298+
use from_str::FromStr;
298299

299300
#[test]
300301
fn test_bool() {

src/libstd/io/net/ip.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ impl FromStr for SocketAddr {
340340
mod test {
341341
use prelude::*;
342342
use super::*;
343+
use from_str::FromStr;
343344

344345
#[test]
345346
fn test_from_str_ipv4() {

src/libstd/num/f32.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use prelude::*;
1515

1616
use cmath;
1717
use default::Default;
18+
use from_str::FromStr;
1819
use libc::{c_float, c_int};
1920
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
2021
use num::{Zero, One, Bounded, strconv};

src/libstd/num/f64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use prelude::*;
1616

1717
use cmath;
1818
use default::Default;
19+
use from_str::FromStr;
1920
use libc::{c_double, c_int};
2021
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
2122
use num::{Zero, One, Bounded, strconv};

src/libstd/num/i16.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
1920
use num::{CheckedDiv, Zero, One, strconv};
2021
use num::{ToStrRadix, FromStrRadix};

src/libstd/num/i32.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
1920
use num::{CheckedDiv, Zero, One, strconv};
2021
use num::{ToStrRadix, FromStrRadix};

src/libstd/num/i64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
#[cfg(target_word_size = "64")]
1920
use num::CheckedMul;
2021
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub};

src/libstd/num/i8.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
1920
use num::{CheckedDiv, Zero, One, strconv};
2021
use num::{ToStrRadix, FromStrRadix};

src/libstd/num/int.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
1920
use num::{CheckedDiv, Zero, One, strconv};
2021
use num::{ToStrRadix, FromStrRadix};

src/libstd/num/int_macros.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,9 @@ mod tests {
295295
use int;
296296
use i32;
297297
use num;
298-
use num::CheckedDiv;
299298
use num::Bitwise;
299+
use num::CheckedDiv;
300+
use num::ToStrRadix;
300301

301302
#[test]
302303
fn test_overflows() {

src/libstd/num/u16.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded};
1920
use num::{CheckedAdd, CheckedSub, CheckedMul};
2021
use num::{CheckedDiv, Zero, One, strconv};

src/libstd/num/u32.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded};
1920
use num::{CheckedAdd, CheckedSub, CheckedMul};
2021
use num::{CheckedDiv, Zero, One, strconv};

src/libstd/num/u64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded};
1920
#[cfg(target_word_size = "64")]
2021
use num::CheckedMul;

src/libstd/num/u8.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded};
1920
use num::{CheckedAdd, CheckedSub, CheckedMul};
2021
use num::{CheckedDiv, Zero, One, strconv};

src/libstd/num/uint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use prelude::*;
1616

1717
use default::Default;
18+
use from_str::FromStr;
1819
use num::{Bitwise, Bounded};
1920
use num::{CheckedAdd, CheckedSub, CheckedMul};
2021
use num::{CheckedDiv, Zero, One, strconv};

src/libstd/num/uint_macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ mod tests {
233233
use num;
234234
use num::CheckedDiv;
235235
use num::Bitwise;
236+
use num::ToStrRadix;
236237
use u16;
237238

238239
#[test]

src/libstd/prelude.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,12 @@ pub use char::Char;
4343
pub use clone::{Clone, DeepClone};
4444
pub use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater, Equiv};
4545
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
46-
pub use default::Default;
47-
pub use from_str::FromStr;
4846
pub use iter::{FromIterator, Extendable};
4947
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
5048
pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
5149
pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};
5250
pub use num::{Signed, Unsigned, Round};
53-
pub use num::{Primitive, Int, Float, ToStrRadix, ToPrimitive, FromPrimitive};
51+
pub use num::{Primitive, Int, Float, ToPrimitive, FromPrimitive};
5452
pub use path::{GenericPath, Path, PosixPath, WindowsPath};
5553
pub use ptr::RawPtr;
5654
pub use io::{Buffer, Writer, Reader, Seek};

src/libstd/rand/reseeding.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ impl Default for ReseedWithDefault {
144144
mod test {
145145
use prelude::*;
146146
use super::*;
147+
use default::Default;
147148
use rand::{SeedableRng, Rng};
148149

149150
struct Counter {

src/libstd/str.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3072,6 +3072,7 @@ impl Default for ~str {
30723072
#[cfg(test)]
30733073
mod tests {
30743074
use iter::AdditiveIterator;
3075+
use default::Default;
30753076
use prelude::*;
30763077
use str::*;
30773078

0 commit comments

Comments
 (0)