From 0cd03bf5f33751497444b03e51d1b4598dc46a7d Mon Sep 17 00:00:00 2001 From: matt rice Date: Thu, 26 Oct 2017 05:16:20 -0700 Subject: [PATCH 01/20] issue #45357 don't build clippy stage 1 --- src/bootstrap/tool.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 688ee6ba295fa..a8dfba5542797 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -415,7 +415,10 @@ impl Step for Clippy { const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - run.path("src/tools/clippy") + match run.builder.top_stage { + 1 => run.never(), + _ => run.path("src/tools/clippy"), + } } fn make_run(run: RunConfig) { From 5c21637f9ab8f062f63d300507aa3eb7fdde0064 Mon Sep 17 00:00:00 2001 From: M Farkas-Dyck Date: Sun, 29 Oct 2017 01:28:54 -0800 Subject: [PATCH 02/20] impl From for AtomicT --- src/libcore/sync/atomic.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 53b056d2b8b6f..76ef4b23bf71a 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -927,6 +927,12 @@ impl AtomicPtr { } } +#[stable(feature = "rust1", since = "1.0.0")] +impl From<*mut T> for AtomicPtr { + #[inline] + fn from(p: *mut T) -> Self { Self::new(p) } +} + #[cfg(target_has_atomic = "ptr")] macro_rules! atomic_int { ($stable:meta, $const_unstable:meta, @@ -967,6 +973,12 @@ macro_rules! atomic_int { } } + #[$stable] + 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 { From 80a3191215734997b5c785874984691a7e82df10 Mon Sep 17 00:00:00 2001 From: M Farkas-Dyck Date: Sun, 29 Oct 2017 14:41:03 -0800 Subject: [PATCH 03/20] feature = "atomic_from" --- src/libcore/sync/atomic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 76ef4b23bf71a..91c0269156854 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -927,7 +927,7 @@ impl AtomicPtr { } } -#[stable(feature = "rust1", since = "1.0.0")] +#[stable(feature = "atomic_from", since = "1.22.0")] impl From<*mut T> for AtomicPtr { #[inline] fn from(p: *mut T) -> Self { Self::new(p) } @@ -973,7 +973,7 @@ macro_rules! atomic_int { } } - #[$stable] + #[stable(feature = "atomic_from", since = "1.22.0")] impl From<$int_type> for $atomic_type { #[inline] fn from(v: $int_type) -> Self { Self::new(v) } From 6a62ea682878e9f9e889c44a42f57a7eb1822e0d Mon Sep 17 00:00:00 2001 From: laurent Date: Mon, 30 Oct 2017 22:33:57 +0000 Subject: [PATCH 04/20] Add a nicer error message for missing in for loop, fixes #40782. --- src/libsyntax/parse/parser.rs | 54 ++++++++++++++++++++++++++++++---- src/test/ui/issue-40782.rs | 15 ++++++++++ src/test/ui/issue-40782.stderr | 11 +++++++ 3 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 src/test/ui/issue-40782.rs create mode 100644 src/test/ui/issue-40782.stderr diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index a3a265450ab0e..37a12801ddcfc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3154,13 +3154,55 @@ impl<'a> Parser<'a> { // Parse: `for in ` let pat = self.parse_pat()?; - self.expect_keyword(keywords::In)?; - let expr = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?; - let (iattrs, loop_block) = self.parse_inner_attrs_and_block()?; - attrs.extend(iattrs); + // Save the state of the parser before parsing 'in'. + let parser_snapshot_before_in = self.clone(); + match self.expect_keyword(keywords::In) { + Ok(()) => { + let expr = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?; + let (iattrs, loop_block) = self.parse_inner_attrs_and_block()?; + attrs.extend(iattrs); - let hi = self.prev_span; - Ok(self.mk_expr(span_lo.to(hi), ExprKind::ForLoop(pat, expr, loop_block, opt_ident), attrs)) + let hi = self.prev_span; + Ok(self.mk_expr( + span_lo.to(hi), + ExprKind::ForLoop(pat, expr, loop_block, opt_ident), + attrs)) + } + Err(mut in_err) => { + let parser_snapshot_after_in = self.clone(); + // Rewind to before attempting to parse the 'in'. + mem::replace(self, parser_snapshot_before_in); + + match self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None) { + Ok(expr) => { + // Successfully parsed the expr, print a nice error message. + in_err.cancel(); + let in_span = parser_snapshot_after_in.span; + let mut err = self.sess.span_diagnostic + .struct_span_err(in_span, "missing `in` in `for` loop"); + err.span_label(in_span, "expected `in` here"); + let sugg = pprust::to_string(|s| { + s.s.word("for ")?; + s.print_pat(&pat)?; + s.s.word(" in ")?; + s.print_expr(&expr) + }); + err.span_suggestion( + in_span, + "try adding `in`", + sugg); + Err(err) + } + Err(mut expr_err) => { + // Couldn't parse as an expr, return original error and parser state. + expr_err.cancel(); + mem::replace(self, parser_snapshot_after_in); + Err(in_err) + } + } + } + + } } /// Parse a 'while' or 'while let' expression ('while' token already eaten) diff --git a/src/test/ui/issue-40782.rs b/src/test/ui/issue-40782.rs new file mode 100644 index 0000000000000..56ee225105f89 --- /dev/null +++ b/src/test/ui/issue-40782.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + for i 0..2 { + } +} + diff --git a/src/test/ui/issue-40782.stderr b/src/test/ui/issue-40782.stderr new file mode 100644 index 0000000000000..a267c9bf4af78 --- /dev/null +++ b/src/test/ui/issue-40782.stderr @@ -0,0 +1,11 @@ +error: missing `in` in `for` loop + --> $DIR/issue-40782.rs:12:11 + | +12 | for i 0..2 { + | ^ + | | + | expected `in` here + | help: try adding `in`: `for i in 0..2` + +error: aborting due to previous error + From be21779072419eaa7ddbf948e9caa58c688b73e9 Mon Sep 17 00:00:00 2001 From: M Farkas-Dyck Date: Tue, 31 Oct 2017 11:15:10 -0800 Subject: [PATCH 05/20] since = "1.23.0" --- src/libcore/sync/atomic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 91c0269156854..cd3dd9ce1399e 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -927,7 +927,7 @@ impl AtomicPtr { } } -#[stable(feature = "atomic_from", since = "1.22.0")] +#[stable(feature = "atomic_from", since = "1.23.0")] impl From<*mut T> for AtomicPtr { #[inline] fn from(p: *mut T) -> Self { Self::new(p) } @@ -973,7 +973,7 @@ macro_rules! atomic_int { } } - #[stable(feature = "atomic_from", since = "1.22.0")] + #[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) } From 6d060bd49a2a518d44deb36aadf772cc6ae61fb8 Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 31 Oct 2017 19:45:12 +0000 Subject: [PATCH 06/20] Fix spans and error messages. --- src/libsyntax/parse/parser.rs | 19 ++++++------------- src/test/ui/issue-40782.stderr | 10 +++++----- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 37a12801ddcfc..ffa6567c18bd0 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3174,23 +3174,16 @@ impl<'a> Parser<'a> { mem::replace(self, parser_snapshot_before_in); match self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None) { - Ok(expr) => { - // Successfully parsed the expr, print a nice error message. + Ok(_) => { + // Successfully parsed the expr which means that the 'in' keyword is + // missing, e.g. 'for i 0..2' in_err.cancel(); - let in_span = parser_snapshot_after_in.span; + let in_span = parser_snapshot_after_in.prev_span + .between(parser_snapshot_after_in.span); let mut err = self.sess.span_diagnostic .struct_span_err(in_span, "missing `in` in `for` loop"); err.span_label(in_span, "expected `in` here"); - let sugg = pprust::to_string(|s| { - s.s.word("for ")?; - s.print_pat(&pat)?; - s.s.word(" in ")?; - s.print_expr(&expr) - }); - err.span_suggestion( - in_span, - "try adding `in`", - sugg); + err.span_suggestion_short(in_span, "try adding `in` here", "in".into()); Err(err) } Err(mut expr_err) => { diff --git a/src/test/ui/issue-40782.stderr b/src/test/ui/issue-40782.stderr index a267c9bf4af78..ab87438555b28 100644 --- a/src/test/ui/issue-40782.stderr +++ b/src/test/ui/issue-40782.stderr @@ -1,11 +1,11 @@ error: missing `in` in `for` loop - --> $DIR/issue-40782.rs:12:11 + --> $DIR/issue-40782.rs:12:10 | 12 | for i 0..2 { - | ^ - | | - | expected `in` here - | help: try adding `in`: `for i in 0..2` + | ^ + | | + | expected `in` here + | help: try adding `in` here error: aborting due to previous error From ea103ef57f16bda277324b6f01ab0d13398fdee5 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 31 Oct 2017 14:49:29 -0500 Subject: [PATCH 07/20] add license data to libstd Include the license of libstd in the cargo metadata --- src/libstd/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 5dd5f8953a00e..c487cd82e4678 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -3,6 +3,7 @@ authors = ["The Rust Project Developers"] name = "std" version = "0.0.0" build = "build.rs" +license = "MIT/Apache-2.0" [lib] name = "std" From 4519192d4f1b72210e6e687d59fdd88229428890 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 31 Oct 2017 14:57:27 -0500 Subject: [PATCH 08/20] add repository info to libstd Include the repository info for libstd in the Cargo metadata. --- src/libstd/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index c487cd82e4678..a1a4502989284 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -4,6 +4,7 @@ name = "std" version = "0.0.0" build = "build.rs" license = "MIT/Apache-2.0" +repository = "https://github.com/rust-lang/rust.git" [lib] name = "std" From 86c09f3a450acaaa4f6326ce64b1d5936310d16f Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 31 Oct 2017 15:10:10 -0500 Subject: [PATCH 09/20] add description to libstd Include a description field for libstd in Cargo metadata. --- src/libstd/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index a1a4502989284..d239b79d4ba7a 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -5,6 +5,7 @@ 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" From 531b7f2e273dd00476482ead3cb0d24945190f64 Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 31 Oct 2017 21:23:46 +0000 Subject: [PATCH 10/20] Add some missing spaces. --- src/libsyntax/parse/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ffa6567c18bd0..1b0bdd8cb5e52 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3183,7 +3183,7 @@ impl<'a> Parser<'a> { let mut err = self.sess.span_diagnostic .struct_span_err(in_span, "missing `in` in `for` loop"); err.span_label(in_span, "expected `in` here"); - err.span_suggestion_short(in_span, "try adding `in` here", "in".into()); + err.span_suggestion_short(in_span, "try adding `in` here", " in ".into()); Err(err) } Err(mut expr_err) => { From 0d7285393f30d99e8715015bd1463c77acdc4690 Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 31 Oct 2017 21:26:49 +0000 Subject: [PATCH 11/20] Formatting tweak. --- src/libsyntax/parse/parser.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1b0bdd8cb5e52..1528ab25014da 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3194,8 +3194,7 @@ impl<'a> Parser<'a> { } } } - - } + } } /// Parse a 'while' or 'while let' expression ('while' token already eaten) From 175cfbf129866fb8412f79a02ab66ae549a24b10 Mon Sep 17 00:00:00 2001 From: laurent Date: Wed, 1 Nov 2017 06:45:34 +0000 Subject: [PATCH 12/20] Remove the parser snapshot hack. --- src/libsyntax/parse/parser.rs | 56 ++++++++++------------------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 1528ab25014da..4758417f4bd6a 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3154,47 +3154,23 @@ impl<'a> Parser<'a> { // Parse: `for in ` let pat = self.parse_pat()?; - // Save the state of the parser before parsing 'in'. - let parser_snapshot_before_in = self.clone(); - match self.expect_keyword(keywords::In) { - Ok(()) => { - let expr = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?; - let (iattrs, loop_block) = self.parse_inner_attrs_and_block()?; - attrs.extend(iattrs); - - let hi = self.prev_span; - Ok(self.mk_expr( - span_lo.to(hi), - ExprKind::ForLoop(pat, expr, loop_block, opt_ident), - attrs)) - } - Err(mut in_err) => { - let parser_snapshot_after_in = self.clone(); - // Rewind to before attempting to parse the 'in'. - mem::replace(self, parser_snapshot_before_in); - - match self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None) { - Ok(_) => { - // Successfully parsed the expr which means that the 'in' keyword is - // missing, e.g. 'for i 0..2' - in_err.cancel(); - let in_span = parser_snapshot_after_in.prev_span - .between(parser_snapshot_after_in.span); - let mut err = self.sess.span_diagnostic - .struct_span_err(in_span, "missing `in` in `for` loop"); - err.span_label(in_span, "expected `in` here"); - err.span_suggestion_short(in_span, "try adding `in` here", " in ".into()); - Err(err) - } - Err(mut expr_err) => { - // Couldn't parse as an expr, return original error and parser state. - expr_err.cancel(); - mem::replace(self, parser_snapshot_after_in); - Err(in_err) - } - } - } + 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_label(in_span, "expected `in` here"); + 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); + + let hi = self.prev_span; + Ok(self.mk_expr( + span_lo.to(hi), + ExprKind::ForLoop(pat, expr, loop_block, opt_ident), + attrs)) } /// Parse a 'while' or 'while let' expression ('while' token already eaten) From d336f022d56b7d1b0ed181de0c88b12bb9b2ae39 Mon Sep 17 00:00:00 2001 From: laurent Date: Wed, 1 Nov 2017 06:46:58 +0000 Subject: [PATCH 13/20] Preserve original formatting. --- src/libsyntax/parse/parser.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4758417f4bd6a..ec9b22ae5a223 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3167,10 +3167,7 @@ impl<'a> Parser<'a> { attrs.extend(iattrs); let hi = self.prev_span; - Ok(self.mk_expr( - span_lo.to(hi), - ExprKind::ForLoop(pat, expr, loop_block, opt_ident), - attrs)) + Ok(self.mk_expr(span_lo.to(hi), ExprKind::ForLoop(pat, expr, loop_block, opt_ident), attrs)) } /// Parse a 'while' or 'while let' expression ('while' token already eaten) From bf95f9f1853dc09e7f3c667cdf22e6eb64b48a2f Mon Sep 17 00:00:00 2001 From: Lance John Date: Wed, 1 Nov 2017 21:02:08 +0800 Subject: [PATCH 14/20] Fix typo. --- src/liballoc/raw_vec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 841f9dc64142e..dbf1fb1367dda 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -114,7 +114,7 @@ impl RawVec { impl RawVec { /// 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 { From ed20f3b5c0ae32802450c77da5c94c239c3a3500 Mon Sep 17 00:00:00 2001 From: laurent Date: Wed, 1 Nov 2017 23:43:32 +0000 Subject: [PATCH 15/20] Remove the redundant span_label. --- src/libsyntax/parse/parser.rs | 1 - src/test/ui/issue-40782.stderr | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index ec9b22ae5a223..6de2ca5b9b874 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3158,7 +3158,6 @@ impl<'a> Parser<'a> { 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_label(in_span, "expected `in` here"); err.span_suggestion_short(in_span, "try adding `in` here", " in ".into()); err.emit(); } diff --git a/src/test/ui/issue-40782.stderr b/src/test/ui/issue-40782.stderr index ab87438555b28..0d49eebbdbfc9 100644 --- a/src/test/ui/issue-40782.stderr +++ b/src/test/ui/issue-40782.stderr @@ -2,10 +2,7 @@ error: missing `in` in `for` loop --> $DIR/issue-40782.rs:12:10 | 12 | for i 0..2 { - | ^ - | | - | expected `in` here - | help: try adding `in` here + | ^ help: try adding `in` here error: aborting due to previous error From 0f49129fd7bbae76875be0ab893e79d429023a31 Mon Sep 17 00:00:00 2001 From: Lance John Date: Thu, 2 Nov 2017 20:07:22 +0800 Subject: [PATCH 16/20] Fix typo `accomodate` -> `accommodate` --- src/libcore/ops/deref.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/ops/deref.rs b/src/libcore/ops/deref.rs index 4cb6e8405f398..80c48c7b28efd 100644 --- a/src/libcore/ops/deref.rs +++ b/src/libcore/ops/deref.rs @@ -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 @@ -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 From d6dfec124f5c64204a727ef8d702a3598bc9b81b Mon Sep 17 00:00:00 2001 From: Mikhail Modin Date: Thu, 2 Nov 2017 16:41:40 +0300 Subject: [PATCH 17/20] improve compiletest output for errors from mir-opt tests --- src/tools/compiletest/src/runtest.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index f8628158aff46..42e52ceea6903 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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(); @@ -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() { From ce3f0719e6a19fce9fee7c361eb04a805730a668 Mon Sep 17 00:00:00 2001 From: Rolf Karp Date: Fri, 3 Nov 2017 15:21:05 +0100 Subject: [PATCH 18/20] Fix std compile error for windows-gnu targets without `backtrace` feature --- src/libstd/sys/windows/c.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 39e00270233b4..6e0cccff00193 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -1228,7 +1228,7 @@ compat_fn! { } } -#[cfg(target_env = "gnu")] +#[cfg(all(target_env = "gnu", feature = "backtrace"))] mod gnu { use super::*; @@ -1256,5 +1256,5 @@ mod gnu { } } -#[cfg(target_env = "gnu")] +#[cfg(all(target_env = "gnu", feature = "backtrace"))] pub use self::gnu::*; From 765153e6a4a2f3b4e0748ae844485a6037de12e4 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 3 Nov 2017 18:39:00 +0100 Subject: [PATCH 19/20] Add tests for methods listing in rust docs --- src/test/rustdoc/method-list.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/rustdoc/method-list.rs diff --git a/src/test/rustdoc/method-list.rs b/src/test/rustdoc/method-list.rs new file mode 100644 index 0000000000000..b7112885e888b --- /dev/null +++ b/src/test/rustdoc/method-list.rs @@ -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 or the MIT license +// , 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() {} +} From aa9d0aae99d84df9439f700c56ec3a84fdb1b10c Mon Sep 17 00:00:00 2001 From: matt rice Date: Sun, 29 Oct 2017 09:10:07 -0700 Subject: [PATCH 20/20] issue #45357 set clippy build condition to extended. --- src/bootstrap/tool.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index a8dfba5542797..7175fed5410ba 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -415,10 +415,8 @@ impl Step for Clippy { const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun) -> ShouldRun { - match run.builder.top_stage { - 1 => run.never(), - _ => 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) {