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

debug ice: E0061 with several fn arguments where 0 are expected #108249

Closed
matthiaskrgr opened this issue Feb 19, 2023 · 3 comments
Closed

debug ice: E0061 with several fn arguments where 0 are expected #108249

matthiaskrgr opened this issue Feb 19, 2023 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

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`

ice.log

@matthiaskrgr matthiaskrgr added A-diagnostics Area: Messages for errors, warnings, and lints I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way labels Feb 19, 2023
@matthiaskrgr
Copy link
Member Author

I wonder if this is a duplicate of #108242 but I couldn't reproduce this with just one argument here, hm

@compiler-errors
Copy link
Member

I think this is a duplicate of #108225?

@matthiaskrgr
Copy link
Member Author

Ah I thought this was already fixed 😅
Probably only saw the pr...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-debug-assertions This issue requires a build of rustc or tooling with debug-assertions in some way S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants