Skip to content

Commit

Permalink
Rollup merge of rust-lang#65135 - GuillaumeGomez:add-error-code-check…
Browse files Browse the repository at this point in the history
…, r=Mark-Simulacrum

Add check for missing tests for error codes

Fixes rust-lang#64811.

r? @Mark-Simulacrum
  • Loading branch information
Centril authored Oct 8, 2019
2 parents 9b989ea + 7a84158 commit ecd6229
Show file tree
Hide file tree
Showing 9 changed files with 205 additions and 36 deletions.
18 changes: 11 additions & 7 deletions src/librustc/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ fn main() {
```
"##,


E0139: r##"
#### Note: this error code is no longer emitted by the compiler.
Expand Down Expand Up @@ -1562,7 +1561,9 @@ fn transmute_lifetime<'a, T>(t: &'a (T,)) -> &'a T {
"##,

E0496: r##"
A lifetime name is shadowing another lifetime name. Erroneous code example:
A lifetime name is shadowing another lifetime name.
Erroneous code example:
```compile_fail,E0496
struct Foo<'a> {
Expand Down Expand Up @@ -1594,8 +1595,11 @@ fn main() {
"##,

E0497: r##"
A stability attribute was used outside of the standard library. Erroneous code
example:
#### Note: this error code is no longer emitted by the compiler.
A stability attribute was used outside of the standard library.
Erroneous code example:
```compile_fail
#[stable] // error: stability attributes may not be used outside of the
Expand Down Expand Up @@ -2125,7 +2129,7 @@ rejected in your own crates.
// E0272, // on_unimplemented #0
// E0273, // on_unimplemented #1
// E0274, // on_unimplemented #2
E0278, // requirement is not satisfied
// E0278, // requirement is not satisfied
E0279, // requirement is not satisfied
E0280, // requirement is not satisfied
// E0285, // overflow evaluation builtin bounds
Expand Down Expand Up @@ -2165,10 +2169,10 @@ rejected in your own crates.
E0687, // in-band lifetimes cannot be used in `fn`/`Fn` syntax
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
E0697, // closures cannot be static
E0707, // multiple elided lifetimes used in arguments of `async fn`
// E0707, // multiple elided lifetimes used in arguments of `async fn`
E0708, // `async` non-`move` closures with parameters are not currently
// supported
E0709, // multiple different lifetimes used in arguments of `async fn`
// E0709, // multiple different lifetimes used in arguments of `async fn`
E0710, // an unknown tool name found in scoped lint
E0711, // a feature has been declared with conflicting stability attributes
// E0702, // replaced with a generic attribute input check
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/error_codes.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
syntax::register_diagnostics! {
;
E0721, // `await` keyword
// E0721, // `await` keyword
}
2 changes: 1 addition & 1 deletion src/librustc_mir/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ https://doc.rust-lang.org/std/cell/
"##,

E0388: r##"
E0388 was removed and is no longer issued.
#### Note: this error code is no longer emitted by the compiler.
"##,

E0389: r##"
Expand Down
25 changes: 21 additions & 4 deletions src/librustc_passes/error_codes.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
syntax::register_diagnostics! {
/*
E0014: r##"
#### Note: this error code is no longer emitted by the compiler.
Constants can only be initialized by a constant value or, in a future
version of Rust, a call to a const function. This error indicates the use
of a path (like a::b, or x) denoting something other than one of these
allowed items. Erroneous code xample:
allowed items.
```compile_fail
Erroneous code example:
```
const FOO: i32 = { let x = 0; x }; // 'x' isn't a constant nor a function!
```
Expand All @@ -18,10 +21,10 @@ const FOO: i32 = { const X : i32 = 0; X };
const FOO2: i32 = { 0 }; // but brackets are useless here
```
"##,
*/

E0130: r##"
You declared a pattern as an argument in a foreign function declaration.
Erroneous code example:
```compile_fail
Expand Down Expand Up @@ -57,6 +60,20 @@ extern {
E0136: r##"
A binary can only have one entry point, and by default that entry point is the
function `main()`. If there are multiple such functions, please rename one.
Erroneous code example:
```compile_fail,E0136
fn main() {
// ...
}
// ...
fn main() { // error!
// ...
}
```
"##,

E0137: r##"
Expand Down
23 changes: 17 additions & 6 deletions src/librustc_privacy/error_codes.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
syntax::register_diagnostics! {

E0445: r##"
A private trait was used on a public type parameter bound. Erroneous code
examples:
A private trait was used on a public type parameter bound.
Erroneous code examples:
```compile_fail,E0445
#![deny(private_in_public)]
Expand Down Expand Up @@ -32,7 +33,9 @@ pub fn foo<T: Foo> (t: T) {} // ok!
"##,

E0446: r##"
A private type was used in a public type signature. Erroneous code example:
A private type was used in a public type signature.
Erroneous code example:
```compile_fail,E0446
#![deny(private_in_public)]
Expand Down Expand Up @@ -65,7 +68,9 @@ mod Foo {
E0447: r##"
#### Note: this error code is no longer emitted by the compiler.
The `pub` keyword was used inside a function. Erroneous code example:
The `pub` keyword was used inside a function.
Erroneous code example:
```
fn foo() {
Expand All @@ -79,7 +84,11 @@ is invalid.
"##,

E0448: r##"
The `pub` keyword was used inside a public enum. Erroneous code example:
#### Note: this error code is no longer emitted by the compiler.
The `pub` keyword was used inside a public enum.
Erroneous code example:
```compile_fail
pub enum Foo {
Expand All @@ -106,7 +115,9 @@ pub enum Foo {
"##,

E0451: r##"
A struct constructor with private fields was invoked. Erroneous code example:
A struct constructor with private fields was invoked.
Erroneous code example:
```compile_fail,E0451
mod Bar {
Expand Down
32 changes: 15 additions & 17 deletions src/librustc_typeck/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1873,13 +1873,14 @@ This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (this
differs from the behavior for `&T`, which is always `Copy`).
"##,

/*
E0205: r##"
#### Note: this error code is no longer emitted by the compiler.
An attempt to implement the `Copy` trait for an enum failed because one of the
variants does not implement `Copy`. To fix this, you must implement `Copy` for
the mentioned variant. Note that this may not be possible, as in the example of
```compile_fail,E0205
```compile_fail,E0204
enum Foo {
Bar(Vec<u32>),
Baz,
Expand All @@ -1892,7 +1893,7 @@ This fails because `Vec<T>` does not implement `Copy` for any `T`.
Here's another example that will fail:
```compile_fail,E0205
```compile_fail,E0204
#[derive(Copy)]
enum Foo<'a> {
Bar(&'a mut bool),
Expand All @@ -1903,7 +1904,6 @@ enum Foo<'a> {
This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (this
differs from the behavior for `&T`, which is always `Copy`).
"##,
*/

E0206: r##"
You can only implement `Copy` for a struct or enum. Both of the following
Expand Down Expand Up @@ -2126,8 +2126,9 @@ For information on the design of the orphan rules, see [RFC 1023].
[RFC 1023]: https://github.com/rust-lang/rfcs/blob/master/text/1023-rebalancing-coherence.md
"##,

/*
E0211: r##"
#### Note: this error code is no longer emitted by the compiler.
You used a function or type which doesn't fit the requirements for where it was
used. Erroneous code examples:
Expand Down Expand Up @@ -2174,7 +2175,7 @@ extern "rust-intrinsic" {
}
```
The second case example is a bit particular : the main function must always
The second case example is a bit particular: the main function must always
have this definition:
```compile_fail
Expand Down Expand Up @@ -2206,7 +2207,6 @@ impl Foo {
}
```
"##,
*/

E0220: r##"
You used an associated type which isn't defined in the trait.
Expand Down Expand Up @@ -2727,14 +2727,9 @@ impl<T, U> CoerceUnsized<MyType<U>> for MyType<T>
[`CoerceUnsized`]: https://doc.rust-lang.org/std/ops/trait.CoerceUnsized.html
"##,

/*
// Associated consts can now be accessed through generic type parameters, and
// this error is no longer emitted.
//
// FIXME: consider whether to leave it in the error index, or remove it entirely
// as associated consts is not stabilized yet.
E0329: r##"
#### Note: this error code is no longer emitted by the compiler.
An attempt was made to access an associated constant through either a generic
type parameter or `Self`. This is not supported yet. An example causing this
error is shown below:
Expand Down Expand Up @@ -2765,12 +2760,15 @@ trait Foo {
struct MyStruct;
impl Foo for MyStruct {
const BAR: f64 = 0f64;
}
fn get_bar_good() -> f64 {
<MyStruct as Foo>::BAR
}
```
"##,
*/

E0366: r##"
An attempt was made to implement `Drop` on a concrete specialization of a
Expand Down Expand Up @@ -4973,7 +4971,7 @@ and the pin is required to keep it in the same place in memory.
// between structures with the same definition
// E0558, // replaced with a generic attribute input check
// E0563, // cannot determine a type for this `impl Trait` removed in 6383de15
E0564, // only named lifetimes are allowed in `impl Trait`,
// E0564, // only named lifetimes are allowed in `impl Trait`,
// but `{}` was found in the type `{}`
E0587, // type has conflicting packed and align representation hints
E0588, // packed type cannot transitively contain a `[repr(align)]` type
Expand All @@ -4986,7 +4984,7 @@ and the pin is required to keep it in the same place in memory.
E0634, // type has conflicting packed representaton hints
E0640, // infer outlives requirements
E0641, // cannot cast to/from a pointer with an unknown kind
E0645, // trait aliases not finished
// E0645, // trait aliases not finished
E0719, // duplicate values for associated type binding
E0722, // Malformed `#[optimize]` attribute
E0724, // `#[ffi_returns_twice]` is only allowed in foreign functions
Expand Down
Loading

0 comments on commit ecd6229

Please sign in to comment.