Skip to content

Commit 63b7572

Browse files
varkoryodaldevoid
andcommitted
Stub methods in infer
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
1 parent 9a9aa5b commit 63b7572

File tree

6 files changed

+34
-19
lines changed

6 files changed

+34
-19
lines changed

src/librustc/infer/canonical/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ impl<'tcx> CanonicalVarValues<'tcx> {
443443
UnpackedKind::Lifetime(..) => tcx.mk_region(
444444
ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(i))
445445
).into(),
446+
UnpackedKind::Const(..) => {
447+
unimplemented!() // FIXME(const_generics)
448+
}
446449
})
447450
.collect()
448451
}

src/librustc/infer/canonical/query_response.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,10 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
315315
obligations.extend(ok.into_obligations());
316316
}
317317

318+
(UnpackedKind::Const(..), UnpackedKind::Const(..)) => {
319+
unimplemented!() // FIXME(const_generics)
320+
}
321+
318322
_ => {
319323
bug!(
320324
"kind mismatch, cannot unify {:?} and {:?}",
@@ -473,6 +477,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
473477
opt_values[br.assert_bound_var()] = Some(*original_value);
474478
}
475479
}
480+
UnpackedKind::Const(..) => {
481+
unimplemented!() // FIXME(const_generics)
482+
}
476483
}
477484
}
478485

@@ -568,6 +575,11 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
568575
ty::OutlivesPredicate(t1, r2)
569576
)
570577
),
578+
UnpackedKind::Const(..) => {
579+
// Consts cannot outlive one another, so we don't expect to
580+
// ecounter this branch.
581+
span_bug!(cause.span, "unexpected const outlives {:?}", constraint);
582+
}
571583
}
572584
)
573585
})
@@ -602,6 +614,9 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
602614
obligations
603615
.extend(self.at(cause, param_env).eq(v1, v2)?.into_obligations());
604616
}
617+
(UnpackedKind::Const(..), UnpackedKind::Const(..)) => {
618+
unimplemented!() // FIXME(const_generics)
619+
}
605620
_ => {
606621
bug!("kind mismatch, cannot unify {:?} and {:?}", value1, value2,);
607622
}

src/librustc/infer/combine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, '
449449

450450
let origin = *variables.var_origin(vid);
451451
let new_var_id = variables.new_var(self.for_universe, false, origin);
452-
let u = self.tcx().mk_var(new_var_id);
452+
let u = self.tcx().mk_ty_var(new_var_id);
453453
debug!("generalize: replacing original vid={:?} with new={:?}",
454454
vid, u);
455455
return Ok(u);

src/librustc/infer/error_reporting/mod.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -691,17 +691,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
691691
) -> SubstsRef<'tcx> {
692692
let generics = self.tcx.generics_of(def_id);
693693
let mut num_supplied_defaults = 0;
694-
let mut type_params = generics
695-
.params
696-
.iter()
697-
.rev()
698-
.filter_map(|param| match param.kind {
699-
ty::GenericParamDefKind::Lifetime => None,
700-
ty::GenericParamDefKind::Type { has_default, .. } => {
701-
Some((param.def_id, has_default))
702-
}
703-
})
704-
.peekable();
694+
let mut type_params = generics.params.iter().rev().filter_map(|param| match param.kind {
695+
ty::GenericParamDefKind::Lifetime => None,
696+
ty::GenericParamDefKind::Type { has_default, .. } => Some((param.def_id, has_default)),
697+
ty::GenericParamDefKind::Const => None, // FIXME(const_generics:defaults)
698+
}).peekable();
705699
let has_default = {
706700
let has_default = type_params.peek().map(|(_, has_default)| has_default);
707701
*has_default.unwrap_or(&false)

src/librustc/infer/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
656656
type_variables
657657
.unsolved_variables()
658658
.into_iter()
659-
.map(|t| self.tcx.mk_var(t))
659+
.map(|t| self.tcx.mk_ty_var(t))
660660
.chain(
661661
(0..int_unification_table.len())
662662
.map(|i| ty::IntVid { index: i as u32 })
@@ -981,7 +981,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
981981
}
982982

983983
pub fn next_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx> {
984-
self.tcx.mk_var(self.next_ty_var_id(false, origin))
984+
self.tcx.mk_ty_var(self.next_ty_var_id(false, origin))
985985
}
986986

987987
pub fn next_ty_var_in_universe(
@@ -992,11 +992,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
992992
let vid = self.type_variables
993993
.borrow_mut()
994994
.new_var(universe, false, origin);
995-
self.tcx.mk_var(vid)
995+
self.tcx.mk_ty_var(vid)
996996
}
997997

998998
pub fn next_diverging_ty_var(&self, origin: TypeVariableOrigin) -> Ty<'tcx> {
999-
self.tcx.mk_var(self.next_ty_var_id(true, origin))
999+
self.tcx.mk_ty_var(self.next_ty_var_id(true, origin))
10001000
}
10011001

10021002
pub fn next_int_var_id(&self) -> IntVid {
@@ -1081,7 +1081,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
10811081
TypeVariableOrigin::TypeParameterDefinition(span, param.name),
10821082
);
10831083

1084-
self.tcx.mk_var(ty_var_id).into()
1084+
self.tcx.mk_ty_var(ty_var_id).into()
1085+
}
1086+
GenericParamDefKind::Const { .. } => {
1087+
unimplemented!() // FIXME(const_generics)
10851088
}
10861089
}
10871090
}

src/librustc/infer/nll_relate/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ where
310310
ty::Projection(projection_ty)
311311
if D::normalization() == NormalizationStrategy::Lazy =>
312312
{
313-
return Ok(self.relate_projection_ty(projection_ty, self.infcx.tcx.mk_var(vid)));
313+
return Ok(self.relate_projection_ty(projection_ty, self.infcx.tcx.mk_ty_var(vid)));
314314
}
315315

316316
_ => (),
@@ -764,7 +764,7 @@ where
764764
// the universe `_universe`.
765765
let new_var_id = variables.new_var(self.universe, false, origin);
766766

767-
let u = self.tcx().mk_var(new_var_id);
767+
let u = self.tcx().mk_ty_var(new_var_id);
768768
debug!(
769769
"generalize: replacing original vid={:?} with new={:?}",
770770
vid,

0 commit comments

Comments
 (0)