Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #42245

Merged
merged 19 commits into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/doc/unstable-book/src/library-features/step-trait.md
Original file line number Diff line number Diff line change
@@ -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

------------------------
14 changes: 12 additions & 2 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,12 @@ impl<T> [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
///
Expand All @@ -413,7 +418,12 @@ impl<T> [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
///
Expand Down
13 changes: 12 additions & 1 deletion src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
///
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -1018,7 +1029,7 @@ impl str {
///
/// ```
/// let x = "(///)".to_string();
/// let d: Vec<_> = x.split('/').collect();;
/// let d: Vec<_> = x.split('/').collect();
///
/// assert_eq!(d, &["(", "", "", ")"]);
/// ```
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self>;
Expand Down Expand Up @@ -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> {
Expand Down Expand Up @@ -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> {
Expand Down Expand Up @@ -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> {
Expand Down
22 changes: 0 additions & 22 deletions src/librustc_llvm/Cargo.lock

This file was deleted.

2 changes: 1 addition & 1 deletion src/librustc_passes/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,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.
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ pub fn create_dir<P: AsRef<Path>>(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.
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/E0229.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Foo for isize {

fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
//~^ ERROR associated type bindings are not allowed here [E0229]
//~| NOTE associate type not allowed here
//~| NOTE associated type not allowed here

fn main() {
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-23543.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub trait D {
fn f<T>(self)
where T<Bogus = Foo>: A;
//~^ ERROR associated type bindings are not allowed here [E0229]
//~| NOTE associate type not allowed here
//~| NOTE associated type not allowed here
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-23544.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub trait D {
fn f<T>(self)
where T<Bogus = Self::AlsoBogus>: A;
//~^ ERROR associated type bindings are not allowed here [E0229]
//~| NOTE associate type not allowed here
//~| NOTE associated type not allowed here
}

fn main() {}
16 changes: 16 additions & 0 deletions src/test/compile-fail/issue-36379.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
18 changes: 18 additions & 0 deletions src/test/compile-fail/issue-37550.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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() {}
20 changes: 20 additions & 0 deletions src/test/compile-fail/issue-37665.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
}
31 changes: 31 additions & 0 deletions src/test/compile-fail/issue-38160.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
16 changes: 16 additions & 0 deletions src/test/compile-fail/issue-38954.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
28 changes: 28 additions & 0 deletions src/test/compile-fail/issue-39362.rs
Original file line number Diff line number Diff line change
@@ -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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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() {}
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-16671.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
fn foo<F: FnOnce()>(_f: F) { }

fn main() {
let mut var = Vec::new();;
let mut var = Vec::new();
foo(move|| {
var.push(1);
});
Expand Down