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

Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 9 additions & 9 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, `{}`.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
20 changes: 10 additions & 10 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/str/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 10 additions & 13 deletions src/librustc_typeck/check/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}
Expand Down Expand Up @@ -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();
Expand All @@ -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),
Expand Down
13 changes: 10 additions & 3 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 `+`"))
}
}
Expand Down Expand Up @@ -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())),
}
Expand Down
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
Expand Up @@ -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);
Expand Down
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() {}
Loading