debug ice: E0061 with several fn arguments where 0 are expected #108249
Closed
Description
Code
This triggers a debug assertion due to bad spans when more than one input is given to a function that expects none.
fn main() {
Vec::new(0, 1);
}
without debug assertions, this results in
error[E0061]: this function takes 0 arguments but 2 arguments were supplied
--> extern-prelude.rs:2:2
|
2 | Vec::new(0, 1);
| ^^^^^^^^ - - unexpected argument of type `{integer}`
| |
| unexpected argument of type `{integer}`
|
note: associated function defined here
--> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:424:18
|
424 | pub const fn new() -> Self {
| ^^^
help: remove the extra arguments
|
2 - Vec::new(0, 1);
2 + Vec::new();
I think under the hood rustc might try to generate empty spans for within the ()
where it suggests to remove the fn args..? Just a wild guess though 🤔
Meta
rustc --version --verbose
:
eebdfb55fce148676c24555505aebf648123b2de
Error output
error[E0061]: this function takes 0 arguments but 2 arguments were supplied
--> extern-prelude.rs:2:2
|
2 | Vec::new(0, 1);
| ^^^^^^^^ - - unexpected argument of type `{integer}`
| |
| unexpected argument of type `{integer}`
|
note: associated function defined here
--> /home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:424:18
|
424 | pub const fn new() -> Self {
| ^^^
help: remove the extra arguments
|
2 - Vec::new(0, 1);
2 + Vec::new();
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0061`
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a build of rustc or tooling with debug-assertions in some way
Activity