Skip to content

ICE: no def-id for fresh lifetime #126850

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn bug<T>() -> impl Iterator<
    Item = [(); {
               |found: &String| Some(false);
               4
           }],
> {
    std::iter::empty()
}

fn main() {}

original:

#![allow(unused_must_use)]
fn bug<T>() -> impl Iterator<Item = [(); { |found: &String| Some(false); 4 }]> {
    std::iter::empty()
}

fn ok<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> {
    Box::new(std::iter::empty())
}

fn main() {
    for _item in ok::<u32>() {}
    for _item in bug::<u32>() {}
}

Version information

rustc 1.81.0-nightly (acb62737a 2024-06-23)
binary: rustc
commit-hash: acb62737aca7045f331e7a05adc38bed213e278d
commit-date: 2024-06-23
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zincremental-verify-ich=yes -Cincremental=<dir> -Cdebuginfo=2

Program output

warning: unused variable: `found`
 --> /tmp/icemaker_global_tempdir.fh96CiIOsxK3/rustc_testrunner_tmpdir_reporting.U9ifJLvY9ftQ/mvce.rs:3:17
  |
3 |                |found: &String| Some(false);
  |                 ^^^^^ help: if this is intentional, prefix it with an underscore: `_found`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: function `bug` is never used
 --> /tmp/icemaker_global_tempdir.fh96CiIOsxK3/rustc_testrunner_tmpdir_reporting.U9ifJLvY9ftQ/mvce.rs:1:4
  |
1 | fn bug<T>() -> impl Iterator<
  |    ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: unused closure that must be used
 --> /tmp/icemaker_global_tempdir.fh96CiIOsxK3/rustc_testrunner_tmpdir_reporting.U9ifJLvY9ftQ/mvce.rs:3:16
  |
3 |                |found: &String| Some(false);
  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: closures are lazy and do nothing unless called
  = note: `#[warn(unused_must_use)]` on by default

warning: 3 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: no def-id for fresh lifetime
 --> /tmp/icemaker_global_tempdir.fh96CiIOsxK3/rustc_testrunner_tmpdir_reporting.U9ifJLvY9ftQ/mvce.rs:3:24
  |
3 |                |found: &String| Some(false);
  |                        ^^^^^^^
  |
note: delayed at compiler/rustc_ast_lowering/src/lib.rs:1650:30 - disabled backtrace
 --> /tmp/icemaker_global_tempdir.fh96CiIOsxK3/rustc_testrunner_tmpdir_reporting.U9ifJLvY9ftQ/mvce.rs:3:24
  |
3 |                |found: &String| Some(false);
  |                        ^^^^^^^

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.81.0-nightly (acb62737a 2024-06-23) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z incremental-verify-ich=yes -C incremental=[REDACTED] -C debuginfo=2

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.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

    Issue actions