From 40571995984a0f2c466f77955e7d147887c2179b Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Tue, 7 Jan 2020 23:21:24 +0000 Subject: [PATCH 01/13] rustdoc: Don't allow `#![feature(...)]` on stable or beta --- src/librustdoc/core.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 50d62027c8c6d..efac0d28d3b54 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -302,8 +302,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt cg: codegen_options, externs, target_triple: target, - // Ensure that rustdoc works even if rustc is feature-staged - unstable_features: UnstableFeatures::Allow, + unstable_features: UnstableFeatures::from_environment(), actually_rustdoc: true, debugging_opts: debugging_options, error_format, From 9ef4fd7e19c347f9e04b44b3470ebf22ecea71a1 Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 11 Jan 2020 13:04:06 +0000 Subject: [PATCH 02/13] Clarify the relationship between `extended` and `tools` in `config.toml` --- config.toml.example | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/config.toml.example b/config.toml.example index bfd9e18cdd41a..c9e17337ee23f 100644 --- a/config.toml.example +++ b/config.toml.example @@ -181,21 +181,23 @@ # Indicate whether the vendored sources are used for Rust dependencies or not #vendor = false -# Typically the build system will build the rust compiler twice. The second +# Typically the build system will build the Rust compiler twice. The second # compiler, however, will simply use its own libraries to link against. If you # would rather to perform a full bootstrap, compiling the compiler three times, # then you can set this option to true. You shouldn't ever need to set this # option to true. #full-bootstrap = false -# Enable a build of the extended rust tool set which is not only the compiler +# Enable a build of the extended Rust tool set which is not only the compiler # but also tools such as Cargo. This will also produce "combined installers" # which are used to install Rust and Cargo together. This is disabled by -# default. +# default. The `tools` option (immediately below) specifies which tools should +# be built if `extended = true`. #extended = false -# Installs chosen set of extended tools if enabled. By default builds all. -# If chosen tool failed to build the installation fails. +# Installs chosen set of extended tools if `extended = true`. By default builds all. +# If chosen tool failed to build the installation fails. If `extended = false`, this +# option is ignored. #tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"] # Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose From f9a57469612ba457fb7865aef944bf05d7664516 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Tue, 7 Jan 2020 14:32:37 -0500 Subject: [PATCH 03/13] parse extended terminfo format --- src/libterm/lib.rs | 2 +- src/libterm/terminfo/mod.rs | 4 +-- src/libterm/terminfo/parser/compiled.rs | 39 +++++++++++++++---------- src/libterm/win.rs | 2 +- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index d2e3b07ab855d..2116b433fce3f 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -91,7 +91,7 @@ pub fn stderr() -> Option> { #[allow(missing_docs)] pub mod color { /// Number for a terminal color - pub type Color = u16; + pub type Color = u32; pub const BLACK: Color = 0; pub const RED: Color = 1; diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index f1adc536a3dc4..918875e792a66 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -24,7 +24,7 @@ pub struct TermInfo { /// Map of capability name to boolean value pub bools: HashMap, /// Map of capability name to numeric value - pub numbers: HashMap, + pub numbers: HashMap, /// Map of capability name to raw (unexpanded) string pub strings: HashMap>, } @@ -129,7 +129,7 @@ fn cap_for_attr(attr: Attr) -> &'static str { /// A Terminal that knows how many colors it supports, with a reference to its /// parsed Terminfo database record. pub struct TerminfoTerminal { - num_colors: u16, + num_colors: u32, out: T, ti: TermInfo, } diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index d36adb72c8eef..fbc5aebdb2c6c 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -159,16 +159,16 @@ pub static stringnames: &[&str] = &[ "cbt", "_", "cr", "csr", "tbc", "clear", fn read_le_u16(r: &mut dyn io::Read) -> io::Result { let mut b = [0; 2]; - let mut amt = 0; - while amt < b.len() { - match r.read(&mut b[amt..])? { - 0 => return Err(io::Error::new(io::ErrorKind::Other, "end of file")), - n => amt += n, - } - } + r.read_exact(&mut b)?; Ok((b[0] as u16) | ((b[1] as u16) << 8)) } +fn read_le_u32(r: &mut dyn io::Read) -> io::Result { + let mut b = [0; 4]; + r.read_exact(&mut b)?; + Ok((b[0] as u32) | ((b[1] as u32) << 8) | ((b[2] as u32) << 16) | ((b[3] as u32) << 24)) +} + fn read_byte(r: &mut dyn io::Read) -> io::Result { match r.bytes().next() { Some(s) => s, @@ -194,9 +194,12 @@ pub fn parse(file: &mut dyn io::Read, longnames: bool) -> Result false, + 0o01036 => true, + _ => return Err(format!("invalid magic number, found {:o}", magic)), + }; // According to the spec, these fields must be >= -1 where -1 means that the feature is not // supported. Using 0 instead of -1 works because we skip sections with length 0. @@ -258,11 +261,15 @@ pub fn parse(file: &mut dyn io::Read, longnames: bool) -> Result = t! { - (0..numbers_count).filter_map(|i| match read_le_u16(file) { - Ok(0xFFFF) => None, - Ok(n) => Some(Ok((nnames[i].to_string(), n))), - Err(e) => Some(Err(e)) + let numbers_map: HashMap = t! { + (0..numbers_count).filter_map(|i| { + let number = if extended { read_le_u32(file) } else { read_le_u16(file).map(Into::into) }; + + match number { + Ok(0xFFFF) => None, + Ok(n) => Some(Ok((nnames[i].to_string(), n))), + Err(e) => Some(Err(e)) + } }).collect() }; @@ -318,7 +325,7 @@ pub fn msys_terminfo() -> TermInfo { strings.insert("setab".to_string(), b"\x1B[4%p1%dm".to_vec()); let mut numbers = HashMap::new(); - numbers.insert("colors".to_string(), 8u16); + numbers.insert("colors".to_string(), 8); TermInfo { names: vec!["cygwin".to_string()], // msys is a fork of an older cygwin version diff --git a/src/libterm/win.rs b/src/libterm/win.rs index b6c607a30816c..c24cf9518aa25 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -89,7 +89,7 @@ fn bits_to_color(bits: u16) -> color::Color { _ => unreachable!(), }; - color | (bits & 0x8) // copy the hi-intensity bit + color | (u32::from(bits) & 0x8) // copy the hi-intensity bit } impl WinConsole { From b4fddf0f0806662430b42cb5b226ac1e3d381026 Mon Sep 17 00:00:00 2001 From: Ben Lewis Date: Sun, 12 Jan 2020 15:55:12 +1300 Subject: [PATCH 04/13] Forbid elided lifetimes within const generic parameter types. --- src/librustc_ast_lowering/lib.rs | 14 ++++--- .../const-param-elided-lifetime.rs | 19 +++++++++ .../const-param-elided-lifetime.stderr | 40 +++++++++++++++++++ 3 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 src/test/ui/const-generics/const-param-elided-lifetime.rs create mode 100644 src/test/ui/const-generics/const-param-elided-lifetime.stderr diff --git a/src/librustc_ast_lowering/lib.rs b/src/librustc_ast_lowering/lib.rs index 58b8e8a089ad3..9775871a11bfe 100644 --- a/src/librustc_ast_lowering/lib.rs +++ b/src/librustc_ast_lowering/lib.rs @@ -2121,12 +2121,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { (hir::ParamName::Plain(param.ident), kind) } - GenericParamKind::Const { ref ty } => ( - hir::ParamName::Plain(param.ident), - hir::GenericParamKind::Const { - ty: self.lower_ty(&ty, ImplTraitContext::disallowed()), - }, - ), + GenericParamKind::Const { ref ty } => { + let ty = self + .with_anonymous_lifetime_mode(AnonymousLifetimeMode::ReportError, |this| { + this.lower_ty(&ty, ImplTraitContext::disallowed()) + }); + + (hir::ParamName::Plain(param.ident), hir::GenericParamKind::Const { ty }) + } }; hir::GenericParam { diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.rs b/src/test/ui/const-generics/const-param-elided-lifetime.rs new file mode 100644 index 0000000000000..ff98368bca280 --- /dev/null +++ b/src/test/ui/const-generics/const-param-elided-lifetime.rs @@ -0,0 +1,19 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +struct A; +//~^ ERROR `&` without an explicit lifetime name cannot be used here +trait B {} + +impl A { //~ ERROR `&` without an explicit lifetime name cannot be used here + fn foo(&self) {} + //~^ ERROR `&` without an explicit lifetime name cannot be used here +} + +impl B for A {} +//~^ ERROR `&` without an explicit lifetime name cannot be used here + +fn bar() {} +//~^ ERROR `&` without an explicit lifetime name cannot be used here + +fn main() {} diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.stderr b/src/test/ui/const-generics/const-param-elided-lifetime.stderr new file mode 100644 index 0000000000000..9f29dbf980a47 --- /dev/null +++ b/src/test/ui/const-generics/const-param-elided-lifetime.stderr @@ -0,0 +1,40 @@ +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:4:19 + | +LL | struct A; + | ^ explicit lifetime name needed here + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:8:15 + | +LL | impl A { + | ^ explicit lifetime name needed here + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:9:21 + | +LL | fn foo(&self) {} + | ^ explicit lifetime name needed here + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:13:15 + | +LL | impl B for A {} + | ^ explicit lifetime name needed here + +error[E0637]: `&` without an explicit lifetime name cannot be used here + --> $DIR/const-param-elided-lifetime.rs:16:17 + | +LL | fn bar() {} + | ^ explicit lifetime name needed here + +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/const-param-elided-lifetime.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + +error: aborting due to 5 previous errors + From 9e46ddc7a2c1bcef52bfa9e4ae547b296814e2b9 Mon Sep 17 00:00:00 2001 From: Ben Lewis Date: Sun, 12 Jan 2020 17:32:50 +1300 Subject: [PATCH 05/13] Added comment about behaviour. --- src/test/ui/const-generics/const-param-elided-lifetime.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.rs b/src/test/ui/const-generics/const-param-elided-lifetime.rs index ff98368bca280..5679dd35c307a 100644 --- a/src/test/ui/const-generics/const-param-elided-lifetime.rs +++ b/src/test/ui/const-generics/const-param-elided-lifetime.rs @@ -1,3 +1,8 @@ +// Elided lifetimes within the type of a const generic parameters is disallowed. This matches the +// behaviour of trait bounds where `fn foo>() {}` is illegal. Though we could change +// elided lifetimes within the type of a const generic parameters to be 'static, like elided +// lifetimes within const/static items. + #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash From 82b90bd9938fb56452b8a10bd004ad84a0f81503 Mon Sep 17 00:00:00 2001 From: Ben Lewis Date: Sun, 12 Jan 2020 20:41:03 +1300 Subject: [PATCH 06/13] Update test benchmark file --- .../const-param-elided-lifetime.stderr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.stderr b/src/test/ui/const-generics/const-param-elided-lifetime.stderr index 9f29dbf980a47..93133c507fe40 100644 --- a/src/test/ui/const-generics/const-param-elided-lifetime.stderr +++ b/src/test/ui/const-generics/const-param-elided-lifetime.stderr @@ -1,35 +1,35 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:4:19 + --> $DIR/const-param-elided-lifetime.rs:9:19 | LL | struct A; | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:8:15 + --> $DIR/const-param-elided-lifetime.rs:13:15 | LL | impl A { | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:9:21 + --> $DIR/const-param-elided-lifetime.rs:14:21 | LL | fn foo(&self) {} | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:13:15 + --> $DIR/const-param-elided-lifetime.rs:18:15 | LL | impl B for A {} | ^ explicit lifetime name needed here error[E0637]: `&` without an explicit lifetime name cannot be used here - --> $DIR/const-param-elided-lifetime.rs:16:17 + --> $DIR/const-param-elided-lifetime.rs:21:17 | LL | fn bar() {} | ^ explicit lifetime name needed here warning: the feature `const_generics` is incomplete and may cause the compiler to crash - --> $DIR/const-param-elided-lifetime.rs:1:12 + --> $DIR/const-param-elided-lifetime.rs:6:12 | LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ From c32090c130273787b8f9fc8290357a6a9d3222b7 Mon Sep 17 00:00:00 2001 From: Till Arnold Date: Sun, 12 Jan 2020 12:01:37 +0100 Subject: [PATCH 07/13] Document behavior of set_nonblocking on UnixListener --- src/libstd/sys/unix/ext/net.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index e0e6e02a443e1..4c3cb67c9ee0f 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -902,6 +902,12 @@ impl UnixListener { /// Moves the socket into or out of nonblocking mode. /// + /// This will result in the `accept` operation becoming nonblocking, + /// i.e., immediately returning from their calls. If the IO operation is + /// successful, `Ok` is returned and no further action is required. If the + /// IO operation could not be completed and needs to be retried, an error + /// with kind [`io::ErrorKind::WouldBlock`] is returned. + /// /// # Examples /// /// ```no_run @@ -913,6 +919,8 @@ impl UnixListener { /// Ok(()) /// } /// ``` + /// + /// [`io::ErrorKind::WouldBlock`]: ../../../io/enum.ErrorKind.html#variant.WouldBlock #[stable(feature = "unix_socket", since = "1.10.0")] pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> { self.0.set_nonblocking(nonblocking) From 79f59fa82093a9706470038ef5d87e348686dad5 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Sun, 12 Jan 2020 23:37:47 +0000 Subject: [PATCH 08/13] rustdoc: HTML escape arrows on help popup --- src/librustdoc/html/static/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 8ccb74d6f15d3..809d38a7ead8f 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2663,8 +2663,8 @@ function getSearchElement() { "Accepted types are: fn, mod, struct, \ enum, trait, type, macro, \ and const.", - "Search functions by type signature (e.g., vec -> usize or \ - * -> vec)", + "Search functions by type signature (e.g., vec -> usize or \ + * -> vec)", "Search multiple things at once by splitting your query with comma (e.g., \ str,u8 or String,struct:Vec,test)", "You can look for items with an exact name by putting double quotes around \ From 9d95eaa49b095c396eaee3d3cb62e60df8e81a2f Mon Sep 17 00:00:00 2001 From: Afnan Enayet Date: Fri, 3 Jan 2020 17:27:14 -0800 Subject: [PATCH 09/13] Use `report_in_external_macro` for internal lints Add the option to report lints in external macros for rustc internal lints --- src/librustc_lint/internal.rs | 12 ++++++++---- src/librustc_span/symbol.rs | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/librustc_lint/internal.rs b/src/librustc_lint/internal.rs index 2f8393bd906c0..5a5aedc2e9715 100644 --- a/src/librustc_lint/internal.rs +++ b/src/librustc_lint/internal.rs @@ -12,7 +12,8 @@ use syntax::ast::{Ident, Item, ItemKind}; declare_tool_lint! { pub rustc::DEFAULT_HASH_TYPES, Allow, - "forbid HashMap and HashSet and suggest the FxHash* variants" + "forbid HashMap and HashSet and suggest the FxHash* variants", + report_in_external_macro: true } pub struct DefaultHashTypes { @@ -52,19 +53,22 @@ impl EarlyLintPass for DefaultHashTypes { declare_tool_lint! { pub rustc::USAGE_OF_TY_TYKIND, Allow, - "usage of `ty::TyKind` outside of the `ty::sty` module" + "usage of `ty::TyKind` outside of the `ty::sty` module", + report_in_external_macro: true } declare_tool_lint! { pub rustc::TY_PASS_BY_REFERENCE, Allow, - "passing `Ty` or `TyCtxt` by reference" + "passing `Ty` or `TyCtxt` by reference", + report_in_external_macro: true } declare_tool_lint! { pub rustc::USAGE_OF_QUALIFIED_TY, Allow, - "using `ty::{Ty,TyCtxt}` instead of importing it" + "using `ty::{Ty,TyCtxt}` instead of importing it", + report_in_external_macro: true } declare_lint_pass!(TyTyKind => [ diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs index a8b2db300a478..889f6099070ae 100644 --- a/src/librustc_span/symbol.rs +++ b/src/librustc_span/symbol.rs @@ -1049,6 +1049,7 @@ pub mod kw { } // This module has a very short name because it's used a lot. +#[allow(rustc::default_hash_types)] pub mod sym { use super::Symbol; use std::convert::TryInto; From 13785c4c2ecf26e859c38b5656f611ae2a84fdba Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 13 Jan 2020 16:54:58 +0900 Subject: [PATCH 10/13] Remove unneeded scope --- src/librustdoc/clean/auto_trait.rs | 58 ++++++++++++++---------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index c8b63ed5c8096..56013ee3a816f 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -560,8 +560,8 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { lifetime_to_bounds.entry(lifetime).or_default().extend(bounds); } WherePredicate::EqPredicate { lhs, rhs } => { - match &lhs { - &Type::QPath { name: ref left_name, ref self_type, ref trait_ } => { + match lhs { + Type::QPath { name: ref left_name, ref self_type, ref trait_ } => { let ty = &*self_type; match **trait_ { Type::ResolvedPath { @@ -580,36 +580,30 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { continue; } - // FIXME: Remove this scope when NLL lands - { - let args = &mut new_trait_path - .segments - .last_mut() - .expect("segments were empty") - .args; - - match args { - // Convert somethiung like ' = u8' - // to 'T: Iterator' - &mut GenericArgs::AngleBracketed { - ref mut bindings, - .. - } => { - bindings.push(TypeBinding { - name: left_name.clone(), - kind: TypeBindingKind::Equality { ty: rhs }, - }); - } - &mut GenericArgs::Parenthesized { .. } => { - existing_predicates.push( - WherePredicate::EqPredicate { - lhs: lhs.clone(), - rhs, - }, - ); - continue; // If something other than a Fn ends up - // with parenthesis, leave it alone - } + let args = &mut new_trait_path + .segments + .last_mut() + .expect("segments were empty") + .args; + + match args { + // Convert somethiung like ' = u8' + // to 'T: Iterator' + GenericArgs::AngleBracketed { + ref mut bindings, .. + } => { + bindings.push(TypeBinding { + name: left_name.clone(), + kind: TypeBindingKind::Equality { ty: rhs }, + }); + } + GenericArgs::Parenthesized { .. } => { + existing_predicates.push(WherePredicate::EqPredicate { + lhs: lhs.clone(), + rhs, + }); + continue; // If something other than a Fn ends up + // with parenthesis, leave it alone } } From 11f74189f1fa92fce4d7bfec5d9eed4e1f0c352e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 13 Jan 2020 13:32:32 +0100 Subject: [PATCH 11/13] Clean up E0191 explanation --- src/librustc_error_codes/error_codes/E0191.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0191.md b/src/librustc_error_codes/error_codes/E0191.md index b79196f6cec7a..46b773bdc50d6 100644 --- a/src/librustc_error_codes/error_codes/E0191.md +++ b/src/librustc_error_codes/error_codes/E0191.md @@ -1,5 +1,6 @@ -Trait objects need to have all associated types specified. Erroneous code -example: +An associated type wasn't specified for a trait object. + +Erroneous code example: ```compile_fail,E0191 trait Trait { @@ -10,8 +11,9 @@ type Foo = Trait; // error: the value of the associated type `Bar` (from // the trait `Trait`) must be specified ``` -Please verify you specified all associated types of the trait and that you -used the right trait. Example: +Trait objects need to have all associated types specified. Please verify that +all associated types of the trait were specified and the correct trait was used. +Example: ``` trait Trait { From 3ec0a84e6ef35f58c837a0afbcf02b70ee543459 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 13 Jan 2020 13:34:55 +0100 Subject: [PATCH 12/13] Clean up E0192 explanation --- src/librustc_error_codes/error_codes/E0192.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/librustc_error_codes/error_codes/E0192.md b/src/librustc_error_codes/error_codes/E0192.md index 33308868cb235..5fd951b2e86cb 100644 --- a/src/librustc_error_codes/error_codes/E0192.md +++ b/src/librustc_error_codes/error_codes/E0192.md @@ -1,3 +1,19 @@ +A negative impl was added on a trait implementation. + +Erroneous code example: + +```compile_fail,E0192 +trait Trait { + type Bar; +} + +struct Foo; + +impl !Trait for Foo { } //~ ERROR E0192 + +fn main() {} +``` + Negative impls are only allowed for auto traits. For more information see the [opt-in builtin traits RFC][RFC 19]. From d975228cedeaab828e91ab72d4d6fb5ded324de8 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 14 Jan 2020 04:44:57 +0900 Subject: [PATCH 13/13] Tweak assertion note in fmt --- src/bootstrap/format.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/format.rs b/src/bootstrap/format.rs index 65b654fb51929..6e5e3fe07e746 100644 --- a/src/bootstrap/format.rs +++ b/src/bootstrap/format.rs @@ -20,7 +20,15 @@ fn rustfmt(src: &Path, rustfmt: &Path, path: &Path, check: bool) { cmd.arg(&path); let cmd_debug = format!("{:?}", cmd); let status = cmd.status().expect("executing rustfmt"); - assert!(status.success(), "running {} successful", cmd_debug); + if !status.success() { + eprintln!( + "Running `{}` failed.\nIf you're running `tidy`, \ + try again with `--bless` flag. Or, you just want to format \ + code, run `./x.py fmt` instead.", + cmd_debug, + ); + std::process::exit(1); + } } #[derive(serde::Deserialize)]