Skip to content

Commit

Permalink
Rollup merge of rust-lang#66900 - GuillaumeGomez:clean-up-err-codes, …
Browse files Browse the repository at this point in the history
…r=Dylan-DPC

Clean up error codes

r? @Dylan-DPC
  • Loading branch information
JohnTitor committed Dec 5, 2019
2 parents d4b923a + c911bb1 commit 0559618
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/librustc_error_codes/error_codes/E0092.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
You tried to declare an undefined atomic operation function.
An undefined atomic operation function was declared.

Erroneous code example:

```compile_fail,E0092
Expand All @@ -11,8 +12,8 @@ extern "rust-intrinsic" {
```

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

```
#![feature(intrinsics)]
Expand Down
8 changes: 5 additions & 3 deletions src/librustc_error_codes/error_codes/E0093.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
You declared an unknown intrinsic function. Erroneous code example:
An unknown intrinsic function was declared.

Erroneous code example:

```compile_fail,E0093
#![feature(intrinsics)]
Expand All @@ -15,8 +17,8 @@ fn main() {
```

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

```
#![feature(intrinsics)]
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_error_codes/error_codes/E0094.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
You gave an invalid number of type parameters to an intrinsic function.
An invalid number of type parameters was given to an intrinsic function.

Erroneous code example:

```compile_fail,E0094
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_error_codes/error_codes/E0106.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This error indicates that a lifetime is missing from a type. If it is an error
inside a function signature, the problem may be with failing to adhere to the
lifetime elision rules (see below).

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

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

The lifetime elision rules require that any function signature with an elided
output lifetime must either have
output lifetime must either have:

- exactly one input lifetime
- or, multiple input lifetimes, but the function must also be a method with a
Expand Down
23 changes: 20 additions & 3 deletions src/librustc_error_codes/error_codes/E0107.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
This error means that an incorrect number of generic arguments were provided:
An incorrect number of generic arguments were provided.

Erroneous code example:

```compile_fail,E0107
struct Foo<T> { x: T }
Expand All @@ -9,19 +11,34 @@ struct Baz<S, T> { x: Foo<S, T> } // error: wrong number of type arguments:
// expected 1, found 2
fn foo<T, U>(x: T, y: U) {}
fn f() {}
fn main() {
let x: bool = true;
foo::<bool>(x); // error: wrong number of type arguments:
// expected 2, found 1
foo::<bool, i32, i32>(x, 2, 4); // error: wrong number of type arguments:
// expected 2, found 3
f::<'static>(); // error: wrong number of lifetime arguments
// expected 0, found 1
}
```

When using/declaring an item with generic arguments, you must provide the exact
same number:

```
struct Foo<T> { x: T }
struct Bar<T> { x: Foo<T> } // ok!
struct Baz<S, T> { x: Foo<S>, y: Foo<T> } // ok!
fn foo<T, U>(x: T, y: U) {}
fn f() {}
fn main() {
f::<'static>(); // error: wrong number of lifetime arguments:
// expected 0, found 1
let x: bool = true;
foo::<bool, u32>(x, 12); // ok!
f(); // ok!
}
```

0 comments on commit 0559618

Please sign in to comment.