rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.33k stars 12.58k forks source link

ICE: `no def-id for fresh lifetime` #126850

Open matthiaskrgr opened 3 months ago

matthiaskrgr commented 3 months ago

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() -> 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 ```

matthiaskrgr commented 3 months ago

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