Fix error codes
This commit is contained in:
parent
b4d836c98b
commit
f2349d5ec6
11 changed files with 23 additions and 24 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -3093,7 +3093,7 @@ impl<'a> LoweringContext<'a> {
|
|||
span_err!(
|
||||
this.sess,
|
||||
fn_decl_span,
|
||||
E0906,
|
||||
E0697,
|
||||
"closures cannot be static"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
);
|
||||
|
|
|
@ -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`");
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue