Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escaping late-bound regions during canonicalization with associated type bounds #81193

Closed
jackh726 opened this issue Jan 19, 2021 · 2 comments · Fixed by #84485
Closed

Escaping late-bound regions during canonicalization with associated type bounds #81193

jackh726 opened this issue Jan 19, 2021 · 2 comments · Fixed by #84485
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-associated_type_bounds `#![feature(associated_type_bounds)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jackh726
Copy link
Member

jackh726 commented Jan 19, 2021

Code

#![feature(associated_type_bounds)]
trait A<'a, 'b> {}
trait B<'a, 'b, 'c> {}
fn err<'u, 'a, F>() where for<'b> F: Iterator<Item: for<'c> B<'a, 'b, 'c> + for<'c> A<'a, 'c>> {}

Meta

rustc 1.51.0-nightly (d98d2f57d 2021-01-18)

Error output

error: internal compiler error: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:310:21: escaping late-bound region during canonicalization
Backtrace

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:958:9
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::bug
   2: rustc_errors::Handler::bug
   3: rustc_middle::ty::context::tls::with_opt
   4: rustc_middle::util::bug::opt_span_bug_fmt
   5: rustc_middle::util::bug::bug_fmt
   6: <rustc_infer::infer::canonical::canonicalizer::Canonicalizer as rustc_middle::ty::fold::TypeFolder>::fold_region
   7: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
   8: rustc_middle::ty::fold::TypeFoldable::fold_with
   9: rustc_middle::ty::fold::TypeFoldable::fold_with
  10: <smallvec::SmallVec<A> as core::iter::traits::collect::Extend<<A as smallvec::Array>::Item>>::extend
  11: rustc_middle::ty::util::fold_list
  12: rustc_infer::infer::canonical::canonicalizer::Canonicalizer::canonicalize
  13: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::outlives_bounds::InferCtxtExt>::implied_outlives_bounds
  14: <rustc_infer::infer::outlives::env::OutlivesEnvironment as rustc_trait_selection::infer::OutlivesEnvironmentExt>::add_implied_bounds
  15: rustc_typeck::check::regionck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::regionck_item
  16: rustc_infer::infer::InferCtxtBuilder::enter
  17: rustc_typeck::check::wfcheck::check_item_well_formed
  18: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_item_well_formed>::compute
  19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  20: rustc_data_structures::stack::ensure_sufficient_stack
  21: rustc_query_system::query::plumbing::force_query_with_job
  22: rustc_query_system::query::plumbing::get_query_impl
  23: rustc_query_system::query::plumbing::ensure_query_impl
  24: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::itemlikevisit::ParItemLikeVisitor>::visit_item
  25: rustc_data_structures::sync::par_for_each_in
  26: rustc_hir::hir::Crate::par_visit_all_item_likes
  27: rustc_typeck::check_crate
  28: rustc_interface::passes::analysis
  29: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  30: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  31: rustc_data_structures::stack::ensure_sufficient_stack
  32: rustc_query_system::query::plumbing::force_query_with_job
  33: rustc_query_system::query::plumbing::get_query_impl
  34: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  35: rustc_span::with_source_map
  36: rustc_interface::interface::create_compiler_and_run
  37: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.51.0-nightly (d98d2f57d 2021-01-18) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type bin

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

query stack during panic:
#0 [check_item_well_formed] checking that `err` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack

Playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=1ac61e265f265fb1a096491da37893ff

@jackh726 jackh726 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 19, 2021
@jackh726
Copy link
Member Author

jackh726 commented Jan 19, 2021

@rustbot label: +requires-nightly +F-associated_type_bounds

@rustbot rustbot added requires-nightly This issue requires a nightly compiler in some way. F-associated_type_bounds `#![feature(associated_type_bounds)]` labels Jan 19, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Jan 30, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jan 30, 2021
@JohnTitor
Copy link
Member

Triage: The ICE has been fixed in the latest nightly, I guess #84377 fixed it? Marking as E-needs-test.

@JohnTitor JohnTitor added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Apr 23, 2021
marmeladema added a commit to marmeladema/rust that referenced this issue Apr 23, 2021
@bors bors closed this as completed in 740e1f4 Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. F-associated_type_bounds `#![feature(associated_type_bounds)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants