Stub methods in infer
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
This commit is contained in:
parent
9a9aa5b46a
commit
63b7572d0d
6 changed files with 34 additions and 19 deletions
|
|
@ -443,6 +443,9 @@ impl<'tcx> CanonicalVarValues<'tcx> {
|
|||
UnpackedKind::Lifetime(..) => tcx.mk_region(
|
||||
ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(i))
|
||||
).into(),
|
||||
UnpackedKind::Const(..) => {
|
||||
unimplemented!() // FIXME(const_generics)
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,6 +315,10 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
|
|||
obligations.extend(ok.into_obligations());
|
||||
}
|
||||
|
||||
(UnpackedKind::Const(..), UnpackedKind::Const(..)) => {
|
||||
unimplemented!() // FIXME(const_generics)
|
||||
}
|
||||
|
||||
_ => {
|
||||
bug!(
|
||||
"kind mismatch, cannot unify {:?} and {:?}",
|
||||
|
|
@ -473,6 +477,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
|
|||
opt_values[br.assert_bound_var()] = Some(*original_value);
|
||||
}
|
||||
}
|
||||
UnpackedKind::Const(..) => {
|
||||
unimplemented!() // FIXME(const_generics)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -568,6 +575,11 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
|
|||
ty::OutlivesPredicate(t1, r2)
|
||||
)
|
||||
),
|
||||
UnpackedKind::Const(..) => {
|
||||
// Consts cannot outlive one another, so we don't expect to
|
||||
// ecounter this branch.
|
||||
span_bug!(cause.span, "unexpected const outlives {:?}", constraint);
|
||||
}
|
||||
}
|
||||
)
|
||||
})
|
||||
|
|
@ -602,6 +614,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
|
|||
obligations
|
||||
.extend(self.at(cause, param_env).eq(v1, v2)?.into_obligations());
|
||||
}
|
||||
(UnpackedKind::Const(..), UnpackedKind::Const(..)) => {
|
||||
unimplemented!() // FIXME(const_generics)
|
||||
}
|
||||
_ => {
|
||||
bug!("kind mismatch, cannot unify {:?} and {:?}", value1, value2,);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, '
|
|||
|
||||
let origin = *variables.var_origin(vid);
|
||||
let new_var_id = variables.new_var(self.for_universe, false, origin);
|
||||
let u = self.tcx().mk_var(new_var_id);
|
||||
let u = self.tcx().mk_ty_var(new_var_id);
|
||||
debug!("generalize: replacing original vid={:?} with new={:?}",
|
||||
vid, u);
|
||||
return Ok(u);
|
||||
|
|
|
|||
|
|
@ -691,17 +691,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
) -> SubstsRef<'tcx> {
|
||||
let generics = self.tcx.generics_of(def_id);
|
||||
let mut num_supplied_defaults = 0;
|
||||
let mut type_params = generics
|
||||
.params
|
||||
.iter()
|
||||
.rev()
|
||||
.filter_map(|param| match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime => None,
|
||||
ty::GenericParamDefKind::Type { has_default, .. } => {
|
||||
Some((param.def_id, has_default))
|
||||
}
|
||||
})
|
||||
.peekable();
|
||||
let mut type_params = generics.params.iter().rev().filter_map(|param| match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime => None,
|
||||
ty::GenericParamDefKind::Type { has_default, .. } => Some((param.def_id, has_default)),
|
||||
ty::GenericParamDefKind::Const => None, // FIXME(const_generics:defaults)
|
||||
}).peekable();
|
||||
let has_default = {
|
||||
let has_default = type_params.peek().map(|(_, has_default)| has_default);
|
||||
*has_default.unwrap_or(&false)
|
||||
|
|
|
|||
|
|
@ -656,7 +656,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
type_variables
|
||||
.unsolved_variables()
|
||||
.into_iter()
|
||||
.map(|t| self.tcx.mk_var(t))
|
||||
.map(|t| self.tcx.mk_ty_var(t))
|
||||
.chain(
|
||||
(0..int_unification_table.len())
|
||||
.map(|i| ty::IntVid { index: i as u32 })
|
||||
|
|
@ -981,7 +981,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn next_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx> {
|
||||
self.tcx.mk_var(self.next_ty_var_id(false, origin))
|
||||
self.tcx.mk_ty_var(self.next_ty_var_id(false, origin))
|
||||
}
|
||||
|
||||
pub fn next_ty_var_in_universe(
|
||||
|
|
@ -992,11 +992,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
let vid = self.type_variables
|
||||
.borrow_mut()
|
||||
.new_var(universe, false, origin);
|
||||
self.tcx.mk_var(vid)
|
||||
self.tcx.mk_ty_var(vid)
|
||||
}
|
||||
|
||||
pub fn next_diverging_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx> {
|
||||
self.tcx.mk_var(self.next_ty_var_id(true, origin))
|
||||
self.tcx.mk_ty_var(self.next_ty_var_id(true, origin))
|
||||
}
|
||||
|
||||
pub fn next_int_var_id(&self) -> IntVid {
|
||||
|
|
@ -1081,7 +1081,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
TypeVariableOrigin::TypeParameterDefinition(span, param.name),
|
||||
);
|
||||
|
||||
self.tcx.mk_var(ty_var_id).into()
|
||||
self.tcx.mk_ty_var(ty_var_id).into()
|
||||
}
|
||||
GenericParamDefKind::Const { .. } => {
|
||||
unimplemented!() // FIXME(const_generics)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ where
|
|||
ty::Projection(projection_ty)
|
||||
if D::normalization() == NormalizationStrategy::Lazy =>
|
||||
{
|
||||
return Ok(self.relate_projection_ty(projection_ty, self.infcx.tcx.mk_var(vid)));
|
||||
return Ok(self.relate_projection_ty(projection_ty, self.infcx.tcx.mk_ty_var(vid)));
|
||||
}
|
||||
|
||||
_ => (),
|
||||
|
|
@ -764,7 +764,7 @@ where
|
|||
// the universe `_universe`.
|
||||
let new_var_id = variables.new_var(self.universe, false, origin);
|
||||
|
||||
let u = self.tcx().mk_var(new_var_id);
|
||||
let u = self.tcx().mk_ty_var(new_var_id);
|
||||
debug!(
|
||||
"generalize: replacing original vid={:?} with new={:?}",
|
||||
vid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue