rust-lang / rust

Empowering everyone to build reliable and efficient software.

Home Page:https://www.rust-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ICE "Not enough bound vars"

jruderman opened this issue · comments

Found with a modified fuzz-rustc

Code

#![feature(associated_type_bounds)]

trait B {
    type AssocType;
}

fn f()
where
    dyn for<'j> B<AssocType: 'j>:,
{
}

fn main() {}

ICE (with debug assertions enabled)

error: internal compiler error: compiler/rustc_middle/src/ty/visit.rs:415: Not enough bound vars: BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ hy[af0c]::f::'j), 'j) } not found in []

Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/visit.rs:415:21: Not enough bound vars: BoundRegion { var: 0, kind: BrNamed(DefId(0:6 ~ hy[af0c]::f::'j), 'j) } not found in []

thread 'rustc' panicked at 'Box<dyn Any>', /Users/jruderman/code/rust/compiler/rustc_errors/src/lib.rs:1575:9
stack backtrace:
   0:        0x106455f21 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcf5aac4d53eab431
   1:        0x106513818 - core::fmt::write::hed31846cddb4e13c
   2:        0x1064b8ec8 - std::io::Write::write_fmt::h01887004f97cedc7
   3:        0x106455d12 - std::sys_common::backtrace::print::h2141c6543b5865e5
   4:        0x1064b9e45 - std::panicking::default_hook::{{closure}}::hfe93a58a10a72158
   5:        0x1064b9c2e - std::panicking::default_hook::hafca10424d622dfb
   6:        0x115a11398 - rustc_driver[b73731b7ed8e79fd]::DEFAULT_HOOK::{closure#0}::{closure#0}
   7:        0x1064ba636 - std::panicking::rust_panic_with_hook::hafe3bb82e805c420
   8:        0x11a9a8337 - std[e4564114326e8c6]::panicking::begin_panic::<rustc_errors[9121627fb7cf2262]::ExplicitBug>::{closure#0}
   9:        0x11a9a82a9 - std[e4564114326e8c6]::sys_common::backtrace::__rust_end_short_backtrace::<std[e4564114326e8c6]::panicking::begin_panic<rustc_errors[9121627fb7cf2262]::ExplicitBug>::{closure#0}, !>
  10:        0x11b0a9b89 - std[e4564114326e8c6]::panicking::begin_panic::<rustc_errors[9121627fb7cf2262]::ExplicitBug>
  11:        0x11a8c9f69 - std[e4564114326e8c6]::panic::panic_any::<rustc_errors[9121627fb7cf2262]::ExplicitBug>
  12:        0x11a8c9e9d - <rustc_errors[9121627fb7cf2262]::HandlerInner>::bug::<&alloc[fd2a8df82bfdc6c8]::string::String>
  13:        0x11a8c99d1 - <rustc_errors[9121627fb7cf2262]::Handler>::bug::<&alloc[fd2a8df82bfdc6c8]::string::String>
  14:        0x11aa1e0c2 - rustc_middle[db449b3460385d6f]::ty::context::tls::with_opt::<rustc_middle[db449b3460385d6f]::util::bug::opt_span_bug_fmt<rustc_span[3733f809f3ebe388]::span_encoding::Span>::{closure#0}, ()>
  15:        0x11aa1e141 - rustc_middle[db449b3460385d6f]::util::bug::opt_span_bug_fmt::<rustc_span[3733f809f3ebe388]::span_encoding::Span>
  16:        0x11b097f61 - rustc_middle[db449b3460385d6f]::util::bug::bug_fmt
  17:        0x11a941b49 - <rustc_middle[db449b3460385d6f]::ty::visit::ValidateBoundVars as rustc_middle[db449b3460385d6f]::ty::visit::TypeVisitor>::visit_region
  18:        0x118668e00 - <rustc_middle[db449b3460385d6f]::ty::sty::Binder<rustc_middle[db449b3460385d6f]::ty::sty::Region>>::bind_with_vars
  19:        0x1185e33bf - <dyn rustc_hir_analysis[50d2e10c526ac435]::astconv::AstConv>::add_bounds::<core[95bb6d661b676f4d]::slice::iter::Iter<rustc_hir[2c9fd968c67d70e3]::hir::GenericBound>>
  20:        0x1186cda4e - <dyn rustc_hir_analysis[50d2e10c526ac435]::astconv::AstConv>::compute_bounds_inner
  21:        0x1184efd1d - rustc_hir_analysis[50d2e10c526ac435]::collect::item_bounds::explicit_item_bounds
  22:        0x1196a6306 - rustc_query_system[e535d6d94a1ab2a4]::query::plumbing::try_execute_query::<rustc_query_impl[c1f689d635a76408]::plumbing::QueryCtxt, rustc_query_system[e535d6d94a1ab2a4]::query::caches::DefaultCache<rustc_span[3733f809f3ebe388]::def_id::DefId, &[(rustc_middle[db449b3460385d6f]::ty::Predicate, rustc_span[3733f809f3ebe388]::span_encoding::Span)]>>
  23:        0x1197952e9 - rustc_query_system[e535d6d94a1ab2a4]::query::plumbing::get_query::<rustc_query_impl[c1f689d635a76408]::queries::explicit_item_bounds, rustc_query_impl[c1f689d635a76408]::plumbing::QueryCtxt>
  24:        0x1199245d7 - <rustc_query_impl[c1f689d635a76408]::Queries as rustc_middle[db449b3460385d6f]::ty::query::QueryEngine>::explicit_item_bounds
  25:        0x11869b285 - rustc_hir_analysis[50d2e10c526ac435]::collect::convert_item
  26:        0x11869790c - <rustc_hir_analysis[50d2e10c526ac435]::collect::CollectItemTypesVisitor as rustc_hir[2c9fd968c67d70e3]::intravisit::Visitor>::visit_item
  27:        0x11857e855 - <rustc_middle[db449b3460385d6f]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[50d2e10c526ac435]::collect::CollectItemTypesVisitor>
  28:        0x118696c15 - rustc_hir_analysis[50d2e10c526ac435]::collect::collect_mod_item_types
  29:        0x1196e107b - rustc_query_system[e535d6d94a1ab2a4]::query::plumbing::try_execute_query::<rustc_query_impl[c1f689d635a76408]::plumbing::QueryCtxt, rustc_query_system[e535d6d94a1ab2a4]::query::caches::VecCache<rustc_span[3733f809f3ebe388]::def_id::LocalDefId, ()>>
  30:        0x11979cc03 - rustc_query_system[e535d6d94a1ab2a4]::query::plumbing::get_query::<rustc_query_impl[c1f689d635a76408]::queries::collect_mod_item_types, rustc_query_impl[c1f689d635a76408]::plumbing::QueryCtxt>
  31:        0x119945ebf - <rustc_query_impl[c1f689d635a76408]::Queries as rustc_middle[db449b3460385d6f]::ty::query::QueryEngine>::collect_mod_item_types
  32:        0x11857e153 - <rustc_middle[db449b3460385d6f]::hir::map::Map>::for_each_module::<rustc_hir_analysis[50d2e10c526ac435]::check_crate::{closure#0}::{closure#0}::{closure#0}>
  33:        0x11867a71b - <rustc_session[eed39e6e03b50785]::session::Session>::track_errors::<rustc_hir_analysis[50d2e10c526ac435]::check_crate::{closure#0}, ()>
  34:        0x1185b4a8c - rustc_hir_analysis[50d2e10c526ac435]::check_crate
  35:        0x115b70faa - rustc_interface[9ed52e10726157d]::passes::analysis
  36:        0x1196acd8f - rustc_query_system[e535d6d94a1ab2a4]::query::plumbing::try_execute_query::<rustc_query_impl[c1f689d635a76408]::plumbing::QueryCtxt, rustc_query_system[e535d6d94a1ab2a4]::query::caches::DefaultCache<(), core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>>
  37:        0x1197cf0f9 - rustc_query_system[e535d6d94a1ab2a4]::query::plumbing::get_query::<rustc_query_impl[c1f689d635a76408]::queries::analysis, rustc_query_impl[c1f689d635a76408]::plumbing::QueryCtxt>
  38:        0x119922ba7 - <rustc_query_impl[c1f689d635a76408]::Queries as rustc_middle[db449b3460385d6f]::ty::query::QueryEngine>::analysis
  39:        0x115a25aab - <rustc_interface[9ed52e10726157d]::passes::QueryContext>::enter::<rustc_driver[b73731b7ed8e79fd]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>
  40:        0x11598cba5 - <rustc_interface[9ed52e10726157d]::interface::Compiler>::enter::<rustc_driver[b73731b7ed8e79fd]::run_compiler::{closure#1}::{closure#2}, core[95bb6d661b676f4d]::result::Result<core[95bb6d661b676f4d]::option::Option<rustc_interface[9ed52e10726157d]::queries::Linker>, rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>
  41:        0x115a200cb - rustc_span[3733f809f3ebe388]::with_source_map::<core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>, rustc_interface[9ed52e10726157d]::interface::run_compiler<core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>, rustc_driver[b73731b7ed8e79fd]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  42:        0x11598849a - <scoped_tls[c451c38e2ed76225]::ScopedKey<rustc_span[3733f809f3ebe388]::SessionGlobals>>::set::<rustc_interface[9ed52e10726157d]::interface::run_compiler<core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>, rustc_driver[b73731b7ed8e79fd]::run_compiler::{closure#1}>::{closure#0}, core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>
  43:        0x1159ee870 - std[e4564114326e8c6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9ed52e10726157d]::util::run_in_thread_pool_with_globals<rustc_interface[9ed52e10726157d]::interface::run_compiler<core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>, rustc_driver[b73731b7ed8e79fd]::run_compiler::{closure#1}>::{closure#0}, core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>
  44:        0x115a30900 - std[e4564114326e8c6]::panicking::try::<core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>, core[95bb6d661b676f4d]::panic::unwind_safe::AssertUnwindSafe<<std[e4564114326e8c6]::thread::Builder>::spawn_unchecked_<rustc_interface[9ed52e10726157d]::util::run_in_thread_pool_with_globals<rustc_interface[9ed52e10726157d]::interface::run_compiler<core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>, rustc_driver[b73731b7ed8e79fd]::run_compiler::{closure#1}>::{closure#0}, core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>::{closure#1}::{closure#0}>>
  45:        0x1159901e1 - <<std[e4564114326e8c6]::thread::Builder>::spawn_unchecked_<rustc_interface[9ed52e10726157d]::util::run_in_thread_pool_with_globals<rustc_interface[9ed52e10726157d]::interface::run_compiler<core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>, rustc_driver[b73731b7ed8e79fd]::run_compiler::{closure#1}>::{closure#0}, core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[95bb6d661b676f4d]::result::Result<(), rustc_errors[9121627fb7cf2262]::ErrorGuaranteed>>::{closure#1} as core[95bb6d661b676f4d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  46:        0x10646fb5b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd10a5c38d6c64916
  47:        0x10645a19f - std::sys::unix::thread::Thread::new::thread_start::he793914283faf21a
  48:     0x7ff807a764e1 - __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-dev running on x86_64-apple-darwin

query stack during panic:
#0 [explicit_item_bounds] finding item bounds for `f::{opaque#0}`
#1 [collect_mod_item_types] collecting item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

Version

stage1 built from 8681d4c with debug assertions

config.toml
# Includes one of the default files in src/bootstrap/defaults
profile = "compiler"
changelog-seen = 2

[llvm]
download-ci-llvm = true     # Download a pre-built LLVM?
assertions = true           # LLVM assertions on?

[rust]
incremental = true          # Build rustc with incremental compilation?
debug-assertions = true
overflow-checks = true

@rustbot label +F-associated_type_bounds +requires-debug-assertions

Error: Label requires-debug-assertions can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@rustbot label +F-associated_type_bounds

It seems this no longer crashes when checking with debug assertions :)