From f2349d5ec6d2f184d8b83cebe255834f927568c3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 10 Jun 2018 14:04:48 +0200 Subject: [PATCH] Fix error codes --- src/librustc/diagnostics.rs | 15 +++++++-------- src/librustc/hir/check_attr.rs | 4 ++-- src/librustc/hir/lowering.rs | 2 +- src/librustc/infer/anon_types/mod.rs | 2 +- src/librustc_typeck/check/generator_interior.rs | 2 +- src/librustc_typeck/check/method/probe.rs | 2 +- src/librustc_typeck/diagnostics.rs | 4 ++-- .../edition-raw-pointer-method-2018.rs | 2 +- .../rfc-2008-non-exhaustive/invalid-attribute.rs | 6 +++--- src/test/ui/impl-trait/region-escape-via-bound.rs | 2 +- .../ui/impl-trait/region-escape-via-bound.stderr | 6 +++--- 11 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 61f05ca347358..7415ddd455d87 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -2011,13 +2011,13 @@ a (non-transparent) struct containing a single float, while `Grams` is a transparent wrapper around a float. This can make a difference for the ABI. "##, -E0909: r##" +E0700: r##" The `impl Trait` return type captures lifetime parameters that do not appear within the `impl Trait` itself. Erroneous code example: -```compile-fail,E0909 +```compile-fail,E0700 use std::cell::Cell; trait Trait<'a> { } @@ -2058,13 +2058,13 @@ where 'x: 'y ``` "##, -E0910: r##" +E0701: r##" This error indicates that a `#[non_exhaustive]` attribute was incorrectly placed on something other than a struct or enum. Examples of erroneous code: -```compile_fail,E0910 +```compile_fail,E0701 # #![feature(non_exhaustive)] #[non_exhaustive] @@ -2072,13 +2072,13 @@ trait Foo { } ``` "##, -E0911: r##" +E0702: r##" This error indicates that a `#[non_exhaustive]` attribute had a value. The `#[non_exhaustive]` should be empty. Examples of erroneous code: -```compile_fail,E0911 +```compile_fail,E0702 # #![feature(non_exhaustive)] #[non_exhaustive(anything)] @@ -2139,6 +2139,5 @@ register_diagnostics! { E0657, // `impl Trait` can only capture lifetimes bound at the fn level E0687, // in-band lifetimes cannot be used in `fn`/`Fn` syntax E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders - - E0906, // closures cannot be static + E0697, // closures cannot be static } diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 591cb9d5ad6c2..c71b47fa4e1fe 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -126,7 +126,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { _ => { struct_span_err!(self.tcx.sess, attr.span, - E0910, + E0701, "attribute can only be applied to a struct or enum") .span_label(item.span, "not a struct or enum") .emit(); @@ -137,7 +137,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { if attr.meta_item_list().is_some() || attr.value_str().is_some() { struct_span_err!(self.tcx.sess, attr.span, - E0911, + E0702, "attribute should be empty") .span_label(item.span, "not empty") .emit(); diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 1e48a54e018d6..35d580d1c159b 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -3093,7 +3093,7 @@ impl<'a> LoweringContext<'a> { span_err!( this.sess, fn_decl_span, - E0906, + E0697, "closures cannot be static" ); } diff --git a/src/librustc/infer/anon_types/mod.rs b/src/librustc/infer/anon_types/mod.rs index 4cc5e885b8a80..a7879025eeae4 100644 --- a/src/librustc/infer/anon_types/mod.rs +++ b/src/librustc/infer/anon_types/mod.rs @@ -556,7 +556,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ReverseMapper<'cx, 'gcx, 'tcx> let mut err = struct_span_err!( self.tcx.sess, span, - E0909, + E0700, "hidden type for `impl Trait` captures lifetime that \ does not appear in bounds", ); diff --git a/src/librustc_typeck/check/generator_interior.rs b/src/librustc_typeck/check/generator_interior.rs index e234e2f01925f..e20904930792e 100644 --- a/src/librustc_typeck/check/generator_interior.rs +++ b/src/librustc_typeck/check/generator_interior.rs @@ -65,7 +65,7 @@ impl<'a, 'gcx, 'tcx> InteriorVisitor<'a, 'gcx, 'tcx> { expr, scope, ty, self.expr_count, yield_span); if self.fcx.any_unresolved_type_vars(&ty) { - let mut err = struct_span_err!(self.fcx.tcx.sess, source_span, E0907, + let mut err = struct_span_err!(self.fcx.tcx.sess, source_span, E0698, "type inside generator must be known in this context"); err.span_note(yield_span, "the type is part of the generator because of this `yield`"); diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 7c51765f0608e..834c7d4e9e391 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -335,7 +335,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // so we do a future-compat lint here for the 2015 edition // (see https://github.com/rust-lang/rust/issues/46906) if self.tcx.sess.rust_2018() { - span_err!(self.tcx.sess, span, E0908, + span_err!(self.tcx.sess, span, E0699, "the type of this value must be known \ to call a method on a raw pointer on it"); } else { diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index e6a66cd613e9c..e4c73218de5ae 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -4668,7 +4668,7 @@ alignment. "##, -E0908: r##" +E0699: r##" A method was called on a raw pointer whose inner type wasn't completely known. For example, you may have done something like: @@ -4797,5 +4797,5 @@ register_diagnostics! { E0640, // infer outlives requirements E0641, // cannot cast to/from a pointer with an unknown kind E0645, // trait aliases not finished - E0907, // type inside generator must be known in this context + E0698, // type inside generator must be known in this context } diff --git a/src/test/compile-fail/edition-raw-pointer-method-2018.rs b/src/test/compile-fail/edition-raw-pointer-method-2018.rs index d01cac019e36c..d0cf81d59cf37 100644 --- a/src/test/compile-fail/edition-raw-pointer-method-2018.rs +++ b/src/test/compile-fail/edition-raw-pointer-method-2018.rs @@ -18,5 +18,5 @@ fn main() { let x = 0; let y = &x as *const _; let _ = y.is_null(); - //~^ error: the type of this value must be known to call a method on a raw pointer on it [E0908] + //~^ error: the type of this value must be known to call a method on a raw pointer on it [E0699] } diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/invalid-attribute.rs b/src/test/compile-fail/rfc-2008-non-exhaustive/invalid-attribute.rs index e48d989c01d61..df4fe1e77e96d 100644 --- a/src/test/compile-fail/rfc-2008-non-exhaustive/invalid-attribute.rs +++ b/src/test/compile-fail/rfc-2008-non-exhaustive/invalid-attribute.rs @@ -11,15 +11,15 @@ #![feature(non_exhaustive)] #[non_exhaustive(anything)] -//~^ ERROR attribute should be empty [E0911] +//~^ ERROR attribute should be empty [E0702] struct Foo; #[non_exhaustive] -//~^ ERROR attribute can only be applied to a struct or enum [E0910] +//~^ ERROR attribute can only be applied to a struct or enum [E0701] trait Bar { } #[non_exhaustive] -//~^ ERROR attribute can only be applied to a struct or enum [E0910] +//~^ ERROR attribute can only be applied to a struct or enum [E0701] union Baz { f1: u16, f2: u16 diff --git a/src/test/ui/impl-trait/region-escape-via-bound.rs b/src/test/ui/impl-trait/region-escape-via-bound.rs index e73f15606dc5a..c40c5f4cc3191 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound.rs @@ -24,7 +24,7 @@ trait Trait<'a> { } impl Trait<'b> for Cell<&'a u32> { } fn foo(x: Cell<&'x u32>) -> impl Trait<'y> - //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds [E0909] + //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds [E0700] where 'x: 'y { x diff --git a/src/test/ui/impl-trait/region-escape-via-bound.stderr b/src/test/ui/impl-trait/region-escape-via-bound.stderr index 4281a4c10adfa..b673111d21986 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.stderr +++ b/src/test/ui/impl-trait/region-escape-via-bound.stderr @@ -1,4 +1,4 @@ -error[E0909]: hidden type for `impl Trait` captures lifetime that does not appear in bounds +error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/region-escape-via-bound.rs:26:29 | LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> @@ -8,7 +8,7 @@ note: hidden type `std::cell::Cell<&'x u32>` captures the lifetime 'x as defined --> $DIR/region-escape-via-bound.rs:26:1 | LL | / fn foo(x: Cell<&'x u32>) -> impl Trait<'y> -LL | | //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds [E0909] +LL | | //~^ ERROR hidden type for `impl Trait` captures lifetime that does not appear in bounds [E0700] LL | | where 'x: 'y LL | | { LL | | x @@ -17,4 +17,4 @@ LL | | } error: aborting due to previous error -For more information about this error, try `rustc --explain E0909`. +For more information about this error, try `rustc --explain E0700`.