From 794e5724a871e2414c0b39b9d99bc5a084d31dfd Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Tue, 23 May 2017 03:08:18 -0700 Subject: [PATCH 01/12] Give step_trait a distinct tracking issue from step_by iterator_step_by has decoupled their futures, so the tracking issue should split. --- src/doc/unstable-book/src/library-features/step-trait.md | 4 ++-- src/libcore/iter/mod.rs | 2 +- src/libcore/iter/range.rs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/doc/unstable-book/src/library-features/step-trait.md b/src/doc/unstable-book/src/library-features/step-trait.md index e53ca13f7b6..56050c20c69 100644 --- a/src/doc/unstable-book/src/library-features/step-trait.md +++ b/src/doc/unstable-book/src/library-features/step-trait.md @@ -1,7 +1,7 @@ # `step_trait` -The tracking issue for this feature is: [#27741] +The tracking issue for this feature is: [#42168] -[#27741]: https://github.com/rust-lang/rust/issues/27741 +[#42168]: https://github.com/rust-lang/rust/issues/42168 ------------------------ diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index 420ff0f7119..785c26efdc8 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -309,7 +309,7 @@ pub use self::iterator::Iterator; #[unstable(feature = "step_trait", reason = "likely to be replaced by finer-grained traits", - issue = "27741")] + issue = "42168")] pub use self::range::Step; #[unstable(feature = "step_by", reason = "recent addition", issue = "27741")] diff --git a/src/libcore/iter/range.rs b/src/libcore/iter/range.rs index bd831d638c0..8d370f9675f 100644 --- a/src/libcore/iter/range.rs +++ b/src/libcore/iter/range.rs @@ -20,7 +20,7 @@ use super::{FusedIterator, TrustedLen}; /// two `Step` objects. #[unstable(feature = "step_trait", reason = "likely to be replaced by finer-grained traits", - issue = "27741")] + issue = "42168")] pub trait Step: PartialOrd + Sized { /// Steps `self` if possible. fn step(&self, by: &Self) -> Option; @@ -55,7 +55,7 @@ macro_rules! step_impl_unsigned { ($($t:ty)*) => ($( #[unstable(feature = "step_trait", reason = "likely to be replaced by finer-grained traits", - issue = "27741")] + issue = "42168")] impl Step for $t { #[inline] fn step(&self, by: &$t) -> Option<$t> { @@ -115,7 +115,7 @@ macro_rules! step_impl_signed { ($($t:ty)*) => ($( #[unstable(feature = "step_trait", reason = "likely to be replaced by finer-grained traits", - issue = "27741")] + issue = "42168")] impl Step for $t { #[inline] fn step(&self, by: &$t) -> Option<$t> { @@ -187,7 +187,7 @@ macro_rules! step_impl_no_between { ($($t:ty)*) => ($( #[unstable(feature = "step_trait", reason = "likely to be replaced by finer-grained traits", - issue = "27741")] + issue = "42168")] impl Step for $t { #[inline] fn step(&self, by: &$t) -> Option<$t> { From 94b074f581d9b6ba4ca8a40a1a52a17a8e532a3f Mon Sep 17 00:00:00 2001 From: Dan Callahan Date: Wed, 24 May 2017 21:43:46 -0500 Subject: [PATCH 02/12] Remove superfluous `;;` sequences --- src/libcollections/str.rs | 2 +- src/librustc_passes/consts.rs | 2 +- src/librustc_trans/mir/block.rs | 2 +- src/test/run-pass/issue-16671.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 7e67befb700..3ea2050619b 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1018,7 +1018,7 @@ impl str { /// /// ``` /// let x = "(///)".to_string(); - /// let d: Vec<_> = x.split('/').collect();; + /// let d: Vec<_> = x.split('/').collect(); /// /// assert_eq!(d, &["(", "", "", ")"]); /// ``` diff --git a/src/librustc_passes/consts.rs b/src/librustc_passes/consts.rs index 25845c5768e..698850f0e9e 100644 --- a/src/librustc_passes/consts.rs +++ b/src/librustc_passes/consts.rs @@ -141,7 +141,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckCrateVisitor<'a, 'tcx> { let outer_penv = self.tcx.infer_ctxt(body_id, Reveal::UserFacing).enter(|infcx| { let param_env = infcx.param_env.clone(); let outer_penv = mem::replace(&mut self.param_env, param_env); - let region_maps = &self.tcx.region_maps(item_def_id);; + let region_maps = &self.tcx.region_maps(item_def_id); euv::ExprUseVisitor::new(self, region_maps, &infcx).consume_body(body); outer_penv }); diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs index d94d7f4430b..a3fa1279ffb 100644 --- a/src/librustc_trans/mir/block.rs +++ b/src/librustc_trans/mir/block.rs @@ -901,7 +901,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { let llty = type_of::type_of(bcx.ccx, val.ty); let cast_ptr = bcx.pointercast(dst.llval, llty.ptr_to()); let in_type = val.ty; - let out_type = dst.ty.to_ty(bcx.tcx());; + let out_type = dst.ty.to_ty(bcx.tcx()); let llalign = cmp::min(bcx.ccx.align_of(in_type), bcx.ccx.align_of(out_type)); self.store_operand(bcx, cast_ptr, Some(llalign), val); } diff --git a/src/test/run-pass/issue-16671.rs b/src/test/run-pass/issue-16671.rs index 71a19d98190..49dc970ba3f 100644 --- a/src/test/run-pass/issue-16671.rs +++ b/src/test/run-pass/issue-16671.rs @@ -13,7 +13,7 @@ fn foo(_f: F) { } fn main() { - let mut var = Vec::new();; + let mut var = Vec::new(); foo(move|| { var.push(1); }); From 8019430b53c4b1d20b23900af64f2b8bb8fdda2d Mon Sep 17 00:00:00 2001 From: Charlie Somerville Date: Thu, 25 May 2017 13:36:59 +1000 Subject: [PATCH 03/12] Fix 'associate type' typo --- src/librustc_typeck/astconv.rs | 2 +- src/test/compile-fail/E0229.rs | 2 +- src/test/compile-fail/issue-23543.rs | 2 +- src/test/compile-fail/issue-23544.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 9e8352fde80..0aae19932de 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -962,7 +962,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { pub fn prohibit_projection(&self, span: Span) { let mut err = struct_span_err!(self.tcx().sess, span, E0229, "associated type bindings are not allowed here"); - err.span_label(span, "associate type not allowed here").emit(); + err.span_label(span, "associated type not allowed here").emit(); } // Check a type Path and convert it to a Ty. diff --git a/src/test/compile-fail/E0229.rs b/src/test/compile-fail/E0229.rs index 6ff0baeeb4d..d15f9937f13 100644 --- a/src/test/compile-fail/E0229.rs +++ b/src/test/compile-fail/E0229.rs @@ -22,7 +22,7 @@ impl Foo for isize { fn baz(x: &>::A) {} //~^ ERROR associated type bindings are not allowed here [E0229] -//~| NOTE associate type not allowed here +//~| NOTE associated type not allowed here fn main() { } diff --git a/src/test/compile-fail/issue-23543.rs b/src/test/compile-fail/issue-23543.rs index f1c559b6b88..e1acc8eb475 100644 --- a/src/test/compile-fail/issue-23543.rs +++ b/src/test/compile-fail/issue-23543.rs @@ -16,7 +16,7 @@ pub trait D { fn f(self) where T: A; //~^ ERROR associated type bindings are not allowed here [E0229] - //~| NOTE associate type not allowed here + //~| NOTE associated type not allowed here } fn main() {} diff --git a/src/test/compile-fail/issue-23544.rs b/src/test/compile-fail/issue-23544.rs index 3959c22d1d4..3cd6f9ebc71 100644 --- a/src/test/compile-fail/issue-23544.rs +++ b/src/test/compile-fail/issue-23544.rs @@ -14,7 +14,7 @@ pub trait D { fn f(self) where T: A; //~^ ERROR associated type bindings are not allowed here [E0229] - //~| NOTE associate type not allowed here + //~| NOTE associated type not allowed here } fn main() {} From 435e1cec9e63ee9651a0c082b050b5c49da96c10 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 25 May 2017 18:48:21 +0000 Subject: [PATCH 04/12] Remove stray lockfile --- src/librustc_llvm/Cargo.lock | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 src/librustc_llvm/Cargo.lock diff --git a/src/librustc_llvm/Cargo.lock b/src/librustc_llvm/Cargo.lock deleted file mode 100644 index 17678ef2bbd..00000000000 --- a/src/librustc_llvm/Cargo.lock +++ /dev/null @@ -1,22 +0,0 @@ -[root] -name = "rustc_llvm" -version = "0.0.0" -dependencies = [ - "build_helper 0.1.0", - "gcc 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_bitflags 0.0.0", -] - -[[package]] -name = "build_helper" -version = "0.1.0" - -[[package]] -name = "gcc" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_bitflags" -version = "0.0.0" - From 0530339dc34a68a5aa0c4038c661a82fd8d2a8e7 Mon Sep 17 00:00:00 2001 From: Venkata Giri Reddy Date: Thu, 25 May 2017 16:09:21 -0400 Subject: [PATCH 05/12] regression test for #36379 --- src/test/compile-fail/issue-36379.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/test/compile-fail/issue-36379.rs diff --git a/src/test/compile-fail/issue-36379.rs b/src/test/compile-fail/issue-36379.rs new file mode 100644 index 00000000000..2f513b034c3 --- /dev/null +++ b/src/test/compile-fail/issue-36379.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(conservative_impl_trait, rustc_attrs)] + +fn _test() -> impl Default { } + +#[rustc_error] +fn main() { } //~ ERROR compilation successful From 6b151ef84169e34f0fd10bdd65eb192c32e7b432 Mon Sep 17 00:00:00 2001 From: Venkata Giri Reddy Date: Thu, 25 May 2017 16:55:25 -0400 Subject: [PATCH 06/12] regression test for #38954 --- src/test/compile-fail/issue-38954.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/test/compile-fail/issue-38954.rs diff --git a/src/test/compile-fail/issue-38954.rs b/src/test/compile-fail/issue-38954.rs new file mode 100644 index 00000000000..65b17a3db0b --- /dev/null +++ b/src/test/compile-fail/issue-38954.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(rustc_attrs)] + +fn _test(ref _p: str) {} + +#[rustc_error] +fn main() { } //~ ERROR compilation successful From 04ac7c33452bfb64c174577e24faefc63641f37d Mon Sep 17 00:00:00 2001 From: Venkata Giri Reddy Date: Thu, 25 May 2017 17:36:59 -0400 Subject: [PATCH 07/12] regression test for #39362 --- src/test/compile-fail/issue-39362.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/test/compile-fail/issue-39362.rs diff --git a/src/test/compile-fail/issue-39362.rs b/src/test/compile-fail/issue-39362.rs new file mode 100644 index 00000000000..9d8abbfc65d --- /dev/null +++ b/src/test/compile-fail/issue-39362.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum Foo { + Bar { bar: Bar, id: usize } +} + +enum Bar { + A, B, C, D, E, F +} + +fn test(f: Foo) { + match f { + //~^ ERROR non-exhaustive patterns + //~| patterns + Foo::Bar { bar: Bar::A, .. } => (), + Foo::Bar { bar: Bar::B, .. } => (), + } +} + +fn main() {} From 9ee9abcdbd94a54fe53f48065b1b05d96168665e Mon Sep 17 00:00:00 2001 From: Venkata Giri Reddy Date: Thu, 25 May 2017 17:43:25 -0400 Subject: [PATCH 08/12] regression test for #38160 --- src/test/compile-fail/issue-38160.rs | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/test/compile-fail/issue-38160.rs diff --git a/src/test/compile-fail/issue-38160.rs b/src/test/compile-fail/issue-38160.rs new file mode 100644 index 00000000000..311d0ceb4d3 --- /dev/null +++ b/src/test/compile-fail/issue-38160.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(associated_consts, rustc_attrs)] +#![allow(warnings)] + +trait MyTrait { + const MY_CONST: &'static str; +} + +macro_rules! my_macro { + () => { + struct MyStruct; + + impl MyTrait for MyStruct { + const MY_CONST: &'static str = stringify!(abc); + } + } +} + +my_macro!(); + +#[rustc_error] +fn main() {} //~ ERROR compilation successful From 95436c6d897881262a018dd48ed862eb63a20dc1 Mon Sep 17 00:00:00 2001 From: Venkata Giri Reddy Date: Thu, 25 May 2017 17:57:16 -0400 Subject: [PATCH 09/12] regression test for #37665 regression test for #37550 --- src/test/compile-fail/issue-37665.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/compile-fail/issue-37665.rs diff --git a/src/test/compile-fail/issue-37665.rs b/src/test/compile-fail/issue-37665.rs new file mode 100644 index 00000000000..f86f570d25d --- /dev/null +++ b/src/test/compile-fail/issue-37665.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z unstable-options --unpretty=mir + +use std::path::MAIN_SEPARATOR; + +fn main() { + let mut foo : String = "hello".to_string(); + foo.push(MAIN_SEPARATOR); + println!("{}", foo); + let x: () = 0; //~ ERROR: mismatched types +} From 2160b4ae589eeedbc8411f5bf2b02774194ce8e3 Mon Sep 17 00:00:00 2001 From: Venkata Giri Reddy Date: Thu, 25 May 2017 18:06:30 -0400 Subject: [PATCH 10/12] regression test for #37550 --- src/test/compile-fail/issue-37550.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/test/compile-fail/issue-37550.rs diff --git a/src/test/compile-fail/issue-37550.rs b/src/test/compile-fail/issue-37550.rs new file mode 100644 index 00000000000..e1f7f64e01a --- /dev/null +++ b/src/test/compile-fail/issue-37550.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(const_fn)] + +const fn x() { + let t = true; //~ ERROR blocks in constant functions are limited to items and tail expressions + let x = || t; //~ ERROR blocks in constant functions are limited to items and tail expressions +} + +fn main() {} From bbf1dc4fad3389073cdb27fd1c291df469628735 Mon Sep 17 00:00:00 2001 From: Michael Kohl Date: Fri, 26 May 2017 09:47:29 +0700 Subject: [PATCH 11/12] Update documentation for indexing/slicing methods See #39911 --- src/libcollections/slice.rs | 14 ++++++++++++-- src/libcollections/str.rs | 11 +++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 5696f5fe6a7..233ff8a5154 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -393,7 +393,12 @@ impl [T] { } /// Returns a reference to an element or subslice, without doing bounds - /// checking. So use it very carefully! + /// checking. + /// + /// This is generally not recommended, use with caution! For a safe + /// alternative see [`get`]. + /// + /// [`get`]: #method.get /// /// # Examples /// @@ -413,7 +418,12 @@ impl [T] { } /// Returns a mutable reference to an element or subslice, without doing - /// bounds checking. So use it very carefully! + /// bounds checking. + /// + /// This is generally not recommended, use with caution! For a safe + /// alternative see [`get_mut`]. + /// + /// [`get_mut`]: #method.get_mut /// /// # Examples /// diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 7e67befb700..1a3e665a044 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -435,6 +435,12 @@ impl str { /// Creates a string slice from another string slice, bypassing safety /// checks. /// + /// This is generally not recommended, use with caution! For a safe + /// alternative see [`str`] and [`Index`]. + /// + /// [`str`]: primitive.str.html + /// [`Index`]: ops/trait.Index.html + /// /// This new slice goes from `begin` to `end`, including `begin` but /// excluding `end`. /// @@ -477,6 +483,11 @@ impl str { /// Creates a string slice from another string slice, bypassing safety /// checks. + /// This is generally not recommended, use with caution! For a safe + /// alternative see [`str`] and [`IndexMut`]. + /// + /// [`str`]: primitive.str.html + /// [`IndexMut`]: ops/trait.IndexMut.html /// /// This new slice goes from `begin` to `end`, including `begin` but /// excluding `end`. From e66388d21f4de5bb48529bf529f54315a0800fb1 Mon Sep 17 00:00:00 2001 From: king6cong Date: Fri, 26 May 2017 19:21:29 +0800 Subject: [PATCH 12/12] doc rewording --- src/libstd/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 528d903b8b0..69843199348 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1545,7 +1545,7 @@ pub fn create_dir>(path: P) -> io::Result<()> { /// determined to not exist) are outlined by `fs::create_dir`. /// /// Notable exception is made for situations where any of the directories -/// specified in the `path` could not be created as it was created concurrently. +/// specified in the `path` could not be created as it was being created concurrently. /// Such cases are considered success. In other words: calling `create_dir_all` /// concurrently from multiple threads or processes is guaranteed to not fail /// due to race itself.