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

Closed
matthiaskrgr opened this issue Aug 9, 2023 · 1 comment · Fixed by #114667
Closed

ICE: -Zunpretty no def-id for fresh lifetime #114664

matthiaskrgr opened this issue Aug 9, 2023 · 1 comment · Fixed by #114667
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

rustc -Zunpretty=hir file.rs

fn ice() -> impl AsRef<Fn(&())> {
    todo!()
}

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.73.0-nightly (f88a8b71c 2023-08-08)
binary: rustc
commit-hash: f88a8b71cebb730cbd5058c45ebcae1d4d9be377
commit-date: 2023-08-08
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 17.0.0

Error output

#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
fn ice()
    ->
        /*impl Trait*/ {

        ::core::panicking::panic("not yet implemented")
    }
fn main() { }
Backtrace

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: no def-id for fresh lifetime
 --> 101297.rs:1:27
  |
1 | fn ice() -> impl AsRef<Fn(&())> {
  |                           ^^^
  |
note: delayed at compiler/rustc_ast_lowering/src/lib.rs:1595:30
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_session::session::Session>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
         2: <rustc_ast_lowering::LoweringContext>::lower_opaque_impl_trait::{closure#0}
         3: <rustc_ast_lowering::LoweringContext>::lower_ty_direct
         4: <rustc_ast_lowering::LoweringContext>::lower_fn_decl
         5: <rustc_ast_lowering::LoweringContext>::lower_item_kind
         6: <rustc_ast_lowering::LoweringContext>::with_hir_id_owner::<<rustc_ast_lowering::item::ItemLowerer>::with_lctx<<rustc_ast_lowering::item::ItemLowerer>::lower_item::{closure#0}>::{closure#0}>
         7: <rustc_ast_lowering::item::ItemLowerer>::lower_node
         8: rustc_ast_lowering::lower_to_hir
         9: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        10: <rustc_query_impl::query_impl::hir_crate::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        12: rustc_query_impl::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
        13: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::hir_owner::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
        14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        15: rustc_query_impl::query_impl::hir_owner::get_query_non_incr::__rust_end_short_backtrace
        16: rustc_driver_impl::pretty::print_after_hir_lowering::{closure#1}.110
        17: rustc_driver_impl::pretty::print_after_hir_lowering
        18: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        19: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
        20: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        21: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/alloc/src/boxed.rs:2007:9
        23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/alloc/src/boxed.rs:2007:9
        24: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/f88a8b71cebb730cbd5058c45ebcae1d4d9be377/library/std/src/sys/unix/thread.rs:108:17
        25: <unknown>
        26: <unknown>
 --> 101297.rs:1:27
  |
1 | fn ice() -> impl AsRef<Fn(&())> {
  |                           ^^^

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 attach the file at `/home/matthias/vcs/github/glacier2/fixed/rustc-ice-2023-08-09T17:34:45.745603347Z-2296617.txt` to your bug report

note: compiler flags: -Z unpretty=hir

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 Aug 9, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 9, 2023
@matthiaskrgr matthiaskrgr added requires-nightly This issue requires a nightly compiler in some way. F-return_position_impl_trait_in_trait `#![feature(return_position_impl_trait_in_trait)]` labels Aug 9, 2023
@compiler-errors compiler-errors added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. and removed F-return_position_impl_trait_in_trait `#![feature(return_position_impl_trait_in_trait)]` needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 9, 2023
@compiler-errors
Copy link
Member

This is not an RPITIT bug, for the record.

@compiler-errors compiler-errors changed the title ICE: RPITIT: -Zunpretty no def-id for fresh lifetime ICE: -Zunpretty no def-id for fresh lifetime Aug 9, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 11, 2023
…vidtwco

Record binder for bare trait object in LifetimeCollectVisitor

The `LifetimeCollectVisitor` had a bug where it was not recording the binder of bate trait objects. This was uncovered in rust-lang#114487, when I changed opaque type lowering to ICE if it encountered a captured fresh lifetime with no def-id to map back to: https://github.com/rust-lang/rust/pull/114487/files#diff-ad0c15bbde97a607d4758ec7eaf88248be5d6b8ae084dfc84127f81e3f7a9bb4R1585

Fixes rust-lang#114664
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 11, 2023
…vidtwco

Record binder for bare trait object in LifetimeCollectVisitor

The `LifetimeCollectVisitor` had a bug where it was not recording the binder of bate trait objects. This was uncovered in rust-lang#114487, when I changed opaque type lowering to ICE if it encountered a captured fresh lifetime with no def-id to map back to: https://github.com/rust-lang/rust/pull/114487/files#diff-ad0c15bbde97a607d4758ec7eaf88248be5d6b8ae084dfc84127f81e3f7a9bb4R1585

Fixes rust-lang#114664
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Aug 12, 2023
…vidtwco

Record binder for bare trait object in LifetimeCollectVisitor

The `LifetimeCollectVisitor` had a bug where it was not recording the binder of bate trait objects. This was uncovered in rust-lang#114487, when I changed opaque type lowering to ICE if it encountered a captured fresh lifetime with no def-id to map back to: https://github.com/rust-lang/rust/pull/114487/files#diff-ad0c15bbde97a607d4758ec7eaf88248be5d6b8ae084dfc84127f81e3f7a9bb4R1585

Fixes rust-lang#114664
@bors bors closed this as completed in a12c329 Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. 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