Skip to content

ICE in the face of malformed code #127981

Closed
Closed
@estebank

Description

@estebank
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

Activity

added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
C-bugCategory: This is a bug.
on Jul 19, 2024
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jul 19, 2024
estebank

estebank commented on Jul 19, 2024

@estebank
ContributorAuthor
matthiaskrgr

matthiaskrgr commented on Jul 19, 2024

@matthiaskrgr
Member

duplicate of #119786

removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @matthiaskrgr@estebank@saethlin@rustbot

        Issue actions

          ICE in the face of malformed code · Issue #127981 · rust-lang/rust