Skip to content

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

Closed
@matthiaskrgr

Description

@matthiaskrgr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.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.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions