Skip to content

Commit 6e05dab

Browse files
committed
more easy changes
1 parent 1e35938 commit 6e05dab

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

compiler/rustc_infer/src/infer/lattice.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ where
5555
return Ok(a);
5656
}
5757

58+
let span = this.cause().span;
5859
let infcx = this.infcx();
5960
let a = infcx.inner.type_variables().replace_if_possible(a);
6061
let b = infcx.inner.type_variables().replace_if_possible(b);
@@ -78,18 +79,20 @@ where
7879
// iterate on the subtype obligations that are returned, but I
7980
// think this suffices. -nmatsakis
8081
(&ty::Infer(TyVar(..)), _) => {
81-
let v = infcx.next_ty_var(TypeVariableOrigin {
82+
let origin = TypeVariableOrigin {
8283
kind: TypeVariableOriginKind::LatticeVariable,
83-
span: this.cause().span,
84-
});
84+
span,
85+
};
86+
let v = infcx.next_ty_var(origin);
8587
this.relate_bound(v, b, a)?;
8688
Ok(v)
8789
}
8890
(_, &ty::Infer(TyVar(..))) => {
89-
let v = infcx.next_ty_var(TypeVariableOrigin {
91+
let origin = TypeVariableOrigin {
9092
kind: TypeVariableOriginKind::LatticeVariable,
91-
span: this.cause().span,
92-
});
93+
span,
94+
};
95+
let v = infcx.next_ty_var(origin);
9396
this.relate_bound(v, a, b)?;
9497
Ok(v)
9598
}

compiler/rustc_infer/src/infer/lub.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ impl TypeRelation<'tcx> for Lub<'_, 'combine, 'infcx, 'tcx> {
6767
debug!("{}.regions({:?}, {:?})", self.tag(), a, b);
6868

6969
let origin = Subtype(box self.fields.trace.clone());
70+
let tcx = self.tcx();
7071
Ok(self.fields.infcx.inner.unwrap_region_constraints().lub_regions(
71-
self.tcx(),
72+
tcx,
7273
origin,
7374
a,
7475
b,

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ where
314314
}
315315

316316
ty::Projection(projection_ty) if D::normalization() == NormalizationStrategy::Lazy => {
317-
return Ok(self.relate_projection_ty(projection_ty, self.delegate.infcx().tcx.mk_ty_var(vid)));
317+
let ty_var = self.delegate.infcx().tcx.mk_ty_var(vid);
318+
return Ok(self.relate_projection_ty(projection_ty, ty_var));
318319
}
319320

320321
_ => (),

compiler/rustc_infer/src/infer/sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl TypeRelation<'tcx> for Sub<'_, 'combine, 'infcx, 'tcx> {
8080
return Ok(a);
8181
}
8282

83-
let infcx = self.fields.infcx;
83+
let infcx = &mut *self.fields.infcx;
8484
let a = infcx.inner.type_variables().replace_if_possible(a);
8585
let b = infcx.inner.type_variables().replace_if_possible(b);
8686
match (a.kind(), b.kind()) {

0 commit comments

Comments
 (0)