Skip to content

Commit 7a84158

Browse files
Fix/improve some error codes long explanation
1 parent 2a624c2 commit 7a84158

File tree

6 files changed

+66
-36
lines changed

6 files changed

+66
-36
lines changed

src/librustc/error_codes.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ fn main() {
466466
```
467467
"##,
468468

469-
470469
E0139: r##"
471470
#### Note: this error code is no longer emitted by the compiler.
472471
@@ -1521,7 +1520,9 @@ where
15211520
"##,
15221521

15231522
E0496: r##"
1524-
A lifetime name is shadowing another lifetime name. Erroneous code example:
1523+
A lifetime name is shadowing another lifetime name.
1524+
1525+
Erroneous code example:
15251526
15261527
```compile_fail,E0496
15271528
struct Foo<'a> {
@@ -1553,8 +1554,11 @@ fn main() {
15531554
"##,
15541555

15551556
E0497: r##"
1556-
A stability attribute was used outside of the standard library. Erroneous code
1557-
example:
1557+
#### Note: this error code is no longer emitted by the compiler.
1558+
1559+
A stability attribute was used outside of the standard library.
1560+
1561+
Erroneous code example:
15581562
15591563
```compile_fail
15601564
#[stable] // error: stability attributes may not be used outside of the
@@ -2063,7 +2067,7 @@ rejected in your own crates.
20632067
// E0272, // on_unimplemented #0
20642068
// E0273, // on_unimplemented #1
20652069
// E0274, // on_unimplemented #2
2066-
E0278, // requirement is not satisfied
2070+
// E0278, // requirement is not satisfied
20672071
E0279, // requirement is not satisfied
20682072
E0280, // requirement is not satisfied
20692073
// E0285, // overflow evaluation builtin bounds
@@ -2106,10 +2110,10 @@ rejected in your own crates.
21062110
E0687, // in-band lifetimes cannot be used in `fn`/`Fn` syntax
21072111
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
21082112
E0697, // closures cannot be static
2109-
E0707, // multiple elided lifetimes used in arguments of `async fn`
2113+
// E0707, // multiple elided lifetimes used in arguments of `async fn`
21102114
E0708, // `async` non-`move` closures with parameters are not currently
21112115
// supported
2112-
E0709, // multiple different lifetimes used in arguments of `async fn`
2116+
// E0709, // multiple different lifetimes used in arguments of `async fn`
21132117
E0710, // an unknown tool name found in scoped lint
21142118
E0711, // a feature has been declared with conflicting stability attributes
21152119
// E0702, // replaced with a generic attribute input check

src/librustc_lint/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
syntax::register_diagnostics! {
22
;
3-
E0721, // `await` keyword
3+
// E0721, // `await` keyword
44
}

src/librustc_mir/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ https://doc.rust-lang.org/std/cell/
953953
"##,
954954

955955
E0388: r##"
956-
E0388 was removed and is no longer issued.
956+
#### Note: this error code is no longer emitted by the compiler.
957957
"##,
958958

959959
E0389: r##"

src/librustc_passes/error_codes.rs

+21-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
syntax::register_diagnostics! {
2-
/*
32
E0014: r##"
3+
#### Note: this error code is no longer emitted by the compiler.
4+
45
Constants can only be initialized by a constant value or, in a future
56
version of Rust, a call to a const function. This error indicates the use
67
of a path (like a::b, or x) denoting something other than one of these
7-
allowed items. Erroneous code xample:
8+
allowed items.
89
9-
```compile_fail
10+
Erroneous code example:
11+
12+
```
1013
const FOO: i32 = { let x = 0; x }; // 'x' isn't a constant nor a function!
1114
```
1215
@@ -18,10 +21,10 @@ const FOO: i32 = { const X : i32 = 0; X };
1821
const FOO2: i32 = { 0 }; // but brackets are useless here
1922
```
2023
"##,
21-
*/
2224

2325
E0130: r##"
2426
You declared a pattern as an argument in a foreign function declaration.
27+
2528
Erroneous code example:
2629
2730
```compile_fail
@@ -57,6 +60,20 @@ extern {
5760
E0136: r##"
5861
A binary can only have one entry point, and by default that entry point is the
5962
function `main()`. If there are multiple such functions, please rename one.
63+
64+
Erroneous code example:
65+
66+
```compile_fail,E0136
67+
fn main() {
68+
// ...
69+
}
70+
71+
// ...
72+
73+
fn main() { // error!
74+
// ...
75+
}
76+
```
6077
"##,
6178

6279
E0137: r##"

src/librustc_privacy/error_codes.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
syntax::register_diagnostics! {
22

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

3435
E0446: r##"
35-
A private type was used in a public type signature. Erroneous code example:
36+
A private type was used in a public type signature.
37+
38+
Erroneous code example:
3639
3740
```compile_fail,E0446
3841
#![deny(private_in_public)]
@@ -65,7 +68,9 @@ mod Foo {
6568
E0447: r##"
6669
#### Note: this error code is no longer emitted by the compiler.
6770
68-
The `pub` keyword was used inside a function. Erroneous code example:
71+
The `pub` keyword was used inside a function.
72+
73+
Erroneous code example:
6974
7075
```
7176
fn foo() {
@@ -79,7 +84,11 @@ is invalid.
7984
"##,
8085

8186
E0448: r##"
82-
The `pub` keyword was used inside a public enum. Erroneous code example:
87+
#### Note: this error code is no longer emitted by the compiler.
88+
89+
The `pub` keyword was used inside a public enum.
90+
91+
Erroneous code example:
8392
8493
```compile_fail
8594
pub enum Foo {
@@ -106,7 +115,9 @@ pub enum Foo {
106115
"##,
107116

108117
E0451: r##"
109-
A struct constructor with private fields was invoked. Erroneous code example:
118+
A struct constructor with private fields was invoked.
119+
120+
Erroneous code example:
110121
111122
```compile_fail,E0451
112123
mod Bar {

src/librustc_typeck/error_codes.rs

+15-17
Original file line numberDiff line numberDiff line change
@@ -1873,13 +1873,14 @@ This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (this
18731873
differs from the behavior for `&T`, which is always `Copy`).
18741874
"##,
18751875

1876-
/*
18771876
E0205: r##"
1877+
#### Note: this error code is no longer emitted by the compiler.
1878+
18781879
An attempt to implement the `Copy` trait for an enum failed because one of the
18791880
variants does not implement `Copy`. To fix this, you must implement `Copy` for
18801881
the mentioned variant. Note that this may not be possible, as in the example of
18811882
1882-
```compile_fail,E0205
1883+
```compile_fail,E0204
18831884
enum Foo {
18841885
Bar(Vec<u32>),
18851886
Baz,
@@ -1892,7 +1893,7 @@ This fails because `Vec<T>` does not implement `Copy` for any `T`.
18921893
18931894
Here's another example that will fail:
18941895
1895-
```compile_fail,E0205
1896+
```compile_fail,E0204
18961897
#[derive(Copy)]
18971898
enum Foo<'a> {
18981899
Bar(&'a mut bool),
@@ -1903,7 +1904,6 @@ enum Foo<'a> {
19031904
This fails because `&mut T` is not `Copy`, even when `T` is `Copy` (this
19041905
differs from the behavior for `&T`, which is always `Copy`).
19051906
"##,
1906-
*/
19071907

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

2129-
/*
21302129
E0211: r##"
2130+
#### Note: this error code is no longer emitted by the compiler.
2131+
21312132
You used a function or type which doesn't fit the requirements for where it was
21322133
used. Erroneous code examples:
21332134
@@ -2174,7 +2175,7 @@ extern "rust-intrinsic" {
21742175
}
21752176
```
21762177
2177-
The second case example is a bit particular : the main function must always
2178+
The second case example is a bit particular: the main function must always
21782179
have this definition:
21792180
21802181
```compile_fail
@@ -2206,7 +2207,6 @@ impl Foo {
22062207
}
22072208
```
22082209
"##,
2209-
*/
22102210

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

2730-
/*
2731-
// Associated consts can now be accessed through generic type parameters, and
2732-
// this error is no longer emitted.
2733-
//
2734-
// FIXME: consider whether to leave it in the error index, or remove it entirely
2735-
// as associated consts is not stabilized yet.
2736-
27372730
E0329: r##"
2731+
#### Note: this error code is no longer emitted by the compiler.
2732+
27382733
An attempt was made to access an associated constant through either a generic
27392734
type parameter or `Self`. This is not supported yet. An example causing this
27402735
error is shown below:
@@ -2765,12 +2760,15 @@ trait Foo {
27652760
27662761
struct MyStruct;
27672762
2763+
impl Foo for MyStruct {
2764+
const BAR: f64 = 0f64;
2765+
}
2766+
27682767
fn get_bar_good() -> f64 {
27692768
<MyStruct as Foo>::BAR
27702769
}
27712770
```
27722771
"##,
2773-
*/
27742772

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

0 commit comments

Comments
 (0)