Skip to content

Commit 02f5dab

Browse files
authored
Rollup merge of rust-lang#66900 - GuillaumeGomez:clean-up-err-codes, r=Dylan-DPC
Clean up error codes r? @Dylan-DPC
2 parents 8d676bc + c911bb1 commit 02f5dab

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

src/librustc_error_codes/error_codes/E0092.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
You tried to declare an undefined atomic operation function.
1+
An undefined atomic operation function was declared.
2+
23
Erroneous code example:
34

45
```compile_fail,E0092
@@ -11,8 +12,8 @@ extern "rust-intrinsic" {
1112
```
1213

1314
Please check you didn't make a mistake in the function's name. All intrinsic
14-
functions are defined in librustc_codegen_llvm/intrinsic.rs and in
15-
libcore/intrinsics.rs in the Rust source code. Example:
15+
functions are defined in `librustc_codegen_llvm/intrinsic.rs` and in
16+
`libcore/intrinsics.rs` in the Rust source code. Example:
1617

1718
```
1819
#![feature(intrinsics)]

src/librustc_error_codes/error_codes/E0093.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
You declared an unknown intrinsic function. Erroneous code example:
1+
An unknown intrinsic function was declared.
2+
3+
Erroneous code example:
24

35
```compile_fail,E0093
46
#![feature(intrinsics)]
@@ -15,8 +17,8 @@ fn main() {
1517
```
1618

1719
Please check you didn't make a mistake in the function's name. All intrinsic
18-
functions are defined in librustc_codegen_llvm/intrinsic.rs and in
19-
libcore/intrinsics.rs in the Rust source code. Example:
20+
functions are defined in `librustc_codegen_llvm/intrinsic.rs` and in
21+
`libcore/intrinsics.rs` in the Rust source code. Example:
2022

2123
```
2224
#![feature(intrinsics)]

src/librustc_error_codes/error_codes/E0094.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
You gave an invalid number of type parameters to an intrinsic function.
1+
An invalid number of type parameters was given to an intrinsic function.
2+
23
Erroneous code example:
34

45
```compile_fail,E0094

src/librustc_error_codes/error_codes/E0106.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ This error indicates that a lifetime is missing from a type. If it is an error
22
inside a function signature, the problem may be with failing to adhere to the
33
lifetime elision rules (see below).
44

5-
Here are some simple examples of where you'll run into this error:
5+
Erroneous code examples:
66

77
```compile_fail,E0106
88
struct Foo1 { x: &bool }
@@ -27,7 +27,7 @@ function signatures which allows you to leave out lifetimes in certain cases.
2727
For more background on lifetime elision see [the book][book-le].
2828

2929
The lifetime elision rules require that any function signature with an elided
30-
output lifetime must either have
30+
output lifetime must either have:
3131

3232
- exactly one input lifetime
3333
- or, multiple input lifetimes, but the function must also be a method with a
Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
This error means that an incorrect number of generic arguments were provided:
1+
An incorrect number of generic arguments were provided.
2+
3+
Erroneous code example:
24

35
```compile_fail,E0107
46
struct Foo<T> { x: T }
@@ -9,19 +11,34 @@ struct Baz<S, T> { x: Foo<S, T> } // error: wrong number of type arguments:
911
// expected 1, found 2
1012
1113
fn foo<T, U>(x: T, y: U) {}
14+
fn f() {}
1215
1316
fn main() {
1417
let x: bool = true;
1518
foo::<bool>(x); // error: wrong number of type arguments:
1619
// expected 2, found 1
1720
foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments:
1821
// expected 2, found 3
22+
f::<'static>(); // error: wrong number of lifetime arguments
23+
// expected 0, found 1
1924
}
25+
```
26+
27+
When using/declaring an item with generic arguments, you must provide the exact
28+
same number:
29+
30+
```
31+
struct Foo<T> { x: T }
32+
33+
struct Bar<T> { x: Foo<T> } // ok!
34+
struct Baz<S, T> { x: Foo<S>, y: Foo<T> } // ok!
2035
36+
fn foo<T, U>(x: T, y: U) {}
2137
fn f() {}
2238
2339
fn main() {
24-
f::<'static>(); // error: wrong number of lifetime arguments:
25-
// expected 0, found 1
40+
let x: bool = true;
41+
foo::<bool, u32>(x, 12); // ok!
42+
f(); // ok!
2643
}
2744
```

0 commit comments

Comments
 (0)