diff --git a/RELEASES.md b/RELEASES.md index b19f4b07a3161..6533102a92d56 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -418,7 +418,7 @@ Compatibility Notes numbers [no longer return platform-specific types][1.8r], but instead return widened integers. [RFC 1415]. * [Modules sourced from the filesystem cannot appear within arbitrary - blocks, but only within other modules][1.8m]. + blocks, but only within other modules][1.8mf]. * [`--cfg` compiler flags are parsed strictly as identifiers][1.8c]. * On Unix, [stack overflow triggers a runtime abort instead of a SIGSEGV][1.8so]. @@ -448,7 +448,7 @@ Compatibility Notes [1.8h]: https://github.com/rust-lang/rust/pull/31460 [1.8l]: https://github.com/rust-lang/rust/pull/31668 [1.8m]: https://github.com/rust-lang/rust/pull/31020 -[1.8m]: https://github.com/rust-lang/rust/pull/31534 +[1.8mf]: https://github.com/rust-lang/rust/pull/31534 [1.8mp]: https://github.com/rust-lang/rust/pull/30894 [1.8mr]: https://users.rust-lang.org/t/multirust-0-8-with-cross-std-installation/4901 [1.8ms]: https://github.com/rust-lang/rust/pull/30448 diff --git a/mk/main.mk b/mk/main.mk index 9b8080f96610f..431de6a3f9c80 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -13,7 +13,7 @@ ###################################################################### # The version number -CFG_RELEASE_NUM=1.9.0 +CFG_RELEASE_NUM=1.10.0 # An optional number to put after the label, e.g. '.2' -> '-beta.2' # NB Make sure it starts with a dot to conform to semver pre-release diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock index c33838a146c2c..9bb3e79744bb6 100644 --- a/src/bootstrap/Cargo.lock +++ b/src/bootstrap/Cargo.lock @@ -3,7 +3,7 @@ name = "bootstrap" version = "0.0.0" dependencies = [ "build_helper 0.1.0", - "cmake 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -21,7 +21,7 @@ version = "0.1.0" [[package]] name = "cmake" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 0d334219b4fe9..7b379e1c7b6b9 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -21,7 +21,7 @@ path = "rustdoc.rs" [dependencies] build_helper = { path = "../build_helper" } -cmake = "0.1.10" +cmake = "0.1.17" filetime = "0.1" num_cpus = "0.2" toml = "0.1" diff --git a/src/bootstrap/build/config.rs b/src/bootstrap/build/config.rs index 1e67c4a9a3e8d..98fdaae64a5f2 100644 --- a/src/bootstrap/build/config.rs +++ b/src/bootstrap/build/config.rs @@ -31,6 +31,7 @@ use toml::{Parser, Decoder, Value}; #[derive(Default)] pub struct Config { pub ccache: bool, + pub ninja: bool, pub verbose: bool, pub submodules: bool, pub compiler_docs: bool, @@ -107,6 +108,7 @@ struct Build { #[derive(RustcDecodable, Default)] struct Llvm { ccache: Option, + ninja: Option, assertions: Option, optimize: Option, version_check: Option, @@ -200,9 +202,9 @@ impl Config { if let Some(ref llvm) = toml.llvm { set(&mut config.ccache, llvm.ccache); + set(&mut config.ninja, llvm.ninja); set(&mut config.llvm_assertions, llvm.assertions); set(&mut config.llvm_optimize, llvm.optimize); - set(&mut config.llvm_optimize, llvm.optimize); set(&mut config.llvm_version_check, llvm.version_check); set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp); } diff --git a/src/bootstrap/build/native.rs b/src/bootstrap/build/native.rs index bf0494bcd8c8c..91bc0924b1fef 100644 --- a/src/bootstrap/build/native.rs +++ b/src/bootstrap/build/native.rs @@ -43,6 +43,9 @@ pub fn llvm(build: &Build, target: &str) { // http://llvm.org/docs/CMake.html let mut cfg = cmake::Config::new(build.src.join("src/llvm")); + if build.config.ninja { + cfg.generator("Ninja"); + } cfg.target(target) .host(&build.config.build) .out_dir(&dst) diff --git a/src/bootstrap/build/sanity.rs b/src/bootstrap/build/sanity.rs index 6ce2749638841..50fd9c2453826 100644 --- a/src/bootstrap/build/sanity.rs +++ b/src/bootstrap/build/sanity.rs @@ -48,6 +48,9 @@ pub fn check(build: &mut Build) { } } need_cmd("cmake".as_ref()); + if build.config.ninja { + need_cmd("ninja".as_ref()) + } break } diff --git a/src/doc/book/guessing-game.md b/src/doc/book/guessing-game.md index 590c7e848190a..a2067e33a60aa 100644 --- a/src/doc/book/guessing-game.md +++ b/src/doc/book/guessing-game.md @@ -988,8 +988,7 @@ fn main() { # Complete! -At this point, you have successfully built the Guessing Game! Congratulations! +This project showed you a lot: `let`, `match`, methods, associated +functions, using external crates, and more. -This first project showed you a lot: `let`, `match`, methods, associated -functions, using external crates, and more. Our next project will show off -even more. +At this point, you have successfully built the Guessing Game! Congratulations! diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index b2b1e019a1b89..2059943bfdf61 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -634,9 +634,9 @@ impl str { /// Basic usage: /// /// ``` - /// let s = "Per Martin-Löf"; + /// let mut s = "Per Martin-Löf".to_string(); /// - /// let (first, last) = s.split_at(3); + /// let (first, last) = s.split_at_mut(3); /// /// assert_eq!("Per", first); /// assert_eq!(" Martin-Löf", last); diff --git a/src/libcollectionstest/str.rs b/src/libcollectionstest/str.rs index 929ac7a52ab27..a1820a1cb96e3 100644 --- a/src/libcollectionstest/str.rs +++ b/src/libcollectionstest/str.rs @@ -346,6 +346,22 @@ fn test_slice_fail() { &"中华Việt Nam"[0..2]; } + +#[test] +fn test_is_char_boundary() { + let s = "ศไทย中华Việt Nam β-release 🐱123"; + assert!(s.is_char_boundary(0)); + assert!(s.is_char_boundary(s.len())); + assert!(!s.is_char_boundary(s.len() + 1)); + for (i, ch) in s.char_indices() { + // ensure character locations are boundaries and continuation bytes are not + assert!(s.is_char_boundary(i), "{} is a char boundary in {:?}", i, s); + for j in 1..ch.len_utf8() { + assert!(!s.is_char_boundary(i + j), + "{} should not be a char boundary in {:?}", i + j, s); + } + } +} const LOREM_PARAGRAPH: &'static str = "\ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse quis lorem sit amet dolor \ ultricies condimentum. Praesent iaculis purus elit, ac malesuada quam malesuada in. Duis sed orci \ diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index f923668688b8c..ad90b44750854 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -182,7 +182,7 @@ macro_rules! debug_assert_eq { /// fn write_to_file_using_match() -> Result<(), io::Error> { /// let mut file = try!(File::create("my_best_friends.txt")); /// match file.write_all(b"This is a list of my best friends.") { -/// Ok(_) => (), +/// Ok(v) => v, /// Err(e) => return Err(e), /// } /// println!("I wrote to the file"); diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 574c927bd75d2..4ea6baca36784 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -892,7 +892,7 @@ pub fn rustc_short_optgroups() -> Vec { opt::multi_s("L", "", "Add a directory to the library search path", "[KIND=]PATH"), opt::multi_s("l", "", "Link the generated crate(s) to the specified native - library NAME. The optional KIND can be one of, + library NAME. The optional KIND can be one of static, dylib, or framework. If omitted, dylib is assumed.", "[KIND=]NAME"), opt::multi_s("", "crate-type", "Comma separated list of types of crates diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index bde88605e88cd..72c99d57963c5 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -27,8 +27,7 @@ //! rustc will search each directory in the environment variable //! `RUST_TARGET_PATH` for a file named `TRIPLE.json`. The first one found will //! be loaded. If no file is found in any of those directories, a fatal error -//! will be given. `RUST_TARGET_PATH` includes `/etc/rustc` as its last entry, -//! to be searched by default. +//! will be given. //! //! Projects defining their own targets should use //! `--target=path/to/my-awesome-platform.json` instead of adding to diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index 1e662d456d141..5883013ac72f2 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub use self::Constructor::*; +use self::Constructor::*; use self::Usefulness::*; use self::WitnessPreference::*; diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index cabf5c955466c..ccb2099dcc75d 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -434,7 +434,7 @@ impl<'a,'tcx> Builder<'a,'tcx> { /// But there may also be candidates that the test just doesn't /// apply to. For example, consider the case of #29740: /// - /// ```rust + /// ```rust,ignore /// match x { /// "foo" => ..., /// "bar" => ..., diff --git a/src/librustc_mir/build/matches/util.rs b/src/librustc_mir/build/matches/util.rs index 101d7594309a9..e5f2c7543786e 100644 --- a/src/librustc_mir/build/matches/util.rs +++ b/src/librustc_mir/build/matches/util.rs @@ -32,14 +32,18 @@ impl<'a,'tcx> Builder<'a,'tcx> { /// this function converts the prefix (`x`, `y`) and suffix (`z`) into /// distinct match pairs: /// + /// ```rust,ignore /// lv[0 of 3] @ x // see ProjectionElem::ConstantIndex (and its Debug impl) /// lv[1 of 3] @ y // to explain the `[x of y]` notation /// lv[-1 of 3] @ z + /// ``` /// /// If a slice like `s` is present, then the function also creates /// a temporary like: /// + /// ```rust,ignore /// tmp0 = lv[2..-1] // using the special Rvalue::Slice + /// ``` /// /// and creates a match pair `tmp0 @ s` pub fn prefix_suffix_slice<'pat>(&mut self, diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index 84fda62067d95..bfbf27d46d005 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -47,7 +47,7 @@ set of scheduled drops up front, and so whenever we exit from the scope we only drop the values scheduled thus far. For example, consider the scope S corresponding to this loop: -``` +```rust,ignore loop { let x = ...; if cond { break; } diff --git a/src/librustc_mir/pretty.rs b/src/librustc_mir/pretty.rs index e9c9edd118353..77e8e37ef7493 100644 --- a/src/librustc_mir/pretty.rs +++ b/src/librustc_mir/pretty.rs @@ -23,7 +23,7 @@ const INDENT: &'static str = " "; /// If the session is properly configured, dumps a human-readable /// representation of the mir into: /// -/// ``` +/// ```text /// rustc.node.. /// ``` /// diff --git a/src/librustc_mir/traversal.rs b/src/librustc_mir/traversal.rs index 8b6821136f511..c58b5c8772461 100644 --- a/src/librustc_mir/traversal.rs +++ b/src/librustc_mir/traversal.rs @@ -19,6 +19,8 @@ use rustc::mir::repr::*; /// Preorder traversal is when each node is visited before an of it's /// successors /// +/// ```text +/// /// A /// / \ /// / \ @@ -26,6 +28,7 @@ use rustc::mir::repr::*; /// \ / /// \ / /// D +/// ``` /// /// A preorder traversal of this graph is either `A B D C` or `A C D B` #[derive(Clone)] @@ -80,6 +83,9 @@ impl<'a, 'tcx> Iterator for Preorder<'a, 'tcx> { /// Postorder traversal is when each node is visited after all of it's /// successors, except when the successor is only reachable by a back-edge /// +/// +/// ```text +/// /// A /// / \ /// / \ @@ -87,6 +93,7 @@ impl<'a, 'tcx> Iterator for Preorder<'a, 'tcx> { /// \ / /// \ / /// D +/// ``` /// /// A Postorder traversal of this graph is `D B C A` or `D C B A` pub struct Postorder<'a, 'tcx: 'a> { @@ -215,6 +222,8 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> { /// This is different to a preorder traversal and represents a natural /// linearisation of control-flow. /// +/// ```text +/// /// A /// / \ /// / \ @@ -222,6 +231,7 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> { /// \ / /// \ / /// D +/// ``` /// /// A reverse postorder traversal of this graph is either `A B C D` or `A C B D` /// Note that for a graph containing no loops (i.e. A DAG), this is equivalent to diff --git a/src/librustc_trans/_match.rs b/src/librustc_trans/_match.rs index d8b8f9f08067c..e390aa32dfee8 100644 --- a/src/librustc_trans/_match.rs +++ b/src/librustc_trans/_match.rs @@ -189,7 +189,7 @@ use self::Opt::*; use self::FailureHandler::*; use llvm::{ValueRef, BasicBlockRef}; -use rustc_const_eval::check_match::{self, StaticInliner}; +use rustc_const_eval::check_match::{self, Constructor, StaticInliner}; use rustc_const_eval::{compare_lit_exprs, eval_const_expr}; use rustc::hir::def::{Def, DefMap}; use rustc::hir::def_id::DefId; @@ -609,19 +609,19 @@ fn enter_opt<'a, 'p, 'blk, 'tcx>( let _indenter = indenter(); let ctor = match opt { - &ConstantValue(ConstantExpr(expr), _) => check_match::ConstantValue( + &ConstantValue(ConstantExpr(expr), _) => Constructor::ConstantValue( eval_const_expr(bcx.tcx(), &expr) ), - &ConstantRange(ConstantExpr(lo), ConstantExpr(hi), _) => check_match::ConstantRange( + &ConstantRange(ConstantExpr(lo), ConstantExpr(hi), _) => Constructor::ConstantRange( eval_const_expr(bcx.tcx(), &lo), eval_const_expr(bcx.tcx(), &hi) ), &SliceLengthEqual(n, _) => - check_match::Slice(n), + Constructor::Slice(n), &SliceLengthGreaterOrEqual(before, after, _) => - check_match::SliceWithSubslice(before, after), + Constructor::SliceWithSubslice(before, after), &Variant(_, _, def_id, _) => - check_match::Constructor::Variant(def_id) + Constructor::Variant(def_id) }; let param_env = bcx.tcx().empty_parameter_environment(); @@ -1229,7 +1229,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, Some(field_vals) => { let pats = enter_match(bcx, dm, m, col, val, |pats| check_match::specialize(&mcx, pats, - &check_match::Single, col, + &Constructor::Single, col, field_vals.len()) ); let mut vals: Vec<_> = field_vals.into_iter() diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 6dd7273c17fe7..d914d143e7011 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -1505,6 +1505,11 @@ impl Read for Take { #[stable(feature = "rust1", since = "1.0.0")] impl BufRead for Take { fn fill_buf(&mut self) -> Result<&[u8]> { + // Don't call into inner reader at all at EOF because it may still block + if self.limit == 0 { + return Ok(&[]); + } + let buf = self.inner.fill_buf()?; let cap = cmp::min(buf.len() as u64, self.limit) as usize; Ok(&buf[..cap]) @@ -1860,9 +1865,16 @@ mod tests { Err(io::Error::new(io::ErrorKind::Other, "")) } } + impl BufRead for R { + fn fill_buf(&mut self) -> io::Result<&[u8]> { + Err(io::Error::new(io::ErrorKind::Other, "")) + } + fn consume(&mut self, _amt: usize) { } + } let mut buf = [0; 1]; assert_eq!(0, R.take(0).read(&mut buf).unwrap()); + assert_eq!(b"", R.take(0).fill_buf().unwrap()); } fn cmp_bufread(mut br1: Br1, mut br2: Br2, exp: &[u8]) { diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index 16401c4527f16..bbd89af01a73a 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -346,9 +346,9 @@ impl R> FnOnce<()> for AssertRecoverSafe { /// It is **not** recommended to use this function for a general try/catch /// mechanism. The `Result` type is more appropriate to use for functions that /// can fail on a regular basis. Additionally, this function is not guaranteed -/// to catch all panics, see the "Notes" sectino below. +/// to catch all panics, see the "Notes" section below. /// -/// The closure provided is required to adhere to the `UnwindSafe` to ensure +/// The closure provided is required to adhere to the `UnwindSafe` trait to ensure /// that all captured variables are safe to cross this boundary. The purpose of /// this bound is to encode the concept of [exception safety][rfc] in the type /// system. Most usage of this function should not need to worry about this diff --git a/src/snapshots.txt b/src/snapshots.txt index 61dfd4f8f867d..3cf9f3e81e1ae 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -6,6 +6,7 @@ S 2016-03-18 235d774 winnt-i386 7703869608cc4192b8f1943e51b19ba1a03c0110 winnt-x86_64 8512b5ecc0c53a2cd3552e4f5688577de95cd978 openbsd-x86_64 c5b6feda38138a12cd5c05574b585dadebbb5e87 + freebsd-i386 b5a87e66e3e3eed5f0b68367ad22f25f0be2d4ea freebsd-x86_64 390b9a9f60f3d0d6a52c04d939a0355f572d03b3 S 2016-02-17 4d3eebf diff --git a/src/test/compile-fail/feature-gate-try-operator.rs b/src/test/compile-fail/feature-gate-try-operator.rs index 184aa63b23426..b05c7323962c5 100644 --- a/src/test/compile-fail/feature-gate-try-operator.rs +++ b/src/test/compile-fail/feature-gate-try-operator.rs @@ -14,7 +14,5 @@ macro_rules! id { fn main() { id!(x?); //~ error: the `?` operator is not stable (see issue #31436) - //~^ help: add #![feature(question_mark)] to the crate attributes to enable y?; //~ error: the `?` operator is not stable (see issue #31436) - //~^ help: add #![feature(question_mark)] to the crate attributes to enable }