Skip to content

Rollup of 6 pull requests #39712

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

Merged
merged 14 commits into from
Feb 10, 2017
Merged
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
2 changes: 2 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
@@ -150,6 +150,7 @@ struct Build {
python: Option<String>,
full_bootstrap: Option<bool>,
extended: Option<bool>,
verbose: Option<usize>,
sanitizers: Option<bool>,
}

@@ -296,6 +297,7 @@ impl Config {
set(&mut config.vendor, build.vendor);
set(&mut config.full_bootstrap, build.full_bootstrap);
set(&mut config.extended, build.extended);
set(&mut config.verbose, build.verbose);
set(&mut config.sanitizers, build.sanitizers);

if let Some(ref install) = toml.install {
3 changes: 3 additions & 0 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
@@ -124,6 +124,9 @@
# disabled by default.
#extended = false

# Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose
#verbose = 0

# Build the sanitizer runtimes
#sanitizers = false

18 changes: 9 additions & 9 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
@@ -434,7 +434,7 @@ impl<'a> Display for Arguments<'a> {
pub trait Debug {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for an empty format, `{}`.
@@ -477,7 +477,7 @@ pub trait Debug {
pub trait Display {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `o` character.
@@ -524,7 +524,7 @@ pub trait Display {
pub trait Octal {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `b` character.
@@ -571,7 +571,7 @@ pub trait Octal {
pub trait Binary {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `x` character.
@@ -619,7 +619,7 @@ pub trait Binary {
pub trait LowerHex {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `X` character.
@@ -667,7 +667,7 @@ pub trait LowerHex {
pub trait UpperHex {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `p` character.
@@ -712,7 +712,7 @@ pub trait UpperHex {
pub trait Pointer {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `e` character.
@@ -755,7 +755,7 @@ pub trait Pointer {
pub trait LowerExp {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// Format trait for the `E` character.
@@ -798,7 +798,7 @@ pub trait LowerExp {
pub trait UpperExp {
/// Formats the value using the given formatter.
#[stable(feature = "rust1", since = "1.0.0")]
fn fmt(&self, &mut Formatter) -> Result;
fn fmt(&self, f: &mut Formatter) -> Result;
}

/// The `write` function takes an output stream, a precompiled format string,
20 changes: 10 additions & 10 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
@@ -1324,7 +1324,7 @@ shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
pub trait AddAssign<Rhs=Self> {
/// The method for the `+=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn add_assign(&mut self, Rhs);
fn add_assign(&mut self, rhs: Rhs);
}

macro_rules! add_assign_impl {
@@ -1380,7 +1380,7 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
pub trait SubAssign<Rhs=Self> {
/// The method for the `-=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn sub_assign(&mut self, Rhs);
fn sub_assign(&mut self, rhs: Rhs);
}

macro_rules! sub_assign_impl {
@@ -1425,7 +1425,7 @@ sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
pub trait MulAssign<Rhs=Self> {
/// The method for the `*=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn mul_assign(&mut self, Rhs);
fn mul_assign(&mut self, rhs: Rhs);
}

macro_rules! mul_assign_impl {
@@ -1470,7 +1470,7 @@ mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
pub trait DivAssign<Rhs=Self> {
/// The method for the `/=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn div_assign(&mut self, Rhs);
fn div_assign(&mut self, rhs: Rhs);
}

macro_rules! div_assign_impl {
@@ -1514,7 +1514,7 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
pub trait RemAssign<Rhs=Self> {
/// The method for the `%=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn rem_assign(&mut self, Rhs);
fn rem_assign(&mut self, rhs: Rhs);
}

macro_rules! rem_assign_impl {
@@ -1600,7 +1600,7 @@ rem_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
pub trait BitAndAssign<Rhs=Self> {
/// The method for the `&=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn bitand_assign(&mut self, Rhs);
fn bitand_assign(&mut self, rhs: Rhs);
}

macro_rules! bitand_assign_impl {
@@ -1644,7 +1644,7 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
pub trait BitOrAssign<Rhs=Self> {
/// The method for the `|=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn bitor_assign(&mut self, Rhs);
fn bitor_assign(&mut self, rhs: Rhs);
}

macro_rules! bitor_assign_impl {
@@ -1688,7 +1688,7 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
pub trait BitXorAssign<Rhs=Self> {
/// The method for the `^=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn bitxor_assign(&mut self, Rhs);
fn bitxor_assign(&mut self, rhs: Rhs);
}

macro_rules! bitxor_assign_impl {
@@ -1732,7 +1732,7 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
pub trait ShlAssign<Rhs> {
/// The method for the `<<=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn shl_assign(&mut self, Rhs);
fn shl_assign(&mut self, rhs: Rhs);
}

macro_rules! shl_assign_impl {
@@ -1797,7 +1797,7 @@ shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }
pub trait ShrAssign<Rhs=Self> {
/// The method for the `>>=` operator
#[stable(feature = "op_assign_traits", since = "1.8.0")]
fn shr_assign(&mut self, Rhs);
fn shr_assign(&mut self, rhs: Rhs);
}

macro_rules! shr_assign_impl {
6 changes: 3 additions & 3 deletions src/libcore/str/pattern.rs
Original file line number Diff line number Diff line change
@@ -240,7 +240,7 @@ pub trait DoubleEndedSearcher<'a>: ReverseSearcher<'a> {}

#[doc(hidden)]
trait CharEq {
fn matches(&mut self, char) -> bool;
fn matches(&mut self, c: char) -> bool;
fn only_ascii(&self) -> bool;
}

@@ -1178,8 +1178,8 @@ impl TwoWaySearcher {
trait TwoWayStrategy {
type Output;
fn use_early_reject() -> bool;
fn rejecting(usize, usize) -> Self::Output;
fn matching(usize, usize) -> Self::Output;
fn rejecting(a: usize, b: usize) -> Self::Output;
fn matching(a: usize, b: usize) -> Self::Output;
}

/// Skip to match intervals as quickly as possible
1 change: 1 addition & 0 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
@@ -1000,6 +1000,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
}

/// Run the translation phase to LLVM, after which the AST and analysis can
/// be discarded.
pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
analysis: ty::CrateAnalysis,
incremental_hashes_map: &IncrementalHashesMap)
23 changes: 10 additions & 13 deletions src/librustc_typeck/check/op.rs
Original file line number Diff line number Diff line change
@@ -212,11 +212,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
self.lookup_op_method(expr, ty_mut.ty, vec![rhs_ty_var],
Symbol::intern(name), trait_def_id,
lhs_expr).is_ok() {
err.span_note(
lhs_expr.span,
err.note(
&format!(
"this is a reference of type that `{}` can be applied to, \
you need to dereference this variable once for this \
"this is a reference to a type that `{}` can be applied \
to; you need to dereference this variable once for this \
operation to work",
op.node.as_str()));
}
@@ -244,11 +243,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
rhs_expr, rhs_ty_var, &mut err) {
// This has nothing here because it means we did string
// concatenation (e.g. "Hello " + "World!"). This means
// we don't want the span in the else clause to be emmitted
// we don't want the note in the else clause to be emitted
} else {
span_note!(&mut err, lhs_expr.span,
"an implementation of `{}` might be missing for `{}`",
missing_trait, lhs_ty);
err.note(
&format!("an implementation of `{}` might be missing for `{}`",
missing_trait, lhs_ty));
}
}
err.emit();
@@ -271,16 +270,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
rhs_expr: &'gcx hir::Expr,
rhs_ty_var: Ty<'tcx>,
mut err: &mut errors::DiagnosticBuilder) -> bool {
// If this function returns false it means we use it to make sure we print
// out the an "implementation of span_note!" above where this function is
// called and if true we don't.
// If this function returns true it means a note was printed, so we don't need
// to print the normal "implementation of `std::ops::Add` might be missing" note
let mut is_string_addition = false;
let rhs_ty = self.check_expr_coercable_to_type(rhs_expr, rhs_ty_var);
if let TyRef(_, l_ty) = lhs_ty.sty {
if let TyRef(_, r_ty) = rhs_ty.sty {
if l_ty.ty.sty == TyStr && r_ty.ty.sty == TyStr {
span_note!(&mut err, lhs_expr.span,
"`+` can't be used to concatenate two `&str` strings");
err.note("`+` can't be used to concatenate two `&str` strings");
let codemap = self.tcx.sess.codemap();
let suggestion =
match (codemap.span_to_snippet(lhs_expr.span),
13 changes: 10 additions & 3 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
@@ -802,6 +802,10 @@ impl<'a> Parser<'a> {
let mut first: bool = true;
let mut v = vec![];
while !kets.contains(&&self.token) {
match self.token {
token::CloseDelim(..) | token::Eof => break,
_ => {}
};
match sep.sep {
Some(ref t) => {
if first {
@@ -2608,9 +2612,12 @@ impl<'a> Parser<'a> {
return Ok((None, kleene_op));
}

let separator = self.bump_and_get();
let separator = match self.token {
token::CloseDelim(..) => None,
_ => Some(self.bump_and_get()),
};
match parse_kleene_op(self)? {
Some(zerok) => Ok((Some(separator), zerok)),
Some(zerok) => Ok((separator, zerok)),
None => return Err(self.fatal("expected `*` or `+`"))
}
}
@@ -2647,7 +2654,7 @@ impl<'a> Parser<'a> {
tts: tts,
})))
},
token::CloseDelim(_) | token::Eof => unreachable!(),
token::CloseDelim(..) | token::Eof => Ok(TokenTree::Token(self.span, token::Eof)),
token::Dollar | token::SubstNt(..) if self.quote_depth > 0 => self.parse_unquoted(),
_ => Ok(TokenTree::Token(self.span, self.bump_and_get())),
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/binary-op-on-double-ref.rs
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ fn main() {
let vr = v.iter().filter(|x| {
x % 2 == 0
//~^ ERROR binary operation `%` cannot be applied to type `&&{integer}`
//~| NOTE this is a reference of type that `%` can be applied to
//~| NOTE this is a reference to a type that `%` can be applied to
//~| NOTE an implementation of `std::ops::Rem` might be missing for `&&{integer}`
});
println!("{:?}", vr);
17 changes: 17 additions & 0 deletions src/test/compile-fail/feature-gate-const-indexing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2015 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.


fn main() {
const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47];
const IDX: usize = 3;
const VAL: i32 = ARR[IDX];
const BLUB: [i32; (ARR[0] - 41) as usize] = [5]; //~ ERROR constant evaluation error
}
17 changes: 17 additions & 0 deletions src/test/compile-fail/issue-39388.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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.

macro_rules! assign {
(($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+`
$($a)* = $($b)*
}
}

fn main() {}
15 changes: 15 additions & 0 deletions src/test/compile-fail/issue-39616.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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.

fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0`
//~| ERROR expected one of `->`, `where`, or `{`, found `]`
// FIXME(jseyfried): avoid emitting the second error (preexisting)

fn main() {}
28 changes: 0 additions & 28 deletions src/test/parse-fail/issue-39018.stderr

This file was deleted.

12 changes: 2 additions & 10 deletions src/test/ui/span/issue-39018.stderr
Original file line number Diff line number Diff line change
@@ -4,11 +4,7 @@ error[E0369]: binary operation `+` cannot be applied to type `&'static str`
12 | let x = "Hello " + "World!";
| ^^^^^^^^
|
note: `+` can't be used to concatenate two `&str` strings
--> $DIR/issue-39018.rs:12:13
|
12 | let x = "Hello " + "World!";
| ^^^^^^^^
= note: `+` can't be used to concatenate two `&str` strings
help: to_owned() can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left.
| let x = "Hello ".to_owned() + "World!";

@@ -18,11 +14,7 @@ error[E0369]: binary operation `+` cannot be applied to type `World`
17 | let y = World::Hello + World::Goodbye;
| ^^^^^^^^^^^^
|
note: an implementation of `std::ops::Add` might be missing for `World`
--> $DIR/issue-39018.rs:17:13
|
17 | let y = World::Hello + World::Goodbye;
| ^^^^^^^^^^^^
= note: an implementation of `std::ops::Add` might be missing for `World`

error: aborting due to 2 previous errors

2 changes: 1 addition & 1 deletion src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
@@ -167,7 +167,7 @@ pub fn check(path: &Path, bad: &mut bool) {
// FIXME get this whitelist empty.
let whitelist = vec![
"abi_ptx", "simd", "static_recursion",
"cfg_target_has_atomic", "staged_api", "const_indexing",
"cfg_target_has_atomic", "staged_api",
"unboxed_closures", "stmt_expr_attributes",
"cfg_target_thread_local", "unwind_attributes",
"inclusive_range_syntax"