Skip to content

ICE "expect tcx.sess.has_errors return true" #104768

Closed

Description

@jruderman

Code

const A: &_ = 0_u32;

fn main() {}

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/visit.rs:103:17: expect tcx.sess.has_errors return true

Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/ff8c8dfbe66701531e3e5e335c28c544d0fbc945/compiler/rustc_errors/src/lib.rs:1560:9
stack backtrace:
   0:        0x100b83152 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he02b81ee9fd93999
   1:        0x100be1bba - core::fmt::write::h2defc6780b01b98f
   2:        0x100b7551c - std::io::Write::write_fmt::hd14cefb8f7ff162a
   3:        0x100b82f1a - std::sys_common::backtrace::print::hd794f53e9106805e
   4:        0x100b86246 - std::panicking::default_hook::{{closure}}::h3f1a7d2a7e113922
   5:        0x100b85f97 - std::panicking::default_hook::hc2ab762c436ea8e6
   6:        0x10b61877d - rustc_driver[2fa5ced89a36b2bb]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x100b86a2d - std::panicking::rust_panic_with_hook::h6737e44fee662a10
   8:        0x10fd09377 - std[a7bcc37ac91ea507]::panicking::begin_panic::<rustc_errors[a3b0880de9357bbd]::ExplicitBug>::{closure#0}
   9:        0x10fd02329 - std[a7bcc37ac91ea507]::sys_common::backtrace::__rust_end_short_backtrace::<std[a7bcc37ac91ea507]::panicking::begin_panic<rustc_errors[a3b0880de9357bbd]::ExplicitBug>::{closure#0}, !>
  10:        0x1103fc5d9 - std[a7bcc37ac91ea507]::panicking::begin_panic::<rustc_errors[a3b0880de9357bbd]::ExplicitBug>
  11:        0x10fd02319 - std[a7bcc37ac91ea507]::panic::panic_any::<rustc_errors[a3b0880de9357bbd]::ExplicitBug>
  12:        0x10fcfa16d - <rustc_errors[a3b0880de9357bbd]::HandlerInner>::bug::<&alloc[9e1d3100bc63c017]::string::String>
  13:        0x10fcf9c37 - <rustc_errors[a3b0880de9357bbd]::Handler>::bug::<&alloc[9e1d3100bc63c017]::string::String>
  14:        0x10fe41472 - rustc_middle[11e81625f7bbe50a]::ty::context::tls::with_context_opt::<rustc_middle[11e81625f7bbe50a]::ty::context::tls::with_opt<rustc_middle[11e81625f7bbe50a]::util::bug::opt_span_bug_fmt<rustc_span[8424830d8e8bf797]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  15:        0x10fe425d1 - rustc_middle[11e81625f7bbe50a]::util::bug::opt_span_bug_fmt::<rustc_span[8424830d8e8bf797]::span_encoding::Span>
  16:        0x1103fdc5e - rustc_middle[11e81625f7bbe50a]::util::bug::bug_fmt
  17:        0x10def65eb - <rustc_hir_typeck[27eda5868db5c1c1]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[27eda5868db5c1c1]::typeck_with_fallback<rustc_hir_typeck[27eda5868db5c1c1]::diagnostic_only_typeck::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[11e81625f7bbe50a]::ty::context::TypeckResults>
  18:        0x10de94d74 - rustc_hir_typeck[27eda5868db5c1c1]::diagnostic_only_typeck
  19:        0x10ee05ff9 - rustc_query_system[5966864cd92ca7b0]::query::plumbing::try_execute_query::<rustc_query_impl[a2b9541f41ba54cd]::plumbing::QueryCtxt, rustc_query_system[5966864cd92ca7b0]::query::caches::DefaultCache<rustc_span[8424830d8e8bf797]::def_id::LocalDefId, &rustc_middle[11e81625f7bbe50a]::ty::context::TypeckResults>>
  20:        0x10eef62bc - rustc_query_system[5966864cd92ca7b0]::query::plumbing::get_query::<rustc_query_impl[a2b9541f41ba54cd]::queries::diagnostic_only_typeck, rustc_query_impl[a2b9541f41ba54cd]::plumbing::QueryCtxt>
  21:        0x10e04aeb3 - rustc_hir_analysis[b49d33eca061cccf]::collect::type_of::infer_placeholder_type
  22:        0x10e048d25 - rustc_hir_analysis[b49d33eca061cccf]::collect::type_of::type_of
  23:        0x10ee27b35 - rustc_query_system[5966864cd92ca7b0]::query::plumbing::try_execute_query::<rustc_query_impl[a2b9541f41ba54cd]::plumbing::QueryCtxt, rustc_query_system[5966864cd92ca7b0]::query::caches::DefaultCache<rustc_span[8424830d8e8bf797]::def_id::DefId, rustc_middle[11e81625f7bbe50a]::ty::Ty>>
  24:        0x10eefdee4 - rustc_query_system[5966864cd92ca7b0]::query::plumbing::get_query::<rustc_query_impl[a2b9541f41ba54cd]::queries::type_of, rustc_query_impl[a2b9541f41ba54cd]::plumbing::QueryCtxt>
  25:        0x10e0670b7 - rustc_hir_analysis[b49d33eca061cccf]::collect::convert_item
  26:        0x10e05f1cc - <rustc_hir_analysis[b49d33eca061cccf]::collect::CollectItemTypesVisitor as rustc_hir[2e6908b92fe2fbc8]::intravisit::Visitor>::visit_item
  27:        0x10e02aec9 - <rustc_middle[11e81625f7bbe50a]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[b49d33eca061cccf]::collect::CollectItemTypesVisitor>
  28:        0x10e05e805 - rustc_hir_analysis[b49d33eca061cccf]::collect::collect_mod_item_types
  29:        0x10ee0a895 - rustc_query_system[5966864cd92ca7b0]::query::plumbing::try_execute_query::<rustc_query_impl[a2b9541f41ba54cd]::plumbing::QueryCtxt, rustc_query_system[5966864cd92ca7b0]::query::caches::DefaultCache<rustc_span[8424830d8e8bf797]::def_id::LocalDefId, ()>>
  30:        0x10eef6025 - rustc_query_system[5966864cd92ca7b0]::query::plumbing::get_query::<rustc_query_impl[a2b9541f41ba54cd]::queries::collect_mod_item_types, rustc_query_impl[a2b9541f41ba54cd]::plumbing::QueryCtxt>
  31:        0x10e02c4e8 - <rustc_session[1d2780505fe32284]::session::Session>::track_errors::<rustc_hir_analysis[b49d33eca061cccf]::check_crate::{closure#0}, ()>
  32:        0x10dfdcab8 - rustc_hir_analysis[b49d33eca061cccf]::check_crate
  33:        0x10b6d479a - rustc_interface[ebeaf7db7192038f]::passes::analysis
  34:        0x10ee83e8c - rustc_query_system[5966864cd92ca7b0]::query::plumbing::try_execute_query::<rustc_query_impl[a2b9541f41ba54cd]::plumbing::QueryCtxt, rustc_query_system[5966864cd92ca7b0]::query::caches::DefaultCache<(), core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>>>
  35:        0x10eefdff9 - rustc_query_system[5966864cd92ca7b0]::query::plumbing::get_query::<rustc_query_impl[a2b9541f41ba54cd]::queries::analysis, rustc_query_impl[a2b9541f41ba54cd]::plumbing::QueryCtxt>
  36:        0x10b5dd612 - <rustc_interface[ebeaf7db7192038f]::passes::QueryContext>::enter::<rustc_driver[2fa5ced89a36b2bb]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>>
  37:        0x10b5ef4cd - rustc_span[8424830d8e8bf797]::with_source_map::<core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>, rustc_interface[ebeaf7db7192038f]::interface::run_compiler<core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>, rustc_driver[2fa5ced89a36b2bb]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  38:        0x10b5e5e8c - <scoped_tls[d5d11682d6a263c2]::ScopedKey<rustc_span[8424830d8e8bf797]::SessionGlobals>>::set::<rustc_interface[ebeaf7db7192038f]::interface::run_compiler<core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>, rustc_driver[2fa5ced89a36b2bb]::run_compiler::{closure#1}>::{closure#0}, core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>>
  39:        0x10b5aea3a - std[a7bcc37ac91ea507]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ebeaf7db7192038f]::util::run_in_thread_pool_with_globals<rustc_interface[ebeaf7db7192038f]::interface::run_compiler<core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>, rustc_driver[2fa5ced89a36b2bb]::run_compiler::{closure#1}>::{closure#0}, core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>>
  40:        0x10b590ecb - <<std[a7bcc37ac91ea507]::thread::Builder>::spawn_unchecked_<rustc_interface[ebeaf7db7192038f]::util::run_in_thread_pool_with_globals<rustc_interface[ebeaf7db7192038f]::interface::run_compiler<core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>, rustc_driver[2fa5ced89a36b2bb]::run_compiler::{closure#1}>::{closure#0}, core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3d042c94762723bc]::result::Result<(), rustc_errors[a3b0880de9357bbd]::ErrorGuaranteed>>::{closure#1} as core[3d042c94762723bc]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:        0x100b8fde7 - std::sys::unix::thread::Thread::new::thread_start::hc3ae91907c3ce551
  42:     0x7ff816f934e1 - __pthread_start

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.67.0-nightly (ff8c8dfbe 2022-11-22) running on x86_64-apple-darwin

query stack during panic:
#0 [diagnostic_only_typeck] type-checking `A`
#1 [type_of] computing type of `A`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

Regression

Regression in nightly-2022-11-20, from something in rollup 2f8d804

Version

rustc 1.67.0-nightly (ff8c8dfbe 2022-11-22)
binary: rustc
commit-hash: ff8c8dfbe66701531e3e5e335c28c544d0fbc945
commit-date: 2022-11-22
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4

Activity

  1. added
    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.
    on Nov 23, 2022
  2. matthiaskrgr commented on Nov 23, 2022

    @matthiaskrgr
    Member

    duplicate of #104237

  3. jruderman commented on Nov 23, 2022

    @jruderman
    ContributorAuthor

    Same message as #104237, but this is a more recent regression and happens in rustc (not just rustdoc), so it might be a separate bug

  4. self-assigned this
    on Nov 23, 2022
  5. added 3 commits that reference this issue on Nov 24, 2022
    7e70129
    d3b6e19
    4843946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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