From bbdef0ce59a74aa585186b4987e6f7751e49aea7 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 27 Jan 2016 21:42:26 +0200 Subject: [PATCH 01/10] rustfmt syntax::parse --- src/libsyntax/parse/attr.rs | 68 ++++++++++++++++----------------- src/libsyntax/parse/classify.rs | 28 +++++++------- src/libsyntax/parse/common.rs | 2 +- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index cad9b45694b28..96ac9b83d2f24 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -22,26 +22,25 @@ impl<'a> Parser<'a> { pub fn parse_outer_attributes(&mut self) -> PResult<'a, Vec> { let mut attrs: Vec = Vec::new(); loop { - debug!("parse_outer_attributes: self.token={:?}", - self.token); + debug!("parse_outer_attributes: self.token={:?}", self.token); match self.token { - token::Pound => { - attrs.push(try!(self.parse_attribute(false))); - } - token::DocComment(s) => { - let attr = ::attr::mk_sugared_doc_attr( + token::Pound => { + attrs.push(try!(self.parse_attribute(false))); + } + token::DocComment(s) => { + let attr = ::attr::mk_sugared_doc_attr( attr::mk_attr_id(), self.id_to_interned_str(ast::Ident::with_empty_ctxt(s)), self.span.lo, self.span.hi ); - if attr.node.style != ast::AttrStyle::Outer { - return Err(self.fatal("expected outer comment")); + if attr.node.style != ast::AttrStyle::Outer { + return Err(self.fatal("expected outer comment")); + } + attrs.push(attr); + self.bump(); } - attrs.push(attr); - self.bump(); - } - _ => break + _ => break, } } return Ok(attrs); @@ -53,24 +52,27 @@ impl<'a> Parser<'a> { /// attribute pub fn parse_attribute(&mut self, permit_inner: bool) -> PResult<'a, ast::Attribute> { debug!("parse_attributes: permit_inner={:?} self.token={:?}", - permit_inner, self.token); + permit_inner, + self.token); let (span, value, mut style) = match self.token { token::Pound => { let lo = self.span.lo; self.bump(); - if permit_inner { self.expected_tokens.push(TokenType::Token(token::Not)); } + if permit_inner { + self.expected_tokens.push(TokenType::Token(token::Not)); + } let style = if self.token == token::Not { self.bump(); if !permit_inner { let span = self.span; - self.diagnostic().struct_span_err(span, - "an inner attribute is not permitted in \ - this context") - .fileline_help(span, - "place inner attribute at the top of \ - the module or block") - .emit() + self.diagnostic() + .struct_span_err(span, + "an inner attribute is not permitted in this context") + .fileline_help(span, + "place inner attribute at the top of the module or \ + block") + .emit() } ast::AttrStyle::Inner } else { @@ -92,8 +94,9 @@ impl<'a> Parser<'a> { if permit_inner && self.token == token::Semi { self.bump(); - self.span_warn(span, "this inner attribute syntax is deprecated. \ - The new syntax is `#![foo]`, with a bang and no semicolon"); + self.span_warn(span, + "this inner attribute syntax is deprecated. The new syntax is \ + `#![foo]`, with a bang and no semicolon"); style = ast::AttrStyle::Inner; } @@ -103,8 +106,8 @@ impl<'a> Parser<'a> { id: attr::mk_attr_id(), style: style, value: value, - is_sugared_doc: false - } + is_sugared_doc: false, + }, }) } @@ -139,7 +142,7 @@ impl<'a> Parser<'a> { break; } } - _ => break + _ => break, } } Ok(attrs) @@ -150,10 +153,8 @@ impl<'a> Parser<'a> { /// | IDENT meta_seq pub fn parse_meta_item(&mut self) -> PResult<'a, P> { let nt_meta = match self.token { - token::Interpolated(token::NtMeta(ref e)) => { - Some(e.clone()) - } - _ => None + token::Interpolated(token::NtMeta(ref e)) => Some(e.clone()), + _ => None, }; match nt_meta { @@ -176,9 +177,8 @@ impl<'a> Parser<'a> { match lit.node { ast::LitStr(..) => {} _ => { - self.span_err( - lit.span, - "non-string literals are not allowed in meta-items"); + self.span_err(lit.span, + "non-string literals are not allowed in meta-items"); } } let hi = self.span.hi; diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index 8b3faaaca146a..1193224bdb625 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -23,22 +23,22 @@ use ast; /// isn't parsed as (if true {...} else {...} | x) | 5 pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool { match e.node { - ast::ExprIf(..) - | ast::ExprIfLet(..) - | ast::ExprMatch(..) - | ast::ExprBlock(_) - | ast::ExprWhile(..) - | ast::ExprWhileLet(..) - | ast::ExprLoop(..) - | ast::ExprForLoop(..) => false, - _ => true + ast::ExprIf(..) | + ast::ExprIfLet(..) | + ast::ExprMatch(..) | + ast::ExprBlock(_) | + ast::ExprWhile(..) | + ast::ExprWhileLet(..) | + ast::ExprLoop(..) | + ast::ExprForLoop(..) => false, + _ => true, } } pub fn expr_is_simple_block(e: &ast::Expr) -> bool { match e.node { ast::ExprBlock(ref block) => block.rules == ast::DefaultBlock, - _ => false + _ => false, } } @@ -50,11 +50,11 @@ pub fn stmt_ends_with_semi(stmt: &ast::Stmt_) -> bool { ast::StmtDecl(ref d, _) => { match d.node { ast::DeclLocal(_) => true, - ast::DeclItem(_) => false + ast::DeclItem(_) => false, } } - ast::StmtExpr(ref e, _) => { expr_requires_semi_to_be_stmt(e) } - ast::StmtSemi(..) => { false } - ast::StmtMac(..) => { false } + ast::StmtExpr(ref e, _) => expr_requires_semi_to_be_stmt(e), + ast::StmtSemi(..) => false, + ast::StmtMac(..) => false, } } diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index a96bf1ce10b79..060b0b5263765 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -16,7 +16,7 @@ use parse::token; /// and whether a trailing separator is allowed. pub struct SeqSep { pub sep: Option, - pub trailing_sep_allowed: bool + pub trailing_sep_allowed: bool, } pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep { From 1339ca9bf277ba30549fc2c1a21ce13b04fb60b1 Mon Sep 17 00:00:00 2001 From: Andrew Barchuk Date: Fri, 29 Jan 2016 10:45:37 +0100 Subject: [PATCH 02/10] Fix link to Installing Rust section of the book --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 84fb8f3e5b089..293f585d105cb 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ and documentation. Read ["Installing Rust"] from [The Book]. -["Installing Rust"]: https://doc.rust-lang.org/book/installing-rust.html +["Installing Rust"]: https://doc.rust-lang.org/book/getting-started.html#installing-rust [The Book]: https://doc.rust-lang.org/book/index.html ## Building from Source From 7e1acc57d827f2141c425a2420f8769790abac42 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 29 Jan 2016 12:22:29 -0800 Subject: [PATCH 03/10] mk: Fix compiling jemalloc for powerpc64 We forgot to pass down the `-m64` flag to gcc, so we were actually compiling powerpc code which would then later fail to link! --- mk/cfg/powerpc64-unknown-linux-gnu.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/mk/cfg/powerpc64-unknown-linux-gnu.mk b/mk/cfg/powerpc64-unknown-linux-gnu.mk index cf49c711ba61f..f6e6436f61578 100644 --- a/mk/cfg/powerpc64-unknown-linux-gnu.mk +++ b/mk/cfg/powerpc64-unknown-linux-gnu.mk @@ -8,6 +8,7 @@ CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM +CFG_JEMALLOC_CFLAGS_powerpc64-unknown-linux-gnu := -m64 CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS) CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS) CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS) From ea31ff20f0437db5f77fc3e8d6d6f2efad74f887 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 29 Jan 2016 12:36:45 -0800 Subject: [PATCH 04/10] mk: Fix cross-compiling to armv7-unknown-linux-gnu The cross prefix was not likely the actual compiler that needed to be used, but rather the standard `arm-linux-gnueabihf-gcc` compiler can just be used with `-march=armv7`. --- mk/cfg/armv7-unknown-linux-gnueabihf.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mk/cfg/armv7-unknown-linux-gnueabihf.mk b/mk/cfg/armv7-unknown-linux-gnueabihf.mk index c676bfb1289fd..546c71f667ffa 100644 --- a/mk/cfg/armv7-unknown-linux-gnueabihf.mk +++ b/mk/cfg/armv7-unknown-linux-gnueabihf.mk @@ -1,5 +1,5 @@ # armv7-unknown-linux-gnueabihf configuration -CROSS_PREFIX_armv7-unknown-linux-gnueabihf=armv7-unknown-linux-gnueabihf- +CROSS_PREFIX_armv7-unknown-linux-gnueabihf=arm-linux-gnueabihf- CC_armv7-unknown-linux-gnueabihf=gcc CXX_armv7-unknown-linux-gnueabihf=g++ CPP_armv7-unknown-linux-gnueabihf=gcc -E @@ -8,8 +8,8 @@ CFG_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).so CFG_STATIC_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).a CFG_LIB_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.so CFG_LIB_DSYM_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM -CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) +CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv7 +CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv7 CFG_GCCISH_CXXFLAGS_armv7-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS) CFG_GCCISH_LINK_FLAGS_armv7-unknown-linux-gnueabihf := -shared -fPIC -g CFG_GCCISH_DEF_FLAG_armv7-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list= From b960de0984cec27989746eec6fa706b3a7b46ad3 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 29 Jan 2016 13:46:47 -0800 Subject: [PATCH 05/10] std: Ignore dtors_in_dtors_in_dtors on OSX This test has been deadlocking and causing problems on the bots basically since its inception. Some memory safety issues were fixed in 987dc84b, but the deadlocks remained afterwards unfortunately. After some investigation, I've concluded that this is just a situation where OSX is not guaranteed to run destructors. The fix in 987dc84b observed that OSX was rewriting the backing TLS memory to its initial state during destruction while we weren't looking, and this would have the effect of canceling the destructors of any other initialized TLS slots. While very difficult to pin down, this is basically what I assume is happening here, so there doesn't seem to really be anythig we can do to ensure the test robustly passes on OSX, so just ignore it for now. --- src/libstd/thread/local.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index ca0f103156253..d1f5cf81c038d 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -56,6 +56,26 @@ use mem; /// assert_eq!(*f.borrow(), 2); /// }); /// ``` +/// +/// # Platform-specific behavior +/// +/// Note that a "best effort" is made to ensure that destructors for types +/// stored in thread local storage are run, but not all platforms can gurantee +/// that destructors will be run for all types in thread local storage. For +/// example, there are a number of known caveats where destructors are not run: +/// +/// 1. On Unix systems when pthread-based TLS is being used, destructors will +/// not be run for TLS values on the main thread when it exits. Note that the +/// application will exit immediately after the main thread exits as well. +/// 2. On all platforms it's possible for TLS to re-initialize other TLS slots +/// during destruction. Some platforms ensure that this cannot happen +/// infinitely by preventing re-initialization of any slot that has been +/// destroyed, but not all platforms have this guard. Those platforms that do +/// not guard typically have a synthetic limit after which point no more +/// destructors are run. +/// 3. On OSX, initializing TLS during destruction of other TLS slots can +/// sometimes cancel *all* destructors for the current thread, whether or not +/// the slots have already had their destructors run or not. #[stable(feature = "rust1", since = "1.0.0")] pub struct LocalKey { // This outer `LocalKey` type is what's going to be stored in statics, @@ -602,7 +622,12 @@ mod tests { }).join().ok().unwrap(); } + // Note that this test will deadlock if TLS destructors aren't run (this + // requires the destructor to be run to pass the test). OSX has a known bug + // where dtors-in-dtors may cancel other destructors, so we just ignore this + // test on OSX. #[test] + #[cfg_attr(target_os = "macos", ignore)] fn dtors_in_dtors_in_dtors() { struct S1(Sender<()>); thread_local!(static K1: UnsafeCell> = UnsafeCell::new(None)); From 5918d9b96f4c226827cc147b119890fdafb874f0 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 19 Jan 2016 00:18:11 +0000 Subject: [PATCH 06/10] Release notes for 1.6 --- RELEASES.md | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index f8679431339da..9a8eb80aedf22 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,156 @@ +Version 1.6.0 (2016-01-21) +========================== + +Language +-------- + +* The `#![no_std]` attribute causes a crate to not be linked to the + standard library, but only the [core library][1.6co], as described + in [RFC 1184]. The core library defines common types and traits but + has no platform dependencies whatsoever, and is the basis for Rust + software in environments that cannot support a full port of the + standard library, such as operating systems. Most of the core + library is now stable. + +Libraries +--------- + +* Stabilized APIs: + [`Read::read_exact`], [`ErrorKind::UnexpectedEof`] (renamed from + `UnexpectedEOF`), [`fs::DirBuilder`], [`fs::DirBuilder::new`], + [`fs::DirBuilder::recursive`], [`fs::DirBuilder::create`], + [`os::unix::fs::DirBuilderExt`], + [`os::unix::fs::DirBuilderExt::mode`], [`vec::Drain`], + [`vec::Vec::drain`], [`string::Drain`], [`string::String::drain`], + [`vec_deque::Drain`], [`vec_deque::VecDeque::drain`], + [`collections::hash_map::Drain`], + [`collections::hash_map::HashMap::drain`], + [`collections::hash_set::Drain`], + [`collections::hash_set::HashSet::drain`], + [`collections::binary_heap::Drain`], + [`collections::binary_heap::BinaryHeap::drain`], + [`Vec::extend_from_slice`] (renamed from `push_all`), + [`Mutex::get_mut`], [`Mutex::into_inner`], [`RwLock::get_mut`], + [`RwLock::into_inner`], [`Iterator::min_by_key`] (renamed from + `min_by`), [`Iterator::max_by_key`] (renamed from `max_by`). +* The [core library][1.6co] is stable, as are most of its APIs. +* [The `assert_eq!` macro supports arguments that don't implement + `Sized`][1.6ae], such as arrays. In this way it behaves more like + `assert!`. +* Several timer functions that take duration in milliseconds [are + deprecated in favor of those that take `Duration`][1.6ms]. These + include `Condvar::wait_timeout_ms`, `thread::sleep_ms`, and + `thread::park_timeout_ms`. +* The algorithm by which `Vec` reserves additional elements was + [tweaked to not allocate excessive space][1.6a] while still growing + exponentially. +* `From` conversions are [implemented from integers to floats][1.6f] + in cases where the conversion is lossless. Thus they are not + implemented for 32-bit ints to `f32`, nor for 64-bit ints to `f32` + or `f64`. They are also not implemented for `isize` and `usize` + because the implementations would be platform-specific. `From` is + also implemented from `f32` to `f64`. +* `From<&Path>` and `From` are implemented for `Cow`. +* `From` is implemented for `Box`, `Rc` and `Arc`. +* `IntoIterator` is implemented for `&PathBuf` and `&Path`. +* [`BinaryHeap` was refactored][1.6bh] for modest performance + improvements. +* Sorting slices that are already sorted [is 50% faster in some + cases][1.6s]. + +Cargo +----- + +* Cargo will look in `$CARGO_HOME/bin` for subcommands [by default][1.6c]. +* Cargo build scripts can specify their dependencies by emitting the + [`rerun-if-changed`][1.6rr] key. +* crates.io will reject publication of crates with dependencies that + have a wildcard version constraint. Crates with wildcard + dependencies were seen to cause a variety of problems, as described + in [RFC 1241]. Since 1.5 publication of such crates has emitted a + warning. +* `cargo clean` [accepts a `--release` flag][1.6cc] to clean the + release folder. A variety of artifacts that Cargo failed to clean + are now correctly deleted. + +Misc +---- + +* The `unreachable_code` lint [warns when a function call's argument + diverges][1.6dv]. +* The parser indicates [failures that may be caused by + confusingly-similar Unicode characters][1.6uc] +* Certain macro errors [are reported at definition time][1.6m], not + expansion. + +Compatibility Notes +------------------- + +* The compiler no longer makes use of the [`RUST_PATH`][1.6rp] + environment variable when locating crates. This was a pre-cargo + feature for integrating with the package manager that was + accidentally never removed. +* [A number of bugs were fixed in the privacy checker][1.6p] that + could cause previously-accepted code to break. +* [Modules and unit/tuple structs may not share the same name][1.6ts]. +* [Bugs in pattern matching unit structs were fixed][1.6us]. The tuple + struct pattern syntax (`Foo(..)`) can no longer be used to match + unit structs. This is a warning now, but will become an error in + future releases. Patterns that share the same name as a const are + now an error. +* A bug was fixed that causes [rustc not to apply default type + parameters][1.6xc] when resolving certain method implementations of + traits defined in other crates. + +[1.6a]: https://github.com/rust-lang/rust/pull/29454 +[1.6ae]: https://github.com/rust-lang/rust/pull/29770 +[1.6bh]: https://github.com/rust-lang/rust/pull/29811 +[1.6c]: https://github.com/rust-lang/cargo/pull/2192 +[1.6cc]: https://github.com/rust-lang/cargo/pull/2131 +[1.6co]: http://doc.rust-lang.org/beta/core/index.html +[1.6dv]: https://github.com/rust-lang/rust/pull/30000 +[1.6f]: https://github.com/rust-lang/rust/pull/29129 +[1.6m]: https://github.com/rust-lang/rust/pull/29828 +[1.6ms]: https://github.com/rust-lang/rust/pull/29604 +[1.6p]: https://github.com/rust-lang/rust/pull/29726 +[1.6rp]: https://github.com/rust-lang/rust/pull/30034 +[1.6rr]: https://github.com/rust-lang/cargo/pull/2134 +[1.6s]: https://github.com/rust-lang/rust/pull/29675 +[1.6ts]: https://github.com/rust-lang/rust/issues/21546 +[1.6uc]: https://github.com/rust-lang/rust/pull/29837 +[1.6us]: https://github.com/rust-lang/rust/pull/29383 +[1.6xc]: https://github.com/rust-lang/rust/issues/30123 +[RFC 1184]: https://github.com/rust-lang/rfcs/blob/master/text/1184-stabilize-no_std.md +[RFC 1241]: https://github.com/rust-lang/rfcs/blob/master/text/1241-no-wildcard-deps.md +[`ErrorKind::UnexpectedEof`]: http://doc.rust-lang.org/nightly/std/io/enum.ErrorKind.html#variant.UnexpectedEof +[`Iterator::max_by_key`]: http://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.max_by_key +[`Iterator::min_by_key`]: http://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.min_by_key +[`Mutex::get_mut`]: http://doc.rust-lang.org/nightly/std/sync/struct.Mutex.html#method.get_mut +[`Mutex::into_inner`]: http://doc.rust-lang.org/nightly/std/sync/struct.Mutex.html#method.into_inner +[`Read::read_exact`]: http://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.read_exact +[`RwLock::get_mut`]: http://doc.rust-lang.org/nightly/std/sync/struct.RwLock.html#method.get_mut +[`RwLock::into_inner`]: http://doc.rust-lang.org/nightly/std/sync/struct.RwLock.html#method.into_inner +[`Vec::extend_from_slice`]: http://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html#method.extend_from_slice +[`collections::binary_heap::BinaryHeap::drain`]: http://doc.rust-lang.org/nightly/std/collections/binary_heap/struct.BinaryHeap.html#method.drain +[`collections::binary_heap::Drain`]: http://doc.rust-lang.org/nightly/std/collections/binary_heap/struct.Drain.html +[`collections::hash_map::Drain`]: http://doc.rust-lang.org/nightly/std/collections/hash_map/struct.Drain.html +[`collections::hash_map::HashMap::drain`]: http://doc.rust-lang.org/nightly/std/collections/hash_map/struct.HashMap.html#method.drain +[`collections::hash_set::Drain`]: http://doc.rust-lang.org/nightly/std/collections/hash_set/struct.Drain.html +[`collections::hash_set::HashSet::drain`]: http://doc.rust-lang.org/nightly/std/collections/hash_set/struct.HashSet.html#method.drain +[`fs::DirBuilder::create`]: http://doc.rust-lang.org/nightly/std/fs/struct.DirBuilder.html#method.create +[`fs::DirBuilder::new`]: http://doc.rust-lang.org/nightly/std/fs/struct.DirBuilder.html#method.new +[`fs::DirBuilder::recursive`]: http://doc.rust-lang.org/nightly/std/fs/struct.DirBuilder.html#method.recursive +[`fs::DirBuilder`]: http://doc.rust-lang.org/nightly/std/fs/struct.DirBuilder.html +[`os::unix::fs::DirBuilderExt::mode`]: http://doc.rust-lang.org/nightly/std/os/unix/fs/trait.DirBuilderExt.html#tymethod.mode +[`os::unix::fs::DirBuilderExt`]: http://doc.rust-lang.org/nightly/std/os/unix/fs/trait.DirBuilderExt.html +[`string::Drain`]: http://doc.rust-lang.org/nightly/std/string/struct.Drain.html +[`string::String::drain`]: http://doc.rust-lang.org/nightly/std/string/struct.String.html#method.drain +[`vec::Drain`]: http://doc.rust-lang.org/nightly/std/vec/struct.Drain.html +[`vec::Vec::drain`]: http://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.drain +[`vec_deque::Drain`]: http://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.Drain.html +[`vec_deque::VecDeque::drain`]: http://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.VecDeque.html#method.drain + + Version 1.5.0 (2015-12-10) ========================== From 6dbff0577616550140c735379d66892611d7759d Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 22 Jan 2016 00:02:28 +0000 Subject: [PATCH 07/10] Update release notes for 1.7 --- RELEASES.md | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 204 insertions(+), 5 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 9a8eb80aedf22..5ff06f2f81075 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,200 @@ +Version 1.7.0 (2016-03-03) +========================== + +Language +-------- + +* Soundness fixes to the interactions between associated types and + lifetimes, specified in [RFC 1214], [now generate errors][1.7sf] for + code that violates the new rules. This is a significant change that + is known to break existing code, so it has emitted warnings for the + new error cases since 1.4 to give crate authors time to adapt. The + details of what is changing are subtle; read the RFC for more. + +Libraries +--------- + +* Stabilized APIs: + [`Path::strip_prefix`][] (renamed from relative_from), + [`path::StripPrefixError`][] (new error type returned from strip_prefix), + [`Ipv4Addr::is_loopback`], + [`Ipv4Addr::is_private`], + [`Ipv4Addr::is_link_local`], + [`Ipv4Addr::is_multicast`], + [`Ipv4Addr::is_broadcast`], + [`Ipv4Addr::is_documentation`], + [`Ipv6Addr::is_unspecified`], + [`Ipv6Addr::is_loopback`], + [`Ipv6Addr::is_multicast`], + [`Vec::as_slice`], + [`Vec::as_mut_slice`], + [`String::as_str`], + [`String::as_mut_str`], + `<[T]>::`[`clone_from_slice`], which now requires the two slices to + be the same length + `<[T]>::`[`sort_by_key`], + [`i32::checked_rem`], + [`i32::checked_neg`], + [`i32::checked_shl`], + [`i32::checked_shr`], + [`i32::saturating_mul`], + [`i32::overflowing_add`], + [`i32::overflowing_sub`], + [`i32::overflowing_mul`], + [`i32::overflowing_div`], + [`i32::overflowing_rem`], + [`i32::overflowing_neg`], + [`i32::overflowing_shl`], + [`i32::overflowing_shr`], + [`u32::checked_rem`], + [`u32::checked_neg`], + [`u32::checked_shl`], + [`u32::checked_shl`], + [`u32::saturating_mul`], + [`u32::overflowing_add`], + [`u32::overflowing_sub`], + [`u32::overflowing_mul`], + [`u32::overflowing_div`], + [`u32::overflowing_rem`], + [`u32::overflowing_neg`], + [`u32::overflowing_shl`], + [`u32::overflowing_shr`], + checked, saturated, and overflowing operations for other primitive types, + [`ffi::IntoStringError`], + [`CString::into_string`], + [`CString::into_bytes`], + [`CString::into_bytes_with_nul`], + `From for Vec`, + [`IntoStringError::into_cstring`], + [`IntoStringError::utf8_error`], + `Error for IntoStringError`. +* [Validating UTF-8 is faster by a factor of between 7 and 14x for + ASCII input][1.7utf8]. This means that creating `String`s and `str`s + from bytes is faster. +* [The performance of `LineWriter` (and thus `io::stdout`) was + improved by using `memchr` to search for newlines][1.7m]. +* [`f32::to_degrees` and `f32::to_radians` are stable][1.7f]. The + `f64` variants were stabilized previously. +* [`BTreeMap` was rewritten to use less memory improve performance of + insertion and iteration, the latter by as much as 5x`][1.7bm]. +* [`BTreeSet` and its iterators, `Iter`, `IntoIter`, and `Range` are + covariant over their contained type][1.7bt]. +* [`LinkedList` and its iterators, `Iter` and `IntoIter` are covariant + over their contained type][1.7ll]. +* [`str::replace` now accepts a `Pattern`][1.7rp], like other string + searching methods. +* [`Any` is implemented for unsized types][1.7a]. +* [`Hash` is implemented for `Duration`][1.7h]. + +Misc +---- + +* [The `--error-format=json` flag to `rustc` causes it to emit errors + in JSON format][1.7j]. This is an unstable flag and so also requires + the `-Z unstable-options` flag. +* [When running tests with `--test`, rustdoc will pass `--cfg` + arguments to the compiler][1.7dt]. +* [The compiler is built with RPATH information by default][1.7rp]. + This means that it will be possible to run `rustc` when installed in + unusual configurations without configuring the dynamic linker search + path explicitly. +* [`rustc` passes `--enable-new-dtags` to GNU ld][1.7dt]. This makes + any RPATH entries (emitted with `-C rpath`) *not* take precedence + over `LD_LIBRARY_PATH`. + +Cargo +----- + +* [`cargo rustc` accepts a `--profile` flag that runs `rustc` under + any of the compilation profiles, 'dev', 'bench', or 'test'][1.7cp]. +* [The `rerun-if-changed` build script directive no longer causes the + build script to incorrectly run twice in certain scenarios][1.7rr]. + +Compatibility Notes +------------------- + +* [Several bugs in the compiler's visibility calculations were + fixed][1.7v]. Since this was found to break significant amounts of + code, the new errors will be emitted as warnings for several release + cycles, under the `private_in_public` lint. +* Defaulted type parameters were accidentally accepted in positions + that were not intended. In this release, [defaulted type parameters + appearing outside of type definitions will generate a + warning][1.7d], which will become an error in future releases. +* [Parsing "." as a float results in an error instead of + 0][1.7p]. That is, `".".parse::()` returns `Err`, not `Ok(0)`. +* [Borrows of closure parameters may not outlive the closure][1.7bc]. + +[1.7a]: https://github.com/rust-lang/rust/pull/30928 +[1.7bc]: https://github.com/rust-lang/rust/pull/30341 +[1.7bm]: https://github.com/rust-lang/rust/pull/30426 +[1.7bt]: https://github.com/rust-lang/rust/pull/30998 +[1.7cp]: https://github.com/rust-lang/cargo/pull/2224 +[1.7d]: https://github.com/rust-lang/rust/pull/30724 +[1.7dt]: https://github.com/rust-lang/rust/pull/30372 +[1.7dt]: https://github.com/rust-lang/rust/pull/30394 +[1.7f]: https://github.com/rust-lang/rust/pull/30672 +[1.7h]: https://github.com/rust-lang/rust/pull/30818 +[1.7j]: https://github.com/rust-lang/rust/pull/30711 +[1.7ll]: https://github.com/rust-lang/rust/pull/30663 +[1.7m]: https://github.com/rust-lang/rust/pull/30381 +[1.7p]: https://github.com/rust-lang/rust/pull/30681 +[1.7rp]: https://github.com/rust-lang/rust/pull/29498 +[1.7rp]: https://github.com/rust-lang/rust/pull/30353 +[1.7rr]: https://github.com/rust-lang/cargo/pull/2279 +[1.7sf]: https://github.com/rust-lang/rust/pull/30389 +[1.7utf8]: https://github.com/rust-lang/rust/pull/30740 +[1.7v]: https://github.com/rust-lang/rust/pull/29973 +[RFC 1214]: https://github.com/rust-lang/rfcs/blob/master/text/1214-projections-lifetimes-and-wf.md +[`clone_from_slice`]: http://doc.rust-lang.org/nightly/std/primitive.slice.html#method.clone_from_slice +[`sort_by_key`]: http://doc.rust-lang.org/nightly/std/primitive.slice.html#method.sort_by_key +[`CString::into_bytes_with_nul`]: http://doc.rust-lang.org/nightly/std/ffi/struct.CString.html#method.into_bytes_with_nul +[`CString::into_bytes`]: http://doc.rust-lang.org/nightly/std/ffi/struct.CString.html#method.into_bytes +[`CString::into_string`]: http://doc.rust-lang.org/nightly/std/ffi/struct.CString.html#method.into_string +[`IntoStringError::into_cstring`]: http://doc.rust-lang.org/nightly/std/ffi/struct.IntoStringError.html#method.into_cstring +[`IntoStringError::utf8_error`]: http://doc.rust-lang.org/nightly/std/ffi/struct.IntoStringError.html#method.utf8_error +[`Ipv4Addr::is_broadcast`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_broadcast +[`Ipv4Addr::is_documentation`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_documentation +[`Ipv4Addr::is_link_local`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_link_local +[`Ipv4Addr::is_loopback`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_loopback +[`Ipv4Addr::is_multicast`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_multicast +[`Ipv4Addr::is_private`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#method.is_private +[`Ipv6Addr::is_loopback`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_loopback +[`Ipv6Addr::is_multicast`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_multicast +[`Ipv6Addr::is_unspecified`]: http://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#method.is_unspecified +[`Path::strip_prefix`]: http://doc.rust-lang.org/nightly/std/path/struct.Path.html#method.strip_prefix +[`String::as_mut_str`]: http://doc.rust-lang.org/nightly/std/string/struct.String.html#method.as_mut_str +[`String::as_str`]: http://doc.rust-lang.org/nightly/std/string/struct.String.html#method.as_str +[`Vec::as_mut_slice`]: http://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.as_mut_slice +[`Vec::as_slice`]: http://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#method.as_slice +[`ffi::IntoStringError`]: http://doc.rust-lang.org/nightly/std/ffi/struct.IntoStringError.html +[`i32::checked_neg`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.checked_neg +[`i32::checked_rem`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.checked_rem +[`i32::checked_shl`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.checked_shl +[`i32::checked_shr`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.checked_shr +[`i32::overflowing_add`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.overflowing_add +[`i32::overflowing_div`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.overflowing_div +[`i32::overflowing_mul`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.overflowing_mul +[`i32::overflowing_neg`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.overflowing_neg +[`i32::overflowing_rem`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.overflowing_rem +[`i32::overflowing_shl`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.overflowing_shl +[`i32::overflowing_shr`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.overflowing_shr +[`i32::overflowing_sub`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.overflowing_sub +[`i32::saturating_mul`]: http://doc.rust-lang.org/nightly/std/primitive.i32.html#method.saturating_mul +[`path::StripPrefixError`]: http://doc.rust-lang.org/nightly/std/path/struct.StripPrefixError.html +[`u32::checked_rem`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.checked_rem +[`u32::checked_shl`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.checked_shl +[`u32::overflowing_add`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.overflowing_add +[`u32::overflowing_div`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.overflowing_div +[`u32::overflowing_mul`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.overflowing_mul +[`u32::overflowing_neg`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.overflowing_neg +[`u32::overflowing_rem`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.overflowing_rem +[`u32::overflowing_shl`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.overflowing_shl +[`u32::overflowing_shr`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.overflowing_shr +[`u32::overflowing_sub`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.overflowing_sub +[`u32::saturating_mul`]: http://doc.rust-lang.org/nightly/std/primitive.u32.html#method.saturating_mul + + Version 1.6.0 (2016-01-21) ========================== @@ -16,8 +213,9 @@ Libraries --------- * Stabilized APIs: - [`Read::read_exact`], [`ErrorKind::UnexpectedEof`] (renamed from - `UnexpectedEOF`), [`fs::DirBuilder`], [`fs::DirBuilder::new`], + [`Read::read_exact`], + [`ErrorKind::UnexpectedEof`][] (renamed from `UnexpectedEOF`), + [`fs::DirBuilder`], [`fs::DirBuilder::new`], [`fs::DirBuilder::recursive`], [`fs::DirBuilder::create`], [`os::unix::fs::DirBuilderExt`], [`os::unix::fs::DirBuilderExt::mode`], [`vec::Drain`], @@ -29,10 +227,11 @@ Libraries [`collections::hash_set::HashSet::drain`], [`collections::binary_heap::Drain`], [`collections::binary_heap::BinaryHeap::drain`], - [`Vec::extend_from_slice`] (renamed from `push_all`), + [`Vec::extend_from_slice`][] (renamed from `push_all`), [`Mutex::get_mut`], [`Mutex::into_inner`], [`RwLock::get_mut`], - [`RwLock::into_inner`], [`Iterator::min_by_key`] (renamed from - `min_by`), [`Iterator::max_by_key`] (renamed from `max_by`). + [`RwLock::into_inner`], + [`Iterator::min_by_key`][] (renamed from `min_by`), + [`Iterator::max_by_key`][] (renamed from `max_by`). * The [core library][1.6co] is stable, as are most of its APIs. * [The `assert_eq!` macro supports arguments that don't implement `Sized`][1.6ae], such as arrays. In this way it behaves more like From 24c928b99ac645c99d5c86d38bf75ac8dcb0e3a1 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 29 Jan 2016 17:45:03 -0500 Subject: [PATCH 08/10] Fix number of methods in guessing game This code was refactored, but the words were not Fixes #31284 --- src/doc/book/guessing-game.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/book/guessing-game.md b/src/doc/book/guessing-game.md index 80aca56bd1e9f..861ef6810f54a 100644 --- a/src/doc/book/guessing-game.md +++ b/src/doc/book/guessing-game.md @@ -279,7 +279,7 @@ displaying the message. [expect]: ../std/option/enum.Option.html#method.expect [panic]: error-handling.html -If we leave off calling these two methods, our program will compile, but +If we leave off calling this method, our program will compile, but we’ll get a warning: ```bash @@ -680,7 +680,7 @@ fn main() { } ``` -The new three lines: +The new two lines: ```rust,ignore let guess: u32 = guess.trim().parse() From a2c328661b3be61ead155d887efd001c13c794ad Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 29 Jan 2016 17:48:22 -0500 Subject: [PATCH 09/10] Make note that this is different in std These are free functions in the text, but methods in the standard library. Fixes #31266 --- src/doc/book/error-handling.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/doc/book/error-handling.md b/src/doc/book/error-handling.md index 40891dbe191e9..78527c21d1067 100644 --- a/src/doc/book/error-handling.md +++ b/src/doc/book/error-handling.md @@ -265,6 +265,8 @@ fn map(option: Option, f: F) -> Option where F: FnOnce(T) -> A { ``` Indeed, `map` is [defined as a method][2] on `Option` in the standard library. +As a method, it has a slighly different signature: methods take `self`, `&self`, +or `&mut self` as their first argument. Armed with our new combinator, we can rewrite our `extension_explicit` method to get rid of the case analysis: @@ -294,6 +296,9 @@ fn unwrap_or(option: Option, default: T) -> T { } ``` +Like with `map` above, the standard library implementation is a method instead +of a free function. + The trick here is that the default value must have the same type as the value that might be inside the `Option`. Using it is dead simple in our case: From 919ea4735660dfbbfabe6fbda854714a71d87553 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 29 Jan 2016 17:53:35 -0500 Subject: [PATCH 10/10] Add main() so that examples work Rustdoc will automatically wrap things in main, but this doesn't work here. Fixes #31249 --- src/doc/book/testing.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/doc/book/testing.md b/src/doc/book/testing.md index 005184e90a7e9..d57664bf07e4d 100644 --- a/src/doc/book/testing.md +++ b/src/doc/book/testing.md @@ -24,6 +24,7 @@ Cargo will automatically generate a simple test when you make a new project. Here's the contents of `src/lib.rs`: ```rust +# fn main() {} #[test] fn it_works() { } @@ -75,6 +76,7 @@ So why does our do-nothing test pass? Any test which doesn't `panic!` passes, and any test that does `panic!` fails. Let's make our test fail: ```rust +# fn main() {} #[test] fn it_works() { assert!(false); @@ -145,6 +147,7 @@ This is useful if you want to integrate `cargo test` into other tooling. We can invert our test's failure with another attribute: `should_panic`: ```rust +# fn main() {} #[test] #[should_panic] fn it_works() { @@ -175,6 +178,7 @@ Rust provides another macro, `assert_eq!`, that compares two arguments for equality: ```rust +# fn main() {} #[test] #[should_panic] fn it_works() { @@ -209,6 +213,7 @@ make sure that the failure message contains the provided text. A safer version of the example above would be: ```rust +# fn main() {} #[test] #[should_panic(expected = "assertion failed")] fn it_works() { @@ -219,6 +224,7 @@ fn it_works() { That's all there is to the basics! Let's write one 'real' test: ```rust,ignore +# fn main() {} pub fn add_two(a: i32) -> i32 { a + 2 } @@ -238,6 +244,7 @@ Sometimes a few specific tests can be very time-consuming to execute. These can be disabled by default by using the `ignore` attribute: ```rust +# fn main() {} #[test] fn it_works() { assert_eq!(4, add_two(2)); @@ -299,6 +306,7 @@ missing the `tests` module. The idiomatic way of writing our example looks like this: ```rust,ignore +# fn main() {} pub fn add_two(a: i32) -> i32 { a + 2 } @@ -327,6 +335,7 @@ a large module, and so this is a common use of globs. Let's change our `src/lib.rs` to make use of it: ```rust,ignore +# fn main() {} pub fn add_two(a: i32) -> i32 { a + 2 } @@ -377,6 +386,7 @@ put a `tests/lib.rs` file inside, with this as its contents: ```rust,ignore extern crate adder; +# fn main() {} #[test] fn it_works() { assert_eq!(4, adder::add_two(2)); @@ -432,6 +442,7 @@ running examples in your documentation (**note:** this only works in library crates, not binary crates). Here's a fleshed-out `src/lib.rs` with examples: ```rust,ignore +# fn main() {} //! The `adder` crate provides functions that add numbers to other numbers. //! //! # Examples