Tidy up
This commit is contained in:
parent
e88df943dd
commit
4bcf013438
6 changed files with 38 additions and 13 deletions
|
@ -38,12 +38,16 @@ pub struct Bivariate<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> Bivariate<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> Bivariate<'combine, 'infcx, 'gcx, 'tcx> {
|
||||||
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool) -> Bivariate<'combine, 'infcx, 'gcx, 'tcx> {
|
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
|
||||||
|
-> Bivariate<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
Bivariate { fields: fields, a_is_expected: a_is_expected }
|
Bivariate { fields: fields, a_is_expected: a_is_expected }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Bivariate<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
|
||||||
|
for Bivariate<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
fn tag(&self) -> &'static str { "Bivariate" }
|
fn tag(&self) -> &'static str { "Bivariate" }
|
||||||
|
|
||||||
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
|
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
|
||||||
|
|
|
@ -251,7 +251,8 @@ impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> {
|
||||||
BiTo => self.bivariate(a_is_expected).relate(&a_ty, &b_ty),
|
BiTo => self.bivariate(a_is_expected).relate(&a_ty, &b_ty),
|
||||||
EqTo => self.equate(a_is_expected).relate(&a_ty, &b_ty),
|
EqTo => self.equate(a_is_expected).relate(&a_ty, &b_ty),
|
||||||
SubtypeOf => self.sub(a_is_expected).relate(&a_ty, &b_ty),
|
SubtypeOf => self.sub(a_is_expected).relate(&a_ty, &b_ty),
|
||||||
SupertypeOf => self.sub(a_is_expected).relate_with_variance(ty::Contravariant, &a_ty, &b_ty),
|
SupertypeOf => self.sub(a_is_expected).relate_with_variance(
|
||||||
|
ty::Contravariant, &a_ty, &b_ty),
|
||||||
}?;
|
}?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,12 +23,16 @@ pub struct Equate<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> Equate<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> Equate<'combine, 'infcx, 'gcx, 'tcx> {
|
||||||
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool) -> Equate<'combine, 'infcx, 'gcx, 'tcx> {
|
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
|
||||||
|
-> Equate<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
Equate { fields: fields, a_is_expected: a_is_expected }
|
Equate { fields: fields, a_is_expected: a_is_expected }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Equate<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
|
||||||
|
for Equate<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
fn tag(&self) -> &'static str { "Equate" }
|
fn tag(&self) -> &'static str { "Equate" }
|
||||||
|
|
||||||
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
|
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
|
||||||
|
|
|
@ -23,12 +23,16 @@ pub struct Glb<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> Glb<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> Glb<'combine, 'infcx, 'gcx, 'tcx> {
|
||||||
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool) -> Glb<'combine, 'infcx, 'gcx, 'tcx> {
|
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
|
||||||
|
-> Glb<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
Glb { fields: fields, a_is_expected: a_is_expected }
|
Glb { fields: fields, a_is_expected: a_is_expected }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Glb<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
|
||||||
|
for Glb<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
fn tag(&self) -> &'static str { "Glb" }
|
fn tag(&self) -> &'static str { "Glb" }
|
||||||
|
|
||||||
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
|
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
|
||||||
|
@ -71,7 +75,9 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Glb<'com
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> LatticeDir<'infcx, 'gcx, 'tcx> for Glb<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> LatticeDir<'infcx, 'gcx, 'tcx>
|
||||||
|
for Glb<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'gcx, 'tcx> {
|
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'gcx, 'tcx> {
|
||||||
self.fields.infcx
|
self.fields.infcx
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,16 @@ pub struct Lub<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> Lub<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> Lub<'combine, 'infcx, 'gcx, 'tcx> {
|
||||||
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool) -> Lub<'combine, 'infcx, 'gcx, 'tcx> {
|
pub fn new(fields: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
|
||||||
|
-> Lub<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
Lub { fields: fields, a_is_expected: a_is_expected }
|
Lub { fields: fields, a_is_expected: a_is_expected }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Lub<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
|
||||||
|
for Lub<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
fn tag(&self) -> &'static str { "Lub" }
|
fn tag(&self) -> &'static str { "Lub" }
|
||||||
|
|
||||||
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
|
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.tcx() }
|
||||||
|
@ -71,7 +75,9 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Lub<'com
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> LatticeDir<'infcx, 'gcx, 'tcx> for Lub<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> LatticeDir<'infcx, 'gcx, 'tcx>
|
||||||
|
for Lub<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'gcx, 'tcx> {
|
fn infcx(&self) -> &'infcx InferCtxt<'infcx, 'gcx, 'tcx> {
|
||||||
self.fields.infcx
|
self.fields.infcx
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,9 @@ pub struct Sub<'combine, 'infcx: 'combine, 'gcx: 'infcx+'tcx, 'tcx: 'infcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> {
|
||||||
pub fn new(f: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool) -> Sub<'combine, 'infcx, 'gcx, 'tcx> {
|
pub fn new(f: &'combine mut CombineFields<'infcx, 'gcx, 'tcx>, a_is_expected: bool)
|
||||||
|
-> Sub<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
Sub { fields: f, a_is_expected: a_is_expected }
|
Sub { fields: f, a_is_expected: a_is_expected }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +38,9 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> for Sub<'combine, 'infcx, 'gcx, 'tcx> {
|
impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx>
|
||||||
|
for Sub<'combine, 'infcx, 'gcx, 'tcx>
|
||||||
|
{
|
||||||
fn tag(&self) -> &'static str { "Sub" }
|
fn tag(&self) -> &'static str { "Sub" }
|
||||||
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.infcx.tcx }
|
fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> { self.fields.infcx.tcx }
|
||||||
fn a_is_expected(&self) -> bool { self.a_is_expected }
|
fn a_is_expected(&self) -> bool { self.a_is_expected }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue