Skip to content

ICE on nightly with -Z macro-backtrace but compiles fine otherwise #92337

Closed
@jbr

Description

@jbr

In the context of the code at https://github.com/trillium-rs/trillium/tree/main/http, in particular this IntoIterator implementation, it compiles just fine on nightly and stable, but when RUSTFLAGS="-Z macro-backtrace" is provided on the latest nightly, it panics the compiler.

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (f8abed9ed 2021-12-26)
binary: rustc
commit-hash: f8abed9ed48bace6be0087bcd44ed534e239b8d8
commit-date: 2021-12-26
host: x86_64-apple-darwin
release: 1.59.0-nightly
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'failed to lookup `SourceFile` in new context', compiler/rustc_query_impl/src/on_disk_cache.rs:500:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

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: rustc 1.59.0-nightly (f8abed9ed 2021-12-26) running on x86_64-apple-darwin

note: compiler flags: -Z macro-backtrace -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [type_of] computing type of `headers::Headers::unknown`
#1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate
end of query stack
error: could not compile `trillium-http`
Backtrace

thread 'rustc' panicked at 'failed to lookup `SourceFile` in new context', compiler/rustc_query_impl/src/on_disk_cache.rs:500:22
stack backtrace:
   0:        0x10c83dee1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd5d1a709b630f79b
   1:        0x10c89459b - core::fmt::write::haff82639db696176
   2:        0x10c82ea1a - std::io::Write::write_fmt::h5803dbd750efee38
   3:        0x10c842205 - std::panicking::default_hook::{{closure}}::h3c770bc34403b5cd
   4:        0x10c841dec - std::panicking::default_hook::hd99d33e209290ad6
   5:        0x115ae300d - rustc_driver[b37b2b4d5d1979d1]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x10c8429ca - std::panicking::rust_panic_with_hook::ha4254dadff686bb1
   7:        0x10c84271e - std::panicking::begin_panic_handler::{{closure}}::hf11e647b68f7f305
   8:        0x10c83e347 - std::sys_common::backtrace::__rust_end_short_backtrace::hb1c7cd67c5c92b34
   9:        0x10c84242a - _rust_begin_unwind
  10:        0x10c8bd26f - core::panicking::panic_fmt::hbe18a78cca1b2f70
  11:        0x10c89116b - core::panicking::panic_display::h911aaa103b46628d
  12:        0x10c89111c - core::panicking::panic_str::hae5a78ca63a9aa7f
  13:        0x10c8bd179 - core::option::expect_failed::hf552ed44a43b47f6
  14:        0x119245792 - <rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>::file_index_to_file
  15:        0x1193d37d8 - <rustc_span[cc28f3de1f2a51e8]::span_encoding::Span as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  16:        0x119387d60 - <rustc_middle[86bf991e89080fe6]::ty::VariantDef as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  17:        0x119231fb2 - <rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder as rustc_serialize[d6a46db24fe10ca8]::serialize::Decoder>::read_seq::<alloc[ac5bc44c37cdc04]::vec::Vec<rustc_middle[86bf991e89080fe6]::ty::VariantDef>, <alloc[ac5bc44c37cdc04]::vec::Vec<rustc_middle[86bf991e89080fe6]::ty::VariantDef> as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode::{closure#0}>
  18:        0x1191d1a84 - <rustc_middle[86bf991e89080fe6]::ty::adt::AdtDef as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  19:        0x1191992be - <rustc_middle[86bf991e89080fe6]::ty::sty::TyKind as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  20:        0x11937bdfc - <&rustc_middle[86bf991e89080fe6]::ty::TyS as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  21:        0x1191f61c1 - <rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  22:        0x1191de61a - <smallvec[dc3cfe98a856e7bd]::SmallVec<[rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg; 8usize]> as core[ce71f4cd56b6896]::iter::traits::collect::Extend<rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg>>::extend::<core[ce71f4cd56b6896]::iter::adapters::ResultShunt<core[ce71f4cd56b6896]::iter::adapters::map::Map<core[ce71f4cd56b6896]::ops::range::Range<usize>, <&rustc_middle[86bf991e89080fe6]::ty::list::List<rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg> as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode::{closure#0}>, alloc[ac5bc44c37cdc04]::string::String>>
  23:        0x1191f7f55 - <core[ce71f4cd56b6896]::result::Result<rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg, alloc[ac5bc44c37cdc04]::string::String> as rustc_middle[86bf991e89080fe6]::ty::context::InternIteratorElement<rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg, &rustc_middle[86bf991e89080fe6]::ty::list::List<rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg>>>::intern_with::<core[ce71f4cd56b6896]::iter::adapters::map::Map<core[ce71f4cd56b6896]::ops::range::Range<usize>, <&rustc_middle[86bf991e89080fe6]::ty::list::List<rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg> as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode::{closure#0}>, <rustc_middle[86bf991e89080fe6]::ty::context::TyCtxt>::mk_substs<core[ce71f4cd56b6896]::iter::adapters::map::Map<core[ce71f4cd56b6896]::ops::range::Range<usize>, <&rustc_middle[86bf991e89080fe6]::ty::list::List<rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg> as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode::{closure#0}>>::{closure#0}>
  24:        0x11937bff6 - <&rustc_middle[86bf991e89080fe6]::ty::list::List<rustc_middle[86bf991e89080fe6]::ty::subst::GenericArg> as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  25:        0x119199a94 - <rustc_middle[86bf991e89080fe6]::ty::sty::TyKind as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  26:        0x11937bdfc - <&rustc_middle[86bf991e89080fe6]::ty::TyS as rustc_serialize[d6a46db24fe10ca8]::serialize::Decodable<rustc_query_impl[dda8e02065a9c801]::on_disk_cache::CacheDecoder>>::decode
  27:        0x1192436a2 - <rustc_query_impl[dda8e02065a9c801]::on_disk_cache::OnDiskCache>::try_load_query_result::<&rustc_middle[86bf991e89080fe6]::ty::TyS>
  28:        0x1190a6c23 - rustc_query_system[9d83d31227f59d11]::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt, rustc_span[cc28f3de1f2a51e8]::def_id::DefId, &rustc_middle[86bf991e89080fe6]::ty::TyS>
  29:        0x119058f5e - rustc_query_system[9d83d31227f59d11]::query::plumbing::try_execute_query::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt, rustc_query_system[9d83d31227f59d11]::query::caches::DefaultCache<rustc_span[cc28f3de1f2a51e8]::def_id::DefId, &rustc_middle[86bf991e89080fe6]::ty::TyS>>
  30:        0x119109811 - rustc_query_system[9d83d31227f59d11]::query::plumbing::get_query::<rustc_query_impl[dda8e02065a9c801]::queries::type_of, rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  31:        0x118721289 - <rustc_typeck[2524ff7f94c65569]::outlives::implicit_infer::InferVisitor as rustc_hir[4a83e6945b172e83]::itemlikevisit::ItemLikeVisitor>::visit_item
  32:        0x11868c3b0 - <rustc_middle[86bf991e89080fe6]::hir::map::Map>::visit_all_item_likes::<rustc_typeck[2524ff7f94c65569]::outlives::implicit_infer::InferVisitor>
  33:        0x1186c89d3 - rustc_typeck[2524ff7f94c65569]::outlives::inferred_outlives_crate
  34:        0x119309cf9 - <rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepGraph<rustc_middle[86bf991e89080fe6]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[86bf991e89080fe6]::ty::context::TyCtxt, (), rustc_middle[86bf991e89080fe6]::ty::CratePredicatesMap>
  35:        0x1191714dd - rustc_data_structures[8bbf4bbb3547086b]::stack::ensure_sufficient_stack::<(rustc_middle[86bf991e89080fe6]::ty::CratePredicatesMap, rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepNodeIndex), rustc_query_system[9d83d31227f59d11]::query::plumbing::execute_job<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt, (), rustc_middle[86bf991e89080fe6]::ty::CratePredicatesMap>::{closure#3}>
  36:        0x11901182f - rustc_query_system[9d83d31227f59d11]::query::plumbing::try_execute_query::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt, rustc_query_system[9d83d31227f59d11]::query::caches::ArenaCache<(), rustc_middle[86bf991e89080fe6]::ty::CratePredicatesMap>>
  37:        0x119127645 - rustc_query_system[9d83d31227f59d11]::query::plumbing::force_query::<rustc_query_impl[dda8e02065a9c801]::queries::inferred_outlives_crate, rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  38:        0x119211b82 - rustc_query_impl[dda8e02065a9c801]::query_callbacks::inferred_outlives_crate::force_from_dep_node
  39:        0x119e55edc - <rustc_middle[86bf991e89080fe6]::ty::context::TyCtxt as rustc_query_system[9d83d31227f59d11]::dep_graph::DepContext>::try_force_from_dep_node
  40:        0x11934fc7d - <rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepGraph<rustc_middle[86bf991e89080fe6]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  41:        0x11934fc47 - <rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepGraph<rustc_middle[86bf991e89080fe6]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  42:        0x11934fc47 - <rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepGraph<rustc_middle[86bf991e89080fe6]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  43:        0x11934fc47 - <rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepGraph<rustc_middle[86bf991e89080fe6]::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  44:        0x11934f880 - <rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepGraph<rustc_middle[86bf991e89080fe6]::dep_graph::dep_node::DepKind>>::try_mark_green::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  45:        0x1190d165f - rustc_query_system[9d83d31227f59d11]::query::plumbing::ensure_must_run::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt, rustc_span[cc28f3de1f2a51e8]::def_id::LocalDefId, rustc_span[cc28f3de1f2a51e8]::def_id::LocalDefId>
  46:        0x1190f2706 - rustc_query_system[9d83d31227f59d11]::query::plumbing::get_query::<rustc_query_impl[dda8e02065a9c801]::queries::collect_mod_item_types, rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  47:        0x11868d83c - <rustc_middle[86bf991e89080fe6]::hir::map::Map>::for_each_module::<rustc_typeck[2524ff7f94c65569]::check_crate::{closure#0}::{closure#0}::{closure#0}>
  48:        0x1185d7401 - <rustc_session[caaac6eb3f4f9859]::session::Session>::track_errors::<rustc_typeck[2524ff7f94c65569]::check_crate::{closure#0}, ()>
  49:        0x1185a8a30 - rustc_typeck[2524ff7f94c65569]::check_crate
  50:        0x115c2709a - rustc_interface[12a8940816099271]::passes::analysis
  51:        0x1193062dc - <rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepGraph<rustc_middle[86bf991e89080fe6]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[86bf991e89080fe6]::ty::context::TyCtxt, (), core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>
  52:        0x11916d9c5 - rustc_data_structures[8bbf4bbb3547086b]::stack::ensure_sufficient_stack::<(core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>, rustc_query_system[9d83d31227f59d11]::dep_graph::graph::DepNodeIndex), rustc_query_system[9d83d31227f59d11]::query::plumbing::execute_job<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt, (), core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>::{closure#3}>
  53:        0x119087e25 - rustc_query_system[9d83d31227f59d11]::query::plumbing::try_execute_query::<rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt, rustc_query_system[9d83d31227f59d11]::query::caches::DefaultCache<(), core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>>
  54:        0x119109945 - rustc_query_system[9d83d31227f59d11]::query::plumbing::get_query::<rustc_query_impl[dda8e02065a9c801]::queries::analysis, rustc_query_impl[dda8e02065a9c801]::plumbing::QueryCtxt>
  55:        0x115b4be9b - <rustc_interface[12a8940816099271]::passes::QueryContext>::enter::<rustc_driver[b37b2b4d5d1979d1]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>
  56:        0x115b44d41 - <rustc_interface[12a8940816099271]::interface::Compiler>::enter::<rustc_driver[b37b2b4d5d1979d1]::run_compiler::{closure#1}::{closure#2}, core[ce71f4cd56b6896]::result::Result<core[ce71f4cd56b6896]::option::Option<rustc_interface[12a8940816099271]::queries::Linker>, rustc_errors[d154dd59388aa645]::ErrorReported>>
  57:        0x115af37f8 - rustc_span[cc28f3de1f2a51e8]::with_source_map::<core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>, rustc_interface[12a8940816099271]::interface::create_compiler_and_run<core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>, rustc_driver[b37b2b4d5d1979d1]::run_compiler::{closure#1}>::{closure#1}>
  58:        0x115b4388f - rustc_interface[12a8940816099271]::interface::create_compiler_and_run::<core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>, rustc_driver[b37b2b4d5d1979d1]::run_compiler::{closure#1}>
  59:        0x115af90a9 - <scoped_tls[ff1bc6f8814d49ee]::ScopedKey<rustc_span[cc28f3de1f2a51e8]::SessionGlobals>>::set::<rustc_interface[12a8940816099271]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[12a8940816099271]::interface::run_compiler<core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>, rustc_driver[b37b2b4d5d1979d1]::run_compiler::{closure#1}>::{closure#0}, core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>::{closure#0}::{closure#0}, core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>
  60:        0x115af6692 - std[c915604f82fd6c16]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[12a8940816099271]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[12a8940816099271]::interface::run_compiler<core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>, rustc_driver[b37b2b4d5d1979d1]::run_compiler::{closure#1}>::{closure#0}, core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>::{closure#0}, core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>
  61:        0x115b5b995 - <<std[c915604f82fd6c16]::thread::Builder>::spawn_unchecked<rustc_interface[12a8940816099271]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[12a8940816099271]::interface::run_compiler<core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>, rustc_driver[b37b2b4d5d1979d1]::run_compiler::{closure#1}>::{closure#0}, core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>::{closure#0}, core[ce71f4cd56b6896]::result::Result<(), rustc_errors[d154dd59388aa645]::ErrorReported>>::{closure#1} as core[ce71f4cd56b6896]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  62:        0x10c84f3d7 - std::sys::unix::thread::Thread::new::thread_start::hb2d586dbe2cee7b4
  63:     0x7ff8142714f4 - __pthread_start

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

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: rustc 1.59.0-nightly (f8abed9ed 2021-12-26) running on x86_64-apple-darwin

note: compiler flags: -Z macro-backtrace -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [type_of] computing type of `headers::Headers::unknown`
#1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `trillium-http`

Metadata

Metadata

Assignees

No one assigned

    Labels

    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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions