mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
Make TypeRelating more NLL-specific
This commit is contained in:
parent
da1e6a8c1c
commit
6c030332ee
@ -1,5 +1,5 @@
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_infer::infer::nll_relate::{TypeRelating, TypeRelatingDelegate};
|
||||
use rustc_infer::infer::nll_relate::{NllTypeRelating, NllTypeRelatingDelegate};
|
||||
use rustc_infer::infer::NllRegionVariableOrigin;
|
||||
use rustc_infer::traits::PredicateObligations;
|
||||
use rustc_middle::mir::ConstraintCategory;
|
||||
@ -32,7 +32,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
locations: Locations,
|
||||
category: ConstraintCategory<'tcx>,
|
||||
) -> Result<(), NoSolution> {
|
||||
TypeRelating::new(
|
||||
NllTypeRelating::new(
|
||||
self.infcx,
|
||||
NllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::relate(a, b)),
|
||||
v,
|
||||
@ -49,7 +49,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
locations: Locations,
|
||||
category: ConstraintCategory<'tcx>,
|
||||
) -> Result<(), NoSolution> {
|
||||
TypeRelating::new(
|
||||
NllTypeRelating::new(
|
||||
self.infcx,
|
||||
NllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::other()),
|
||||
ty::Variance::Invariant,
|
||||
@ -84,7 +84,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
|
||||
impl<'tcx> NllTypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
|
||||
fn span(&self) -> Span {
|
||||
self.locations.span(self.type_checker.body)
|
||||
}
|
||||
|
@ -34,9 +34,9 @@ use crate::infer::InferCtxt;
|
||||
use crate::infer::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
use crate::traits::{Obligation, PredicateObligations};
|
||||
|
||||
pub struct TypeRelating<'me, 'tcx, D>
|
||||
pub struct NllTypeRelating<'me, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
D: NllTypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
infcx: &'me InferCtxt<'tcx>,
|
||||
|
||||
@ -54,7 +54,7 @@ where
|
||||
ambient_variance_info: ty::VarianceDiagInfo<'tcx>,
|
||||
}
|
||||
|
||||
pub trait TypeRelatingDelegate<'tcx> {
|
||||
pub trait NllTypeRelatingDelegate<'tcx> {
|
||||
fn param_env(&self) -> ty::ParamEnv<'tcx>;
|
||||
fn span(&self) -> Span;
|
||||
|
||||
@ -98,9 +98,9 @@ pub trait TypeRelatingDelegate<'tcx> {
|
||||
fn next_placeholder_region(&mut self, placeholder: ty::PlaceholderRegion) -> ty::Region<'tcx>;
|
||||
}
|
||||
|
||||
impl<'me, 'tcx, D> TypeRelating<'me, 'tcx, D>
|
||||
impl<'me, 'tcx, D> NllTypeRelating<'me, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
D: NllTypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
pub fn new(infcx: &'me InferCtxt<'tcx>, delegate: D, ambient_variance: ty::Variance) -> Self {
|
||||
Self {
|
||||
@ -273,9 +273,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, D> TypeRelation<'tcx> for TypeRelating<'_, 'tcx, D>
|
||||
impl<'tcx, D> TypeRelation<'tcx> for NllTypeRelating<'_, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
D: NllTypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
fn tcx(&self) -> TyCtxt<'tcx> {
|
||||
self.infcx.tcx
|
||||
@ -514,9 +514,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, D> ObligationEmittingRelation<'tcx> for TypeRelating<'_, 'tcx, D>
|
||||
impl<'tcx, D> ObligationEmittingRelation<'tcx> for NllTypeRelating<'_, 'tcx, D>
|
||||
where
|
||||
D: TypeRelatingDelegate<'tcx>,
|
||||
D: NllTypeRelatingDelegate<'tcx>,
|
||||
{
|
||||
fn span(&self) -> Span {
|
||||
self.delegate.span()
|
||||
|
Loading…
Reference in New Issue
Block a user