Nits and change skip_binder to no_bound_vars for fndef
This commit is contained in:
parent
b5d5994a4a
commit
16ad3f302b
@ -8,7 +8,7 @@
|
||||
|
||||
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;
|
||||
|
||||
@ -177,10 +177,12 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
|
||||
.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();
|
||||
|
@ -199,7 +199,6 @@ crate fn evaluate_goal<'tcx>(
|
||||
.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) => {
|
||||
|
@ -1,5 +1,7 @@
|
||||
// run-pass
|
||||
// compile-flags: -Z chalk
|
||||
// FIXME(chalk): remove when uncommented
|
||||
#![allow(dead_code, unused_variables)]
|
||||
|
||||
trait Foo { }
|
||||
|
||||
@ -9,6 +11,8 @@ struct S<T: Foo> {
|
||||
x: T,
|
||||
}
|
||||
|
||||
// FIXME(chalk): need late-bound regions on FnDefs
|
||||
/*
|
||||
fn only_foo<T: Foo>(_x: &T) { }
|
||||
|
||||
impl<T> S<T> {
|
||||
@ -17,6 +21,7 @@ impl<T> S<T> {
|
||||
only_foo(&self.x)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
trait Bar { }
|
||||
impl Bar for u32 { }
|
||||
@ -26,10 +31,16 @@ fn only_bar<T: Bar>() { }
|
||||
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() {
|
||||
@ -37,6 +48,10 @@ fn main() {
|
||||
x: 5,
|
||||
};
|
||||
|
||||
// FIXME(chalk): need late-bound regions on FnDefs
|
||||
/*
|
||||
s.dummy_foo();
|
||||
s.dummy_bar::<u32>();
|
||||
*/
|
||||
S::<i32>::dummy_bar::<u32>();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user