Skip to content

Regression when compiling with 07-14 nightly #99276

Closed
@bugadani

Description

@bugadani

Code

pub struct Record<'a> {
    pub args: &'a [(usize, &'a str)],
}

mod a {
    extern "Rust" {
        fn foo(record: &super::Record);
    }
}

mod b {
    extern "Rust" {
        fn foo(record: &super::Record);
    }
}

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (c2f428d2f 2022-07-14)
binary: rustc
commit-hash: c2f428d2f3340a0e7d995f4726223db91b93704c
commit-date: 2022-07-14
host: x86_64-pc-windows-msvc
release: 1.64.0-nightly
LLVM version: 14.0.6

Error output

thread 'rustc' panicked at 'assertion failed: !value.has_escaping_bound_vars()', 
Backtrace

thread 'rustc' panicked at 'assertion failed: !value.has_escaping_bound_vars()', /rustc/c2f428d2f3340a0e7d995f4726223db91b93704c\compiler\rustc_middle\src\ty\sty.rs:1000:9
stack backtrace:
   0:     0x7ff9c84a9d2f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h22584ecc91186e64
   1:     0x7ff9c84e547a - core::fmt::write::h22be7db69745eece
   2:     0x7ff9c849cbaa - <std::io::IoSlice as core::fmt::Debug>::fmt::h61da6bb58c94015d
   3:     0x7ff9c84ad72b - std::panicking::default_hook::heafef5cea9c12d8b
   4:     0x7ff9c84ad357 - std::panicking::default_hook::heafef5cea9c12d8b
   5:     0x7ff9cb19b4a4 - <rustc_session[535a8d342c23eaa3]::options::WasiExecModel as rustc_session[535a8d342c23eaa3]::config::dep_tracking::DepTrackingHash>::hash
   6:     0x7ff9c84ae10c - std::panicking::rust_panic_with_hook::h79169c76d34f987b
   7:     0x7ff9c84ade52 - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::hfcbc70f6a02eb89b
   8:     0x7ff9c84aaa27 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h22584ecc91186e64
   9:     0x7ff9c84adb60 - rust_begin_unwind
  10:     0x7ff9c851b445 - core::panicking::panic_fmt::hae5fa724e8b1cacf
  11:     0x7ff9c851b2ec - core::panicking::panic::hb3e6fe55042920db
  12:     0x7ff9cae66b97 - rustc_trait_selection[fd3e0aafddcc0eaa]::traits::type_known_to_meet_bound_modulo_regions
  13:     0x7ff9ca6ce20e - <rustc_ty_utils[a140dd048a38494d]::instance::BoundVarsCollector as rustc_middle[f080ea4a7cc158b5]::ty::visit::TypeVisitor>::visit_ty
  14:     0x7ff9ca6cd97e - <rustc_ty_utils[a140dd048a38494d]::instance::BoundVarsCollector as rustc_middle[f080ea4a7cc158b5]::ty::visit::TypeVisitor>::visit_ty
  15:     0x7ff9cabe2c7a - <rustc_span[b3b8b508e7cd26ef]::def_id::DefId as rustc_serialize[c3cf2e54bbdda217]::serialize::Encodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheEncoder>>::encode
  16:     0x7ff9cab3929c - <rustc_span[b3b8b508e7cd26ef]::def_id::DefId as rustc_serialize[c3cf2e54bbdda217]::serialize::Encodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheEncoder>>::encode
  17:     0x7ff9c9676690 - <&rustc_index[1917152cef6eef0]::vec::IndexVec<rustc_middle[f080ea4a7cc158b5]::mir::Promoted, rustc_middle[f080ea4a7cc158b5]::mir::Body> as rustc_serialize[c3cf2e54bbdda217]::serialize::Decodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheDecoder>>::decode
  18:     0x7ff9cafc72da - <rustc_middle[f080ea4a7cc158b5]::ty::Ty>::is_sized
  19:     0x7ff9cb02edd9 - <rustc_middle[f080ea4a7cc158b5]::ty::fold::BoundVarReplacer as rustc_middle[f080ea4a7cc158b5]::ty::fold::TypeFolder>::fold_region
  20:     0x7ff9cb03d21b - <rustc_middle[f080ea4a7cc158b5]::ty::fold::RegionFolder as rustc_middle[f080ea4a7cc158b5]::ty::fold::TypeFolder>::fold_region
  21:     0x7ff9cabe1ee4 - <rustc_span[b3b8b508e7cd26ef]::def_id::DefId as rustc_serialize[c3cf2e54bbdda217]::serialize::Encodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheEncoder>>::encode
  22:     0x7ff9cabd7c7c - <rustc_span[b3b8b508e7cd26ef]::def_id::DefId as rustc_serialize[c3cf2e54bbdda217]::serialize::Encodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheEncoder>>::encode
  23:     0x7ff9caaa5ad7 - <rustc_query_impl[f8b2c5d5174158e4]::Queries as rustc_middle[f080ea4a7cc158b5]::ty::query::QueryEngine>::as_any
  24:     0x7ff9cb023251 - <rustc_middle[f080ea4a7cc158b5]::ty::context::TyCtxt>::instance_mir
  25:     0x7ff9cb02eba9 - <rustc_middle[f080ea4a7cc158b5]::ty::fold::BoundVarReplacer as rustc_middle[f080ea4a7cc158b5]::ty::fold::TypeFolder>::fold_region
  26:     0x7ff9cb03d21b - <rustc_middle[f080ea4a7cc158b5]::ty::fold::RegionFolder as rustc_middle[f080ea4a7cc158b5]::ty::fold::TypeFolder>::fold_region
  27:     0x7ff9cabe1ee4 - <rustc_span[b3b8b508e7cd26ef]::def_id::DefId as rustc_serialize[c3cf2e54bbdda217]::serialize::Encodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheEncoder>>::encode
  28:     0x7ff9cabd7c7c - <rustc_span[b3b8b508e7cd26ef]::def_id::DefId as rustc_serialize[c3cf2e54bbdda217]::serialize::Encodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheEncoder>>::encode
  29:     0x7ff9caaa5ad7 - <rustc_query_impl[f8b2c5d5174158e4]::Queries as rustc_middle[f080ea4a7cc158b5]::ty::query::QueryEngine>::as_any
  30:     0x7ff9cd0bf159 - <rustc_lint[bd45a0703fe9f065]::context::CheckLintNameResult as core[1f2b1784ea6e9a42]::fmt::Debug>::fmt
  31:     0x7ff9cd0bfa2c - <<rustc_lint[bd45a0703fe9f065]::builtin::TypeAliasBounds>::suggest_changing_assoc_types::WalkAssocTypes as rustc_hir[c7854130ba8a45fb]::intravisit::Visitor>::visit_qpath
  32:     0x7ff9c98d9f3f - <rustc_lint[bd45a0703fe9f065]::builtin::IncompleteFeatures as rustc_lint[bd45a0703fe9f065]::passes::EarlyLintPass>::check_crate
  33:     0x7ff9c98da1dc - <rustc_lint[bd45a0703fe9f065]::builtin::IncompleteFeatures as rustc_lint[bd45a0703fe9f065]::passes::EarlyLintPass>::check_crate
  34:     0x7ff9c98da191 - <rustc_lint[bd45a0703fe9f065]::builtin::IncompleteFeatures as rustc_lint[bd45a0703fe9f065]::passes::EarlyLintPass>::check_crate
  35:     0x7ff9c98dac0d - <rustc_lint[bd45a0703fe9f065]::builtin::ClashingExternDeclarations as rustc_lint[bd45a0703fe9f065]::passes::LateLintPass>::check_foreign_item
  36:     0x7ff9c8b9d853 - rustc_interface[d38a371e72ccadf5]::callbacks::setup_callbacks
  37:     0x7ff9c9a653c1 - tracing_core[eb6a361351365179]::callsite::register_dispatch
  38:     0x7ff9c9a64f34 - tracing_core[eb6a361351365179]::callsite::register_dispatch
  39:     0x7ff9c9a65785 - tracing_core[eb6a361351365179]::callsite::register_dispatch
  40:     0x7ff9c8b9d1f5 - rustc_interface[d38a371e72ccadf5]::callbacks::setup_callbacks
  41:     0x7ff9c9a617c2 - tracing_core[eb6a361351365179]::callsite::register_dispatch
  42:     0x7ff9c8b89612 - rustc_interface[d38a371e72ccadf5]::util::commit_date_str
  43:     0x7ff9c8b899bc - rustc_interface[d38a371e72ccadf5]::util::commit_date_str
  44:     0x7ff9c8b7ac8a - <rustc_interface[d38a371e72ccadf5]::queries::Linker>::link
  45:     0x7ff9c8b8bb1c - rustc_interface[d38a371e72ccadf5]::util::commit_date_str
  46:     0x7ff9c8b82b4d - rustc_interface[d38a371e72ccadf5]::passes::analysis
  47:     0x7ff9c959c44e - <&[rustc_span[b3b8b508e7cd26ef]::def_id::DefId] as rustc_serialize[c3cf2e54bbdda217]::serialize::Decodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheDecoder>>::decode
  48:     0x7ff9c96ea0b6 - <&rustc_index[1917152cef6eef0]::vec::IndexVec<rustc_middle[f080ea4a7cc158b5]::mir::Promoted, rustc_middle[f080ea4a7cc158b5]::mir::Body> as rustc_serialize[c3cf2e54bbdda217]::serialize::Decodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheDecoder>>::decode
  49:     0x7ff9c96364ef - <&rustc_index[1917152cef6eef0]::vec::IndexVec<rustc_middle[f080ea4a7cc158b5]::mir::Promoted, rustc_middle[f080ea4a7cc158b5]::mir::Body> as rustc_serialize[c3cf2e54bbdda217]::serialize::Decodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheDecoder>>::decode
  50:     0x7ff9c96b96cd - <&rustc_index[1917152cef6eef0]::vec::IndexVec<rustc_middle[f080ea4a7cc158b5]::mir::Promoted, rustc_middle[f080ea4a7cc158b5]::mir::Body> as rustc_serialize[c3cf2e54bbdda217]::serialize::Decodable<rustc_query_impl[f8b2c5d5174158e4]::on_disk_cache::CacheDecoder>>::decode
  51:     0x7ff9c8b4cfdd - <rustc_middle[f080ea4a7cc158b5]::ty::SymbolName as core[1f2b1784ea6e9a42]::fmt::Display>::fmt
  52:     0x7ff9c8b45a55 - <unknown>
  53:     0x7ff9c8b5e107 - rustc_driver[39d376d6076eb2]::args::arg_expand_all
  54:     0x7ff9c8b47469 - <unknown>
  55:     0x7ff9c8b483ed - <rustc_middle[f080ea4a7cc158b5]::ty::SymbolName as core[1f2b1784ea6e9a42]::fmt::Display>::fmt
  56:     0x7ff9c84bf02c - std::sys::windows::thread::Thread::new::hdddbeea900b2c6ad
  57:     0x7ffa666d3fed - BaseThreadInitThunk
  58:     0x7ffa67a942a8 - RtlUserThreadStart

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.64.0-nightly (c2f428d2f 2022-07-14) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [is_sized_raw] computing whether `[(usize, &str)]` is `Sized`
#1 [layout_of] computing layout of `&[(usize, &str)]`
#2 [layout_of] computing layout of `Record<'_>`
#3 [analysis] running analysis passes on this crate
end of query stack

Playground uses 7-13 nightly still, and the code compiles there: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=acd29a81c627ac9cd863a0a3d843c72e

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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions