use rustc_middle::traits::ChalkRustInterner as RustInterner;
use rustc_middle::ty::subst::{InternalSubsts, Subst, SubstsRef};
-use rustc_middle::ty::{self, AssocItemContainer, AssocKind, TyCtxt};
+use rustc_middle::ty::{self, AssocItemContainer, AssocKind, Binder, TyCtxt};
use rustc_hir::def_id::DefId;
.filter_map(|wc| LowerInto::<Option<chalk_ir::QuantifiedWhereClause<RustInterner<'tcx>>>>::lower_into(wc, &self.interner)).collect();
let sig = self.tcx.fn_sig(def_id);
- // FIXME(chalk): Why does this have a Binder
- let argument_types = sig
- .inputs()
- .skip_binder()
+ // FIXME(chalk): collect into an intermediate SmallVec here since
+ // we need `TypeFoldable` for `no_bound_vars`
+ let argument_types: Binder<Vec<_>> = sig.map_bound(|i| i.inputs().iter().copied().collect());
+ let argument_types = argument_types
+ .no_bound_vars()
+ .expect("FIXME(chalk): late-bound fn parameters not supported in chalk")
.iter()
.map(|t| t.subst(self.tcx, &bound_vars).lower_into(&self.interner))
.collect();
.map(|s| match s {
Solution::Unique(_subst) => {
// FIXME(chalk): handle constraints
- // assert!(_subst.value.constraints.is_empty());
make_solution(_subst.value.subst)
}
Solution::Ambig(_guidance) => {
// run-pass
// compile-flags: -Z chalk
+// FIXME(chalk): remove when uncommented
+#![allow(dead_code, unused_variables)]
trait Foo { }
x: T,
}
+// FIXME(chalk): need late-bound regions on FnDefs
+/*
fn only_foo<T: Foo>(_x: &T) { }
impl<T> S<T> {
only_foo(&self.x)
}
}
+*/
trait Bar { }
impl Bar for u32 { }
impl<T> S<T> {
// Test that the environment of `dummy_bar` adds up with the environment
// of the inherent impl.
+ // FIXME(chalk): need late-bound regions on FnDefs
+ /*
fn dummy_bar<U: Bar>(&self) {
only_foo(&self.x);
only_bar::<U>();
}
+ */
+ fn dummy_bar<U: Bar>() {
+ only_bar::<U>();
+ }
}
fn main() {
x: 5,
};
+ // FIXME(chalk): need late-bound regions on FnDefs
+ /*
s.dummy_foo();
s.dummy_bar::<u32>();
+ */
+ S::<i32>::dummy_bar::<u32>();
}