Skip to content

Commit 45c5586

Browse files
Make TypeRelating more NLL-specific
1 parent c9a8c2e commit 45c5586

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

compiler/rustc_borrowck/src/type_check/relate_tys.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_errors::ErrorGuaranteed;
2-
use rustc_infer::infer::nll_relate::{TypeRelating, TypeRelatingDelegate};
2+
use rustc_infer::infer::nll_relate::{NllTypeRelating, NllTypeRelatingDelegate};
33
use rustc_infer::infer::NllRegionVariableOrigin;
44
use rustc_infer::traits::PredicateObligations;
55
use rustc_middle::mir::ConstraintCategory;
@@ -32,9 +32,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
3232
locations: Locations,
3333
category: ConstraintCategory<'tcx>,
3434
) -> Result<(), NoSolution> {
35-
TypeRelating::new(
35+
NllTypeRelating::new(
3636
self.infcx,
37-
NllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::relate(a, b)),
37+
NllNllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::relate(a, b)),
3838
v,
3939
)
4040
.relate(a, b)?;
@@ -49,17 +49,17 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
4949
locations: Locations,
5050
category: ConstraintCategory<'tcx>,
5151
) -> Result<(), NoSolution> {
52-
TypeRelating::new(
52+
NllTypeRelating::new(
5353
self.infcx,
54-
NllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::other()),
54+
NllNllTypeRelatingDelegate::new(self, locations, category, UniverseInfo::other()),
5555
ty::Variance::Invariant,
5656
)
5757
.relate(a, b)?;
5858
Ok(())
5959
}
6060
}
6161

62-
struct NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
62+
struct NllNllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
6363
type_checker: &'me mut TypeChecker<'bccx, 'tcx>,
6464

6565
/// Where (and why) is this relation taking place?
@@ -73,7 +73,7 @@ struct NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
7373
universe_info: UniverseInfo<'tcx>,
7474
}
7575

76-
impl<'me, 'bccx, 'tcx> NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
76+
impl<'me, 'bccx, 'tcx> NllNllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
7777
fn new(
7878
type_checker: &'me mut TypeChecker<'bccx, 'tcx>,
7979
locations: Locations,
@@ -84,7 +84,7 @@ impl<'me, 'bccx, 'tcx> NllTypeRelatingDelegate<'me, 'bccx, 'tcx> {
8484
}
8585
}
8686

87-
impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
87+
impl<'tcx> NllTypeRelatingDelegate<'tcx> for NllNllTypeRelatingDelegate<'_, '_, 'tcx> {
8888
fn span(&self) -> Span {
8989
self.locations.span(self.type_checker.body)
9090
}

compiler/rustc_infer/src/infer/relate/nll.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ use crate::infer::InferCtxt;
3434
use crate::infer::{TypeVariableOrigin, TypeVariableOriginKind};
3535
use crate::traits::{Obligation, PredicateObligations};
3636

37-
pub struct TypeRelating<'me, 'tcx, D>
37+
pub struct NllTypeRelating<'me, 'tcx, D>
3838
where
39-
D: TypeRelatingDelegate<'tcx>,
39+
D: NllTypeRelatingDelegate<'tcx>,
4040
{
4141
infcx: &'me InferCtxt<'tcx>,
4242

@@ -54,7 +54,7 @@ where
5454
ambient_variance_info: ty::VarianceDiagInfo<'tcx>,
5555
}
5656

57-
pub trait TypeRelatingDelegate<'tcx> {
57+
pub trait NllTypeRelatingDelegate<'tcx> {
5858
fn param_env(&self) -> ty::ParamEnv<'tcx>;
5959
fn span(&self) -> Span;
6060

@@ -98,9 +98,9 @@ pub trait TypeRelatingDelegate<'tcx> {
9898
fn next_placeholder_region(&mut self, placeholder: ty::PlaceholderRegion) -> ty::Region<'tcx>;
9999
}
100100

101-
impl<'me, 'tcx, D> TypeRelating<'me, 'tcx, D>
101+
impl<'me, 'tcx, D> NllTypeRelating<'me, 'tcx, D>
102102
where
103-
D: TypeRelatingDelegate<'tcx>,
103+
D: NllTypeRelatingDelegate<'tcx>,
104104
{
105105
pub fn new(infcx: &'me InferCtxt<'tcx>, delegate: D, ambient_variance: ty::Variance) -> Self {
106106
Self {
@@ -273,9 +273,9 @@ where
273273
}
274274
}
275275

276-
impl<'tcx, D> TypeRelation<'tcx> for TypeRelating<'_, 'tcx, D>
276+
impl<'tcx, D> TypeRelation<'tcx> for NllTypeRelating<'_, 'tcx, D>
277277
where
278-
D: TypeRelatingDelegate<'tcx>,
278+
D: NllTypeRelatingDelegate<'tcx>,
279279
{
280280
fn tcx(&self) -> TyCtxt<'tcx> {
281281
self.infcx.tcx
@@ -516,9 +516,9 @@ where
516516
}
517517
}
518518

519-
impl<'tcx, D> ObligationEmittingRelation<'tcx> for TypeRelating<'_, 'tcx, D>
519+
impl<'tcx, D> ObligationEmittingRelation<'tcx> for NllTypeRelating<'_, 'tcx, D>
520520
where
521-
D: TypeRelatingDelegate<'tcx>,
521+
D: NllTypeRelatingDelegate<'tcx>,
522522
{
523523
fn span(&self) -> Span {
524524
self.delegate.span()

0 commit comments

Comments
 (0)