Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error codes #51475

Merged
merged 1 commit into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> { }
Expand Down Expand Up @@ -2058,27 +2058,27 @@ 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]
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)]
Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3093,7 +3093,7 @@ impl<'a> LoweringContext<'a> {
span_err!(
this.sess,
fn_decl_span,
E0906,
E0697,
"closures cannot be static"
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/anon_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/generator_interior.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`");
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/edition-raw-pointer-method-2018.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/impl-trait/region-escape-via-bound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/impl-trait/region-escape-via-bound.stderr
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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
Expand All @@ -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`.