//@ revisions: rfail1 rfail2 //@ failure-status: 101 //@ error-pattern: not implemented //@ needs-unwind -Cpanic=abort causes abort instead of exit(101) pub trait Interner { type InternedVariableKinds; } trait RustIrDatabase { fn associated_ty_data(&self) -> AssociatedTyDatum; fn impl_datum(&self) -> ImplDatum; } trait Fold { type Result; } impl Fold for Binders where T: HasInterner + Fold, >::Result: HasInterner, I: Interner, { type Result = Binders; } impl Fold for WhereClause { type Result = Binders>; } trait HasInterner { type Interner: Interner; } impl HasInterner for Vec { type Interner = T::Interner; } impl HasInterner for &T { type Interner = T::Interner; } pub struct VariableKind { _marker: std::marker::PhantomData, } struct VariableKinds { _interned: I::InternedVariableKinds, } struct WhereClause { _marker: std::marker::PhantomData, } impl HasInterner for WhereClause { type Interner = I; } struct Binders { _marker: std::marker::PhantomData, } impl HasInterner for Binders { type Interner = T::Interner; } impl Binders<&T> { fn cloned(self) -> Binders { unimplemented!() } } impl Binders { fn map_ref<'a, U, OP>(&'a self, _op: OP) -> Binders where OP: FnOnce(&'a T) -> U, U: HasInterner, { unimplemented!() } } impl Binders where T: Fold + HasInterner, I: Interner, { fn substitute(self) -> T::Result { unimplemented!() } } impl IntoIterator for Binders where V: HasInterner + IntoIterator, U: HasInterner, { type Item = Binders; type IntoIter = BindersIntoIterator; fn into_iter(self) -> Self::IntoIter { unimplemented!() } } struct BindersIntoIterator { _binders: VariableKinds, } impl Iterator for BindersIntoIterator where V: HasInterner + IntoIterator, ::Item: HasInterner, { type Item = Binders<::Item>; fn next(&mut self) -> Option { unimplemented!() } } struct ImplDatum { binders: Binders>, } struct ImplDatumBound { where_clauses: Vec>>, } impl HasInterner for ImplDatumBound { type Interner = I; } struct AssociatedTyDatum { binders: Binders>, } struct AssociatedTyDatumBound { where_clauses: Vec>>, } impl HasInterner for AssociatedTyDatumBound { type Interner = I; } struct ClauseBuilder<'me, I: Interner> { db: &'me dyn RustIrDatabase, } impl<'me, I: Interner> ClauseBuilder<'me, I> { fn new() -> Self { unimplemented!() } fn push_clause(&mut self, _conditions: impl Iterator>>>) { unimplemented!() } } pub(crate) struct Forest { _marker: std::marker::PhantomData, } impl Forest { fn iter_answers<'f>(&'f self) { let builder = &mut ClauseBuilder::::new(); let impl_datum = builder.db.impl_datum(); let impl_where_clauses = impl_datum .binders .map_ref(|b| &b.where_clauses) .into_iter() .map(|wc| wc.cloned().substitute()); let associated_ty = builder.db.associated_ty_data(); let assoc_ty_where_clauses = associated_ty .binders .map_ref(|b| &b.where_clauses) .into_iter() .map(|wc| wc.cloned().substitute()); builder.push_clause(impl_where_clauses.chain(assoc_ty_where_clauses)); } } pub struct SLGSolver { pub(crate) forest: Forest, } impl SLGSolver { fn new() -> Self { unimplemented!() } fn solve_multiple(&self) { let _answers = self.forest.iter_answers(); } } pub struct ChalkIr; impl Interner for ChalkIr { type InternedVariableKinds = Vec>; } fn main() { let solver = SLGSolver::new(); solver.solve_multiple(); }