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

ICE in the face of malformed code #127981

Closed
estebank opened this issue Jul 19, 2024 · 2 comments
Closed

ICE in the face of malformed code #127981

estebank opened this issue Jul 19, 2024 · 2 comments
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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.

Comments

@estebank
Copy link
Contributor

Code

fn enum_upvar() {
    type T = impl Copy;
    let foo: T = Some((1u32, 2u32));
    let x = move || {
        match foo {
            None => (),
            Some(yield) => (),
        }
    };
}

fn main() {}

Meta

rustc --version --verbose:

rustc version: 1.81.0-nightly (5affbb171 2024-07-18)
platform: x86_64-unknown-linux-gnu

Error output

error: expected identifier, found reserved keyword `yield`
 --> f94.rs:7:18
  |
7 |             Some(yield) => (),
  |                  ^^^^^ expected identifier, found reserved keyword
  |
help: escape `yield` to use it as an identifier
  |
7 |             Some(r#yield) => (),
  |                  ++

error[E0658]: `impl Trait` in type aliases is unstable
 --> f94.rs:2:14
  |
2 |     type T = impl Copy;
  |              ^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable
  = note: this compiler was built on 2024-07-18; consider upgrading it if it is out of date

warning: unused variable: `x`
 --> f94.rs:4:9
  |
4 |     let x = move || {
  |         ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

thread 'rustc' panicked at compiler/rustc_mir_build/src/build/matches/mod.rs:1819:44:
called `Option::unwrap()` on a `None` value

// Unwrap is ok after simplification.
let match_place = match_pair.place.unwrap();

Backtrace attached

rustc-ice-2024-07-19T17_25_21-3933070.txt

@estebank estebank added 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. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. labels Jul 19, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 19, 2024
@estebank
Copy link
Contributor Author

cc @Nadrieril

@matthiaskrgr
Copy link
Member

duplicate of #119786

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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.
Projects
None yet
Development

No branches or pull requests

4 participants