Skip to content

Commit 3a5bf11

Browse files
Fast-path some relations via strict equality
1 parent ff0ffda commit 3a5bf11

File tree

11 files changed

+67
-2
lines changed

11 files changed

+67
-2
lines changed

‎compiler/rustc_hir_analysis/src/check/dropck.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ impl<'tcx> TypeRelation<'tcx> for SimpleEqRelation<'tcx> {
248248
self.param_env
249249
}
250250

251+
fn fast_equate_combine(&self) -> bool {
252+
true
253+
}
254+
251255
fn tag(&self) -> &'static str {
252256
"dropck::SimpleEqRelation"
253257
}

‎compiler/rustc_infer/src/infer/combine.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,10 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
525525
self.param_env
526526
}
527527

528+
fn fast_equate_combine(&self) -> bool {
529+
false
530+
}
531+
528532
fn tag(&self) -> &'static str {
529533
"Generalizer"
530534
}
@@ -802,6 +806,10 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
802806
self.param_env
803807
}
804808

809+
fn fast_equate_combine(&self) -> bool {
810+
false
811+
}
812+
805813
fn tag(&self) -> &'static str {
806814
"ConstInferUnifier"
807815
}

‎compiler/rustc_infer/src/infer/equate.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> {
3232
self.fields.tcx()
3333
}
3434

35+
fn fast_equate_combine(&self) -> bool {
36+
true
37+
}
38+
3539
fn param_env(&self) -> ty::ParamEnv<'tcx> {
3640
self.fields.param_env
3741
}

‎compiler/rustc_infer/src/infer/error_reporting/mod.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2945,6 +2945,10 @@ impl<'tcx> TypeRelation<'tcx> for SameTypeModuloInfer<'_, 'tcx> {
29452945
"SameTypeModuloInfer"
29462946
}
29472947

2948+
fn fast_equate_combine(&self) -> bool {
2949+
true
2950+
}
2951+
29482952
fn a_is_expected(&self) -> bool {
29492953
true
29502954
}

‎compiler/rustc_infer/src/infer/glb.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> {
3434
self.fields.tcx()
3535
}
3636

37+
fn fast_equate_combine(&self) -> bool {
38+
true
39+
}
40+
3741
fn param_env(&self) -> ty::ParamEnv<'tcx> {
3842
self.fields.param_env
3943
}

‎compiler/rustc_infer/src/infer/lub.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> {
3434
self.fields.tcx()
3535
}
3636

37+
fn fast_equate_combine(&self) -> bool {
38+
true
39+
}
40+
3741
fn param_env(&self) -> ty::ParamEnv<'tcx> {
3842
self.fields.param_env
3943
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,10 @@ where
535535
self.delegate.param_env()
536536
}
537537

538+
fn fast_equate_combine(&self) -> bool {
539+
false
540+
}
541+
538542
fn tag(&self) -> &'static str {
539543
"nll::subtype"
540544
}
@@ -901,6 +905,10 @@ where
901905
self.delegate.param_env()
902906
}
903907

908+
fn fast_equate_combine(&self) -> bool {
909+
false
910+
}
911+
904912
fn tag(&self) -> &'static str {
905913
"nll::generalizer"
906914
}

‎compiler/rustc_infer/src/infer/outlives/test_type_match.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
142142
fn param_env(&self) -> ty::ParamEnv<'tcx> {
143143
self.param_env
144144
}
145+
fn fast_equate_combine(&self) -> bool {
146+
false
147+
}
145148
fn a_is_expected(&self) -> bool {
146149
true
147150
} // irrelevant

‎compiler/rustc_infer/src/infer/sub.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> {
4343
self.fields.param_env
4444
}
4545

46+
fn fast_equate_combine(&self) -> bool {
47+
true
48+
}
49+
4650
fn a_is_expected(&self) -> bool {
4751
self.a_is_expected
4852
}

‎compiler/rustc_middle/src/ty/_match.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
3939
fn param_env(&self) -> ty::ParamEnv<'tcx> {
4040
self.param_env
4141
}
42+
fn fast_equate_combine(&self) -> bool {
43+
false
44+
}
4245
fn a_is_expected(&self) -> bool {
4346
true
4447
} // irrelevant

0 commit comments

Comments
 (0)