Internal compiler error instead of a reminder that pattern-matching in loops uses while let
or a note that some variable identifiers are ambiguous
#112385
Labels
C-bug
Category: This is a bug.
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.
Code
The minified example below contains two errors that were present in the original code triggering this error:
let item = ();
line was meant to have a different identifier for the variable to which the item was assigned, and it created the ambiguity that resulted in the ICE.while let
pattern matching loop is missing alet
.Removing either of these errors stops the ICE from appearing.
I am not sure if the fact that this code is erroneous invalidates the ICE, but I would still like to try reporting it.
Meta
rustc --version --verbose
:The issue is also reproducible in the Rust playground, on both stable and nightly.
Error output
Of note: among the internal compiler errors, the compiler did in fact suggest the correct thing to do: adding
let
to turn the erroring line into a correctwhile let Some(...) = ... {}
loop. However, it is buried in the middle of a huge backtrace, and so I only noticed it when I started reading it properly.The output didn't seem to change on setting
RUST_BACKTRACE=1
. What follows is a version of the output with the gory stuff elided. The full output is present in the Backtrace section.Backtrace
The text was updated successfully, but these errors were encountered: