Skip to content

Commit 6d122dc

Browse files
authored
Unrolled build for rust-lang#116358
Rollup merge of rust-lang#116358 - compiler-errors:match, r=lcnr Rename both of the `Match` relations Both of these names kinda were ambiguous. r? lcnr
2 parents eb0f3ed + 2ffaeb5 commit 6d122dc

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

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

+16-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn extract_verify_if_eq<'tcx>(
4444
test_ty: Ty<'tcx>,
4545
) -> Option<ty::Region<'tcx>> {
4646
assert!(!verify_if_eq_b.has_escaping_bound_vars());
47-
let mut m = Match::new(tcx, param_env);
47+
let mut m = MatchAgainstHigherRankedOutlives::new(tcx, param_env);
4848
let verify_if_eq = verify_if_eq_b.skip_binder();
4949
m.relate(verify_if_eq.ty, test_ty).ok()?;
5050

@@ -87,24 +87,32 @@ pub(super) fn can_match_erased_ty<'tcx>(
8787
// pointless micro-optimization
8888
true
8989
} else {
90-
Match::new(tcx, param_env).relate(outlives_ty, erased_ty).is_ok()
90+
MatchAgainstHigherRankedOutlives::new(tcx, param_env).relate(outlives_ty, erased_ty).is_ok()
9191
}
9292
}
9393

94-
struct Match<'tcx> {
94+
struct MatchAgainstHigherRankedOutlives<'tcx> {
9595
tcx: TyCtxt<'tcx>,
9696
param_env: ty::ParamEnv<'tcx>,
9797
pattern_depth: ty::DebruijnIndex,
9898
map: FxHashMap<ty::BoundRegion, ty::Region<'tcx>>,
9999
}
100100

101-
impl<'tcx> Match<'tcx> {
102-
fn new(tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Match<'tcx> {
103-
Match { tcx, param_env, pattern_depth: ty::INNERMOST, map: FxHashMap::default() }
101+
impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> {
102+
fn new(
103+
tcx: TyCtxt<'tcx>,
104+
param_env: ty::ParamEnv<'tcx>,
105+
) -> MatchAgainstHigherRankedOutlives<'tcx> {
106+
MatchAgainstHigherRankedOutlives {
107+
tcx,
108+
param_env,
109+
pattern_depth: ty::INNERMOST,
110+
map: FxHashMap::default(),
111+
}
104112
}
105113
}
106114

107-
impl<'tcx> Match<'tcx> {
115+
impl<'tcx> MatchAgainstHigherRankedOutlives<'tcx> {
108116
/// Creates the "Error" variant that signals "no match".
109117
fn no_match<T>(&self) -> RelateResult<'tcx, T> {
110118
Err(TypeError::Mismatch)
@@ -134,7 +142,7 @@ impl<'tcx> Match<'tcx> {
134142
}
135143
}
136144

137-
impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
145+
impl<'tcx> TypeRelation<'tcx> for MatchAgainstHigherRankedOutlives<'tcx> {
138146
fn tag(&self) -> &'static str {
139147
"Match"
140148
}

compiler/rustc_middle/src/ty/_match.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ use crate::ty::{self, InferConst, Ty, TyCtxt};
1818
/// Like subtyping, matching is really a binary relation, so the only
1919
/// important thing about the result is Ok/Err. Also, matching never
2020
/// affects any type variables or unification state.
21-
pub struct Match<'tcx> {
21+
pub struct MatchAgainstFreshVars<'tcx> {
2222
tcx: TyCtxt<'tcx>,
2323
param_env: ty::ParamEnv<'tcx>,
2424
}
2525

26-
impl<'tcx> Match<'tcx> {
27-
pub fn new(tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Match<'tcx> {
28-
Match { tcx, param_env }
26+
impl<'tcx> MatchAgainstFreshVars<'tcx> {
27+
pub fn new(tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> MatchAgainstFreshVars<'tcx> {
28+
MatchAgainstFreshVars { tcx, param_env }
2929
}
3030
}
3131

32-
impl<'tcx> TypeRelation<'tcx> for Match<'tcx> {
32+
impl<'tcx> TypeRelation<'tcx> for MatchAgainstFreshVars<'tcx> {
3333
fn tag(&self) -> &'static str {
34-
"Match"
34+
"MatchAgainstFreshVars"
3535
}
3636
fn tcx(&self) -> TyCtxt<'tcx> {
3737
self.tcx

compiler/rustc_trait_selection/src/traits/select/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ use rustc_middle::dep_graph::dep_kinds;
3939
use rustc_middle::dep_graph::DepNodeIndex;
4040
use rustc_middle::mir::interpret::ErrorHandled;
4141
use rustc_middle::traits::DefiningAnchor;
42+
use rustc_middle::ty::_match::MatchAgainstFreshVars;
4243
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
4344
use rustc_middle::ty::fold::BottomUpFolder;
4445
use rustc_middle::ty::relate::TypeRelation;
@@ -2642,7 +2643,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
26422643
current: ty::PolyTraitPredicate<'tcx>,
26432644
param_env: ty::ParamEnv<'tcx>,
26442645
) -> bool {
2645-
let mut matcher = ty::_match::Match::new(self.tcx(), param_env);
2646+
let mut matcher = MatchAgainstFreshVars::new(self.tcx(), param_env);
26462647
matcher.relate(previous, current).is_ok()
26472648
}
26482649

0 commit comments

Comments
 (0)