Skip to content

Commit

Permalink
Auto merge of #45755 - kennytm:rollup, r=kennytm
Browse files Browse the repository at this point in the history
Rollup of 9 pull requests

- Successful merges: #45548, #45610, #45639, #45669, #45681, #45718, #45722, #45739, #45746
- Failed merges:
  • Loading branch information
bors committed Nov 4, 2017
2 parents a454152 + e3b25a5 commit 9acc333
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ impl Step for Clippy {
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/tools/clippy")
let builder = run.builder;
run.path("src/tools/clippy").default_condition(builder.build.config.extended)
}

fn make_run(run: RunConfig) {
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<T, A: Alloc> RawVec<T, A> {
impl<T> RawVec<T, Heap> {
/// Creates the biggest possible RawVec (on the system heap)
/// without allocating. If T has positive size, then this makes a
/// RawVec with capacity 0. If T has 0 size, then it it makes a
/// RawVec with capacity 0. If T has 0 size, then it makes a
/// RawVec with capacity `usize::MAX`. Useful for implementing
/// delayed allocation.
pub fn new() -> Self {
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/ops/deref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/// Implementing `Deref` for smart pointers makes accessing the data behind them
/// convenient, which is why they implement `Deref`. On the other hand, the
/// rules regarding `Deref` and [`DerefMut`] were designed specifically to
/// accomodate smart pointers. Because of this, **`Deref` should only be
/// accommodate smart pointers. Because of this, **`Deref` should only be
/// implemented for smart pointers** to avoid confusion.
///
/// For similar reasons, **this trait should never fail**. Failure during
Expand Down Expand Up @@ -103,7 +103,7 @@ impl<'a, T: ?Sized> Deref for &'a mut T {
/// Implementing `DerefMut` for smart pointers makes mutating the data behind
/// them convenient, which is why they implement `DerefMut`. On the other hand,
/// the rules regarding [`Deref`] and `DerefMut` were designed specifically to
/// accomodate smart pointers. Because of this, **`DerefMut` should only be
/// accommodate smart pointers. Because of this, **`DerefMut` should only be
/// implemented for smart pointers** to avoid confusion.
///
/// For similar reasons, **this trait should never fail**. Failure during
Expand Down
12 changes: 12 additions & 0 deletions src/libcore/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,12 @@ impl<T> AtomicPtr<T> {
}
}

#[stable(feature = "atomic_from", since = "1.23.0")]
impl<T> From<*mut T> for AtomicPtr<T> {
#[inline]
fn from(p: *mut T) -> Self { Self::new(p) }
}

#[cfg(target_has_atomic = "ptr")]
macro_rules! atomic_int {
($stable:meta, $const_unstable:meta,
Expand Down Expand Up @@ -967,6 +973,12 @@ macro_rules! atomic_int {
}
}

#[stable(feature = "atomic_from", since = "1.23.0")]
impl From<$int_type> for $atomic_type {
#[inline]
fn from(v: $int_type) -> Self { Self::new(v) }
}

#[$stable_debug]
impl fmt::Debug for $atomic_type {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down
3 changes: 3 additions & 0 deletions src/libstd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ authors = ["The Rust Project Developers"]
name = "std"
version = "0.0.0"
build = "build.rs"
license = "MIT/Apache-2.0"
repository = "https://github.com/rust-lang/rust.git"
description = "The Rust Standard Library"

[lib]
name = "std"
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sys/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ compat_fn! {
}
}

#[cfg(target_env = "gnu")]
#[cfg(all(target_env = "gnu", feature = "backtrace"))]
mod gnu {
use super::*;

Expand Down Expand Up @@ -1256,5 +1256,5 @@ mod gnu {
}
}

#[cfg(target_env = "gnu")]
#[cfg(all(target_env = "gnu", feature = "backtrace"))]
pub use self::gnu::*;
8 changes: 7 additions & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3154,7 +3154,13 @@ impl<'a> Parser<'a> {
// Parse: `for <src_pat> in <src_expr> <src_loop_block>`

let pat = self.parse_pat()?;
self.expect_keyword(keywords::In)?;
if !self.eat_keyword(keywords::In) {
let in_span = self.prev_span.between(self.span);
let mut err = self.sess.span_diagnostic
.struct_span_err(in_span, "missing `in` in `for` loop");
err.span_suggestion_short(in_span, "try adding `in` here", " in ".into());
err.emit();
}
let expr = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?;
let (iattrs, loop_block) = self.parse_inner_attrs_and_block()?;
attrs.extend(iattrs);
Expand Down
30 changes: 30 additions & 0 deletions src/test/rustdoc/method-list.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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.

// ignore-tidy-linelength

#![crate_name = "foo"]

// @has foo/struct.Foo.html
// @has - '//*[@class="sidebar-links"]/a' 'super_long_name'
// @has - '//*[@class="sidebar-links"]/a' 'Disp'
pub struct Foo(usize);

impl Foo {
pub fn super_long_name() {}
}

pub trait Disp {
fn disp_trait_method();
}

impl Disp for Foo {
fn disp_trait_method() {}
}
15 changes: 15 additions & 0 deletions src/test/ui/issue-40782.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 main() {
for i 0..2 {
}
}

8 changes: 8 additions & 0 deletions src/test/ui/issue-40782.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: missing `in` in `for` loop
--> $DIR/issue-40782.rs:12:10
|
12 | for i 0..2 {
| ^ help: try adding `in` here

error: aborting due to previous error

19 changes: 16 additions & 3 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2286,6 +2286,10 @@ actual:\n\
output_file.push(test_name);
debug!("comparing the contests of: {:?}", output_file);
debug!("with: {:?}", expected_content);
if !output_file.exists() {
panic!("Output file `{}` from test does not exist",
output_file.into_os_string().to_string_lossy());
}
self.check_mir_test_timestamp(test_name, &output_file);

let mut dumped_file = fs::File::open(output_file.clone()).unwrap();
Expand Down Expand Up @@ -2334,13 +2338,22 @@ actual:\n\

// We expect each non-empty line to appear consecutively, non-consecutive lines
// must be separated by at least one Elision
let mut start_block_line = None;
while let Some(dumped_line) = dumped_lines.next() {
match expected_lines.next() {
Some(&ExpectedLine::Text(expected_line)) =>
Some(&ExpectedLine::Text(expected_line)) => {
let normalized_expected_line = normalize_mir_line(expected_line);
if normalized_expected_line.contains(":{") {
start_block_line = Some(expected_line);
}

if !compare(expected_line, dumped_line) {
error!("{:?}", start_block_line);
error(expected_line,
format!("Mismatch in lines\nExpected Line: {:?}", dumped_line));
},
format!("Mismatch in lines\nCurrnt block: {}\nExpected Line: {:?}",
start_block_line.unwrap_or("None"), dumped_line));
}
},
Some(&ExpectedLine::Elision) => {
// skip any number of elisions in a row.
while let Some(&&ExpectedLine::Elision) = expected_lines.peek() {
Expand Down

0 comments on commit 9acc333

Please sign in to comment.