Skip to content

ICE: no def-id for fresh lifetime #126850

@matthiaskrgr

Description

@matthiaskrgr
Member

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

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.
C-bugCategory: This is a bug.
on Jun 23, 2024
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jun 23, 2024
matthiaskrgr

matthiaskrgr commented on Jun 23, 2024

@matthiaskrgr
MemberAuthor

Regression in nightly-2023-08-07

commit[0] 2023-08-05: Auto merge of #111200 - a1phyr:spec_sized_iterators, r=the8472
commit[1] 2023-08-06: Auto merge of #114476 - Urgau:missing-dep-file-112898, r=oli-obk
commit[2] 2023-08-06: Auto merge of #114526 - matthiaskrgr:rollup-zz041wi, r=matthiaskrgr
commit[3] 2023-08-06: Auto merge of #114528 - dtolnay:globalalloccast, r=cjgillot
commit[4] 2023-08-06: Auto merge of #114487 - compiler-errors:opaques-refactoring-idk, r=cjgillot
commit[5] 2023-08-06: Auto merge of #113648 - aliemjay:opaque-binder-ice, r=oli-obk
commit[6] 2023-08-06: Auto merge of #114516 - cjgillot:direct-module-parent, r=compiler-errors
commit[7] 2023-08-06: Auto merge of #114553 - matthiaskrgr:rollup-5yddunv, r=matthiaskrgr
commit[8] 2023-08-06: Auto merge of #114502 - cjgillot:steal-ctfe, r=oli-obk

removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jun 23, 2024
added
S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.
on Jun 30, 2024
added a commit that references this issue on Oct 30, 2024
6b60f03
added a commit that references this issue on Oct 31, 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

    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

      Participants

      @matthiaskrgr@saethlin@rustbot

      Issue actions

        ICE: `no def-id for fresh lifetime` · Issue #126850 · rust-lang/rust