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: no def-id for fresh lifetime #126850

Closed
matthiaskrgr opened this issue Jun 23, 2024 · 1 comment · Fixed by #129383
Closed

ICE: no def-id for fresh lifetime #126850

matthiaskrgr opened this issue Jun 23, 2024 · 1 comment · Fixed by #129383
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
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

@matthiaskrgr matthiaskrgr 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. C-bug Category: This is a bug. labels Jun 23, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 23, 2024
@matthiaskrgr
Copy link
Member Author

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

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 23, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Jun 30, 2024
@bors bors closed this as completed in 6b60f03 Oct 31, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 31, 2024
Rollup merge of rust-lang#129383 - cjgillot:opaque-noremap, r=compiler-errors,petrochenkov

Remap impl-trait lifetimes on HIR instead of AST lowering

Current AST->HIR lowering goes out of its way to remap lifetimes for opaque types. This is complicated and leaks into upstream and downstream code.

This PR stops trying to be clever during lowering, and prefers to do this remapping during the HIR->ty lowering. The remapping computation easily fits into the bound var resolution code. Its result can be used in by `generics_of` and `hir_ty_lowering::new_opaque` to add the proper parameters and arguments.

See an example on the doc for query `opaque_captured_lifetimes`.

Based on rust-lang#129244

Fixes rust-lang#125249
Fixes rust-lang#126850

cc `@compiler-errors` `@spastorino`
r? `@petrochenkov`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants