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

Necromancing 2 (putting back some removed error codes explanations) #66867

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ E0029: include_str!("./error_codes/E0029.md"),
E0030: include_str!("./error_codes/E0030.md"),
E0033: include_str!("./error_codes/E0033.md"),
E0034: include_str!("./error_codes/E0034.md"),
E0036: include_str!("./error_codes/E0036.md"),
E0038: include_str!("./error_codes/E0038.md"),
E0040: include_str!("./error_codes/E0040.md"),
E0044: include_str!("./error_codes/E0044.md"),
Expand Down Expand Up @@ -414,7 +415,6 @@ E0745: include_str!("./error_codes/E0745.md"),
// E0006, // merged with E0005
// E0008, // cannot bind by-move into a pattern guard
// E0035, merged into E0087/E0089
// E0036, merged into E0087/E0089
// E0068,
// E0085,
// E0086,
Expand Down
40 changes: 40 additions & 0 deletions src/librustc_error_codes/error_codes/E0036.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#### Note: this error code is no longer emitted by the compiler.

This error occurrs when you pass too many or not enough type parameters to
a method. Erroneous code example:

```compile_fail,E0107
struct Test;
impl Test {
fn method<T>(&self, v: &[T]) -> usize {
v.len()
}
}
fn main() {
let x = Test;
let v = &[0];
x.method::<i32, i32>(v); // error: only one type parameter is expected!
}
```

To fix it, just specify a correct number of type parameters:

```
struct Test;
impl Test {
fn method<T>(&self, v: &[T]) -> usize {
v.len()
}
}
fn main() {
let x = Test;
let v = &[0];
x.method::<i32>(v); // OK, we're good!
}
```

Please note on the last example that we could have called `method` like this:

```text
x.method(v);
```
9 changes: 9 additions & 0 deletions src/librustc_error_codes/error_codes/E0066.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#### Note: this error code is no longer emitted by the compiler.

Box placement expressions (like C++'s "placement new") do not yet support any
place expression except the exchange heap (i.e. `std::boxed::HEAP`).
Furthermore, the syntax is changing to use `in` instead of `box`. See [RFC 470]
and [RFC 809] for more details.

[RFC 470]: https://github.com/rust-lang/rfcs/pull/470
[RFC 809]: https://github.com/rust-lang/rfcs/pull/809