Skip to content

Commit

Permalink
auto merge of #12535 : alexcrichton/rust/rollup, r=alexcrichton
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Feb 25, 2014
2 parents 043c972 + 7d85546 commit 4243cad
Show file tree
Hide file tree
Showing 54 changed files with 443 additions and 174 deletions.
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ before_script:
# manually disables bringing in these two libraries, but the stock LLVM was
# apparently built with these options. We provide these options when building so
# the `rustc` binary can successfully link.
script:
- make tidy
- RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1
- make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
#
# As a result of https://github.com/travis-ci/travis-ci/issues/1066, we run
# everything in one large command instead of multiple commands.
script: |
make tidy &&
RUSTFLAGS="-C link-args='-lffi -lncurses'" make -j4 rustc-stage1 &&
make check-stage1-std check-stage1-rpass check-stage1-cfail check-stage1-rfail
env:
- NO_BENCH=1
Expand Down
20 changes: 20 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ Source layout:
| `libgreen/` | The M:N runtime library |
| `libnative/` | The 1:1 runtime library |
| `libsyntax/` | The Rust parser and pretty-printer |
| `libcollections/` | A collection of useful data structures and containers |
| `libnum/` | Extended number support library (complex, rational, etc) |
| `libtest/` | Rust's test-runner code |
| ------------------- | --------------------------------------------------------- |
| `libarena/` | The arena (a fast but limited) memory allocator |
| `libflate/` | Simple compression library |
| `libfourcc/` | Data format identifier library |
| `libgetopts/` | Get command-line-options library |
| `libglob/` | Unix glob patterns library |
| `libsemver/` | Rust's semantic versioning library |
| `libserialize/` | Encode-Decode types library |
| `libsync/` | Concurrency mechanisms and primitives |
| `libterm/` | ANSI color library for terminals |
| `libtime/` | Time operations library |
| `libuuid/` | UUID's handling code |
| ------------------- | --------------------------------------------------------- |
| `rt/` | The runtime system |
| `rt/rust_*.c` | - Some of the runtime services |
Expand All @@ -31,8 +46,13 @@ Source layout:
| ------------------- | --------------------------------------------------------- |
| `librustdoc/` | The Rust API documentation tool |
| `libuv/` | The libuv submodule |
| `librustuv/` | Rust libuv support code |
| ------------------- | --------------------------------------------------------- |
| `llvm/` | The LLVM submodule |
| `rustllvm/` | LLVM support code |
| ------------------- | --------------------------------------------------------- |
| `etc/` | Scripts, editors support, misc |


NOTE: This list (especially the second part of the table which contains modules and libraries)
is highly volatile and subject to change.
2 changes: 1 addition & 1 deletion src/doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -1420,8 +1420,8 @@ bad, but often copies are expensive. So we’d like to define a function
that takes the points by pointer. We can use references to do this:

~~~
use std::num::sqrt;
# struct Point { x: f64, y: f64 }
# fn sqrt(f: f64) -> f64 { 0.0 }
fn compute_distance(p1: &Point, p2: &Point) -> f64 {
let x_d = p1.x - p2.x;
let y_d = p1.y - p2.y;
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/hashmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
//! ```

use std::cmp::max;
use std::default::Default;
use std::fmt;
use std::hash::{Hash, Hasher, sip};
use std::iter::{FilterMap, Chain, Repeat, Zip};
Expand Down
1 change: 1 addition & 0 deletions src/libextra/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use std::cmp::Eq;
use std::fmt;
use std::hash::{Hash, sip};
use std::io::BufReader;
use std::from_str::FromStr;
use std::uint;

use collections::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion src/libgreen/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl StackPool {
pub fn take_stack(&mut self, min_size: uint) -> Stack {
// Ideally this would be a binary search
match self.stacks.iter().position(|s| min_size <= s.min_size) {
Some(idx) => self.stacks.swap_remove(idx),
Some(idx) => self.stacks.swap_remove(idx).unwrap(),
None => Stack::new(min_size)
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/libnum/bigint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use Integer;

use std::cmp;
use std::fmt;
use std::from_str::FromStr;
use std::num::{Bitwise, ToPrimitive, FromPrimitive};
use std::num::{Zero, One, ToStrRadix, FromStrRadix};
use std::rand::Rng;
Expand Down Expand Up @@ -1397,8 +1398,9 @@ mod biguint_tests {
use super::{Plus, BigInt, RandBigInt, ToBigInt};
use std::cmp::{Less, Equal, Greater};
use std::from_str::FromStr;
use std::i64;
use std::num::{Zero, One, FromStrRadix};
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
use std::num::{ToPrimitive, FromPrimitive};
use std::rand::{task_rng};
use std::str;
Expand Down Expand Up @@ -2056,7 +2058,7 @@ mod bigint_tests {

use std::cmp::{Less, Equal, Greater};
use std::i64;
use std::num::{Zero, One, FromStrRadix};
use std::num::{Zero, One, FromStrRadix, ToStrRadix};
use std::num::{ToPrimitive, FromPrimitive};
use std::rand::{task_rng};
use std::u64;
Expand Down
2 changes: 1 addition & 1 deletion src/libnum/rational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl<T: FromStrRadix + Clone + Integer + Ord>
mod test {

use super::{Ratio, Rational, BigRational};
use std::num::{Zero,One,FromStrRadix,FromPrimitive};
use std::num::{Zero, One, FromStrRadix, FromPrimitive, ToStrRadix};
use std::from_str::FromStr;

pub static _0 : Rational = Ratio { numer: 0, denom: 1};
Expand Down
5 changes: 4 additions & 1 deletion src/librustc/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ impl Archive {
/// Lists all files in an archive
pub fn files(&self) -> ~[~str] {
let output = run_ar(self.sess, "t", None, [&self.dst]);
str::from_utf8(output.output).unwrap().lines().map(|s| s.to_owned()).collect()
let output = str::from_utf8(output.output).unwrap();
// use lines_any because windows delimits output with `\r\n` instead of
// just `\n`
output.lines_any().map(|s| s.to_owned()).collect()
}

fn add_archive(&mut self, archive: &Path, name: &str,
Expand Down
16 changes: 14 additions & 2 deletions src/librustc/metadata/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ pub struct ArchiveMetadata {
priv data: &'static [u8],
}

// FIXME(#11857) this should be a "real" realpath
fn realpath(p: &Path) -> Path {
use std::os;
use std::io::fs;

let path = os::make_absolute(p);
match fs::readlink(&path) {
Ok(p) => p,
Err(..) => path
}
}

impl Context {
pub fn load_library_crate(&self, root_ident: Option<~str>) -> Library {
match self.find_library_crate() {
Expand Down Expand Up @@ -121,7 +133,7 @@ impl Context {
(HashSet::new(), HashSet::new())
});
let (ref mut rlibs, _) = *slot;
rlibs.insert(path.clone());
rlibs.insert(realpath(path));
FileMatches
}
None => {
Expand All @@ -138,7 +150,7 @@ impl Context {
(HashSet::new(), HashSet::new())
});
let (_, ref mut dylibs) = *slot;
dylibs.insert(path.clone());
dylibs.insert(realpath(path));
FileMatches
}
None => {
Expand Down
23 changes: 13 additions & 10 deletions src/librustc/middle/borrowck/gather_loans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,8 @@ fn gather_loans_in_local(this: &mut GatherLoanCtxt,
})
}
Some(init) => {
// Variable declarations with initializers are considered "assigns":
let tcx = this.bccx.tcx;
pat_util::pat_bindings(tcx.def_map, local.pat, |_, id, span, _| {
gather_moves::gather_assignment(this.bccx,
&this.move_data,
id,
span,
@LpVar(id),
id);
});
// Variable declarations with initializers are considered "assigns",
// which is handled by `gather_pat`:
let init_cmt = this.bccx.cat_expr(init);
this.gather_pat(init_cmt, local.pat, None);
}
Expand Down Expand Up @@ -811,6 +803,17 @@ impl<'a> GatherLoanCtxt<'a> {
self.bccx.cat_pattern(discr_cmt, root_pat, |cmt, pat| {
match pat.node {
ast::PatIdent(bm, _, _) if self.pat_is_binding(pat) => {
// Each match binding is effectively an assignment.
let tcx = self.bccx.tcx;
pat_util::pat_bindings(tcx.def_map, pat, |_, id, span, _| {
gather_moves::gather_assignment(self.bccx,
&self.move_data,
id,
span,
@LpVar(id),
id);
});

match bm {
ast::BindByRef(mutbl) => {
// ref x or ref x @ p --- creates a ptr which must
Expand Down
1 change: 1 addition & 0 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
if !type_is_immediate(ccx, arg_ty) {
unsafe {
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
llvm::LLVMAddAttribute(llarg, lib::llvm::NoCaptureAttribute as c_uint);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/libstd/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ impl Default for bool {
mod tests {
use prelude::*;
use super::all_values;
use from_str::FromStr;

#[test]
fn test_bool() {
Expand Down
1 change: 1 addition & 0 deletions src/libstd/io/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ impl FromStr for SocketAddr {
mod test {
use prelude::*;
use super::*;
use from_str::FromStr;

#[test]
fn test_from_str_ipv4() {
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use prelude::*;

use cmath;
use default::Default;
use from_str::FromStr;
use libc::{c_float, c_int};
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
use num::{Zero, One, Bounded, strconv};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use prelude::*;

use cmath;
use default::Default;
use from_str::FromStr;
use libc::{c_double, c_int};
use num::{FPCategory, FPNaN, FPInfinite , FPZero, FPSubnormal, FPNormal};
use num::{Zero, One, Bounded, strconv};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/i16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
use num::{CheckedDiv, Zero, One, strconv};
use num::{ToStrRadix, FromStrRadix};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/i32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
use num::{CheckedDiv, Zero, One, strconv};
use num::{ToStrRadix, FromStrRadix};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/i64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
#[cfg(target_word_size = "64")]
use num::CheckedMul;
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/i8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
use num::{CheckedDiv, Zero, One, strconv};
use num::{ToStrRadix, FromStrRadix};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded, CheckedAdd, CheckedSub, CheckedMul};
use num::{CheckedDiv, Zero, One, strconv};
use num::{ToStrRadix, FromStrRadix};
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ mod tests {
use int;
use i32;
use num;
use num::CheckedDiv;
use num::Bitwise;
use num::CheckedDiv;
use num::ToStrRadix;

#[test]
fn test_overflows() {
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/u16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded};
use num::{CheckedAdd, CheckedSub, CheckedMul};
use num::{CheckedDiv, Zero, One, strconv};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/u32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded};
use num::{CheckedAdd, CheckedSub, CheckedMul};
use num::{CheckedDiv, Zero, One, strconv};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/u64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded};
#[cfg(target_word_size = "64")]
use num::CheckedMul;
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/u8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded};
use num::{CheckedAdd, CheckedSub, CheckedMul};
use num::{CheckedDiv, Zero, One, strconv};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use prelude::*;

use default::Default;
use from_str::FromStr;
use num::{Bitwise, Bounded};
use num::{CheckedAdd, CheckedSub, CheckedMul};
use num::{CheckedDiv, Zero, One, strconv};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ mod tests {
use num;
use num::CheckedDiv;
use num::Bitwise;
use num::ToStrRadix;
use u16;

#[test]
Expand Down
4 changes: 1 addition & 3 deletions src/libstd/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ pub use char::Char;
pub use clone::{Clone, DeepClone};
pub use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater, Equiv};
pub use container::{Container, Mutable, Map, MutableMap, Set, MutableSet};
pub use default::Default;
pub use from_str::FromStr;
pub use iter::{FromIterator, Extendable};
pub use iter::{Iterator, DoubleEndedIterator, RandomAccessIterator, CloneableIterator};
pub use iter::{OrdIterator, MutableDoubleEndedIterator, ExactSize};
pub use num::{Num, NumCast, CheckedAdd, CheckedSub, CheckedMul};
pub use num::{Signed, Unsigned, Round};
pub use num::{Primitive, Int, Float, ToStrRadix, ToPrimitive, FromPrimitive};
pub use num::{Primitive, Int, Float, ToPrimitive, FromPrimitive};
pub use path::{GenericPath, Path, PosixPath, WindowsPath};
pub use ptr::RawPtr;
pub use io::{Buffer, Writer, Reader, Seek};
Expand Down
1 change: 1 addition & 0 deletions src/libstd/rand/reseeding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ impl Default for ReseedWithDefault {
mod test {
use prelude::*;
use super::*;
use default::Default;
use rand::{SeedableRng, Rng};

struct Counter {
Expand Down
1 change: 1 addition & 0 deletions src/libstd/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3072,6 +3072,7 @@ impl Default for ~str {
#[cfg(test)]
mod tests {
use iter::AdditiveIterator;
use default::Default;
use prelude::*;
use str::*;

Expand Down
Loading

0 comments on commit 4243cad

Please sign in to comment.