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

ICE: Projection bound ... was applicable to ... but now is not #77656

Closed
tavianator opened this issue Oct 7, 2020 · 4 comments · Fixed by #77720
Closed

ICE: Projection bound ... was applicable to ... but now is not #77656

tavianator opened this issue Oct 7, 2020 · 4 comments · Fixed by #77720
Assignees
Labels
A-associated-items Area: Associated items (types, constants & functions) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tavianator
Copy link
Contributor

I noticed that my crate https://github.com/tavianator/acap doesn't build with the latest nightly. Here's a reduced testcase:

Code

pub trait Value: PartialOrd {}

impl<T: PartialOrd> Value for T {}

pub trait Distance
where
    Self: PartialOrd<<Self as Distance>::Value>,
    Self: PartialOrd,
{
    type Value: Value;
}

impl<T: Value> Distance for T {
    type Value = T;
}

pub trait Proximity<T = Self> {
    type Distance: Distance;
}

pub type DistanceValue<K, V = K> = <<K as Proximity<V>>::Distance as Distance>::Value;

struct VpNode<T, R = DistanceValue<T>> {
    item: T,
    radius: R,
}

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0085a0f26ba32eace4c638a3663606a7

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (98edd1fbf 2020-10-06)
binary: rustc
commit-hash: 98edd1fbf8a68977a2a7c1312eb1ebff80515a92
commit-date: 2020-10-06
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: compiler/rustc_trait_selection/src/traits/select/confirmation.rs:158:25: Projection bound `Binder(<<Self as Proximity<T>>::Distance as std::cmp::PartialOrd<<<Self as Proximity<T>>::Distance as Distance>::Value>>)` was applicable to `Obligation(predicate=Binder(TraitPredicate(<<Self as Proximity<T>>::Distance as std::cmp::PartialOrd>)), depth=0)` but now is not
Backtrace

error: internal compiler error: compiler/rustc_trait_selection/src/traits/select/confirmation.rs:158:25: Projection bound `Binder(<<Self as Proximity<T>>::Distance as std::cmp::PartialOrd<<<Self as Proximity<T>>::Distance as Distance>::Value>>)` was applicable to `Obligation(predicate=Binder(TraitPredicate(<<Self as Proximity<T>>::Distance as std::cmp::PartialOrd>)), depth=0)` but now is not

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::bug
   2: rustc_errors::Handler::bug
   3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   4: rustc_middle::ty::context::tls::with_opt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt
   6: rustc_middle::util::bug::opt_span_bug_fmt
   7: rustc_middle::util::bug::bug_fmt
   8: rustc_trait_selection::traits::select::confirmation::<impl rustc_trait_selection::traits::select::SelectionContext>::confirm_projection_candidate::{{closure}}::{{closure}}
   9: rustc_infer::infer::InferCtxt::commit_unconditionally
  10: rustc_trait_selection::traits::select::confirmation::<impl rustc_trait_selection::traits::select::SelectionContext>::confirm_candidate
  11: rustc_trait_selection::traits::select::SelectionContext::select
  12: rustc_trait_selection::traits::fulfill::FulfillProcessor::process_trait_obligation
  13: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
  14: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
  15: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  16: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_all_or_error
  17: rustc_typeck::check::fn_ctxt::FnCtxt::select_all_obligations_or_error
  18: rustc_infer::infer::InferCtxtBuilder::enter
  19: rustc_typeck::check::wfcheck::check_associated_item
  20: rustc_typeck::check::wfcheck::check_trait_item
  21: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_trait_item_well_formed>::compute
  22: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  23: rustc_data_structures::stack::ensure_sufficient_stack
  24: rustc_query_system::query::plumbing::get_query_impl
  25: rustc_query_system::query::plumbing::ensure_query_impl
  26: rustc_data_structures::sync::par_for_each_in
  27: rustc_typeck::check::check::check_wf_new
  28: rustc_typeck::check_crate
  29: rustc_interface::passes::analysis
  30: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  31: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  32: rustc_data_structures::stack::ensure_sufficient_stack
  33: rustc_query_system::query::plumbing::get_query_impl
  34: rustc_interface::passes::QueryContext::enter
  35: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  36: rustc_span::with_source_map
  37: rustc_interface::interface::create_compiler_and_run
  38: scoped_tls::ScopedKey<T>::set
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.49.0-nightly (98edd1fbf 2020-10-06) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_trait_item_well_formed] checking that `Proximity::Distance` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

@tavianator tavianator 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 Oct 7, 2020
@jonas-schievink jonas-schievink added A-associated-items Area: Associated items (types, constants & functions) regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Oct 7, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 7, 2020
@matthewjasper matthewjasper self-assigned this Oct 7, 2020
@Julian-Wollersberger

This comment has been minimized.

@spastorino

This comment has been minimized.

@spastorino
Copy link
Member

Assigning P-critical as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@spastorino spastorino added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 7, 2020
@Stupremee
Copy link
Member

Stupremee commented Oct 7, 2020

Regressed in 08e2d46.
Auto merge of #73905

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. 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.

7 participants