Change:
I'm seeing an internal compiler error on the following input (found by ): Caused by this line introduced in I found a similar issue in the past, this pull request fixes it: Unfortunately, this one looks like a spurious failure. It can be reproduced in the playground using nightly 2022-04-18, but when I try it locally using the same nightly version there is no ICE. This is the error message: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Is this still reproducible? I didn't get the ICE, maybe theres some extra flags needed?
The playground seems to reliably reproduce it. And I can reproduce it sometimes using : But that is not always reliable. Given that the error message is "SourceNotAvailable", I guess this is related to how the toolchain is installed (the rust-src component?). Because at one point I tried the latest nightly with cargo-bisect-rustc and it did not ICE, but some days later I tried the same nightly using the same command and it did ICE. But I would just assume that while there is an in the code this issue is not fixed.
I'm currently using rustc 1.62.0-nightly ( 2022-04-25) and from the 10 times I tried executing the code, all of them generated an ICE.
I think I see this issue too. I also had to go back to 2022-04-18 to be able to compile my code.
I opened a pull request with a one line change that may fix this, but I have no way to reproduce it locally (compiling the example code works fine even without the changes of that pull request). The playground can still reproduce the issue as of nightly 2022-04-29, so we can use it to check if this issue is really fixed after that pull request is merged.
So I accidentally closed this issue by adding the words "may to the pull request description, but fortunately it looks fixed, as you can see thanks to the glacier bot.

Discussion:
); for (idx, arg) in matched_inputs.iter().enumerate() { let suggestion_text = if let Some(arg) = arg { <del> let arg_span = provided_args[*arg].span; </del> <ins> let arg_span = provided_args[*arg].span.source_callsite(); </ins> let arg_text = source_map.span_to_snippet(arg_span).unwrap(); arg_text } else {

<ins> // run-rustfix // Check that the HELP suggestion is `l(vec![])` instead of `l($crate::vec::Vec::new())` fn l(_a: Vec<u8>) {} fn main() { l(vec![]) //~^ ERROR this function takes 1 argument but 2 arguments were supplied //~| HELP remove the extra argument } </ins>

<ins> // run-rustfix // Check that the HELP suggestion is `l(vec![])` instead of `l($crate::vec::Vec::new())` fn l(_a: Vec<u8>) {} fn main() { l(vec![], vec![]) //~^ ERROR this function takes 1 argument but 2 arguments were supplied //~| HELP remove the extra argument } </ins>

<ins> error[E0061]: this function takes 1 argument but 2 arguments were supplied --> $DIR/remove-extra-argument.rs:6:5 | LL |     l(vec![], vec![]) |     ^         ------ argument unexpected | note: function defined here --> $DIR/remove-extra-argument.rs:3:4 | LL | fn l(_a: Vec<u8>) {} |    ^ ----------- help: remove the extra argument | LL |     l(vec![]) | error: aborting due to previous error For more information about this error, try `rustc --explain E0061`. </ins>