Skip to content

Commit 9e630d3

Browse files
PolyTraitRefs -> TraitRefs
1 parent d2ec957 commit 9e630d3

File tree

6 files changed

+20
-43
lines changed

6 files changed

+20
-43
lines changed

compiler/rustc_infer/src/infer/at.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -424,25 +424,7 @@ impl<'tcx> ToTrace<'tcx> for ty::TraitRef<'tcx> {
424424
) -> TypeTrace<'tcx> {
425425
TypeTrace {
426426
cause: cause.clone(),
427-
values: PolyTraitRefs(ExpectedFound::new(
428-
a_is_expected,
429-
ty::Binder::dummy(a),
430-
ty::Binder::dummy(b),
431-
)),
432-
}
433-
}
434-
}
435-
436-
impl<'tcx> ToTrace<'tcx> for ty::PolyTraitRef<'tcx> {
437-
fn to_trace(
438-
cause: &ObligationCause<'tcx>,
439-
a_is_expected: bool,
440-
a: Self,
441-
b: Self,
442-
) -> TypeTrace<'tcx> {
443-
TypeTrace {
444-
cause: cause.clone(),
445-
values: PolyTraitRefs(ExpectedFound::new(a_is_expected, a, b)),
427+
values: TraitRefs(ExpectedFound::new(a_is_expected, a, b)),
446428
}
447429
}
448430
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
16531653
.report(diag);
16541654
(false, Mismatch::Fixed("signature"))
16551655
}
1656-
ValuePairs::PolyTraitRefs(_) => (false, Mismatch::Fixed("trait")),
1656+
ValuePairs::TraitRefs(_) => (false, Mismatch::Fixed("trait")),
16571657
ValuePairs::Aliases(infer::ExpectedFound { expected, .. }) => {
16581658
(false, Mismatch::Fixed(self.tcx.def_descr(expected.def_id)))
16591659
}
@@ -1969,8 +1969,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
19691969
self.note_and_explain_type_err(diag, exp_found, cause, span, cause.body_id.to_def_id());
19701970
}
19711971

1972-
if let Some(ValuePairs::PolyTraitRefs(exp_found)) = values
1973-
&& let ty::Closure(def_id, _) = exp_found.expected.skip_binder().self_ty().kind()
1972+
if let Some(ValuePairs::TraitRefs(exp_found)) = values
1973+
&& let ty::Closure(def_id, _) = exp_found.expected.self_ty().kind()
19741974
&& let Some(def_id) = def_id.as_local()
19751975
&& terr.involves_regions()
19761976
{
@@ -2188,7 +2188,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
21882188
infer::Aliases(exp_found) => self.expected_found_str(exp_found),
21892189
infer::ExistentialTraitRef(exp_found) => self.expected_found_str(exp_found),
21902190
infer::ExistentialProjection(exp_found) => self.expected_found_str(exp_found),
2191-
infer::PolyTraitRefs(exp_found) => {
2191+
infer::TraitRefs(exp_found) => {
21922192
let pretty_exp_found = ty::error::ExpectedFound {
21932193
expected: exp_found.expected.print_trait_sugared(),
21942194
found: exp_found.found.print_trait_sugared(),

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,13 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
195195
value_pairs: &ValuePairs<'tcx>,
196196
) -> Option<Diag<'tcx>> {
197197
let (expected_args, found_args, trait_def_id) = match value_pairs {
198-
ValuePairs::PolyTraitRefs(ExpectedFound { expected, found })
199-
if expected.def_id() == found.def_id() =>
198+
ValuePairs::TraitRefs(ExpectedFound { expected, found })
199+
if expected.def_id == found.def_id =>
200200
{
201201
// It's possible that the placeholders come from a binder
202202
// outside of this value pair. Use `no_bound_vars` as a
203203
// simple heuristic for that.
204-
(expected.no_bound_vars()?.args, found.no_bound_vars()?.args, expected.def_id())
204+
(expected.args, found.args, expected.def_id)
205205
}
206206
_ => return None,
207207
};

compiler/rustc_infer/src/infer/error_reporting/suggest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
599599
&self,
600600
span: Span,
601601
hir: hir::Node<'_>,
602-
exp_found: &ty::error::ExpectedFound<ty::PolyTraitRef<'tcx>>,
602+
exp_found: &ty::error::ExpectedFound<ty::TraitRef<'tcx>>,
603603
diag: &mut Diag<'_>,
604604
) {
605605
// 0. Extract fn_decl from hir
@@ -614,10 +614,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
614614

615615
// 1. Get the args of the closure.
616616
// 2. Assume exp_found is FnOnce / FnMut / Fn, we can extract function parameters from [1].
617-
let Some(expected) = exp_found.expected.skip_binder().args.get(1) else {
617+
let Some(expected) = exp_found.expected.args.get(1) else {
618618
return;
619619
};
620-
let Some(found) = exp_found.found.skip_binder().args.get(1) else {
620+
let Some(found) = exp_found.found.args.get(1) else {
621621
return;
622622
};
623623
let expected = expected.unpack();

compiler/rustc_infer/src/infer/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ pub enum ValuePairs<'tcx> {
403403
Regions(ExpectedFound<ty::Region<'tcx>>),
404404
Terms(ExpectedFound<ty::Term<'tcx>>),
405405
Aliases(ExpectedFound<ty::AliasTy<'tcx>>),
406-
PolyTraitRefs(ExpectedFound<ty::PolyTraitRef<'tcx>>),
406+
TraitRefs(ExpectedFound<ty::TraitRef<'tcx>>),
407407
PolySigs(ExpectedFound<ty::PolyFnSig<'tcx>>),
408408
ExistentialTraitRef(ExpectedFound<ty::PolyExistentialTraitRef<'tcx>>),
409409
ExistentialProjection(ExpectedFound<ty::PolyExistentialProjection<'tcx>>),
@@ -1882,15 +1882,15 @@ impl<'tcx> TypeTrace<'tcx> {
18821882
}
18831883
}
18841884

1885-
pub fn poly_trait_refs(
1885+
pub fn trait_refs(
18861886
cause: &ObligationCause<'tcx>,
18871887
a_is_expected: bool,
1888-
a: ty::PolyTraitRef<'tcx>,
1889-
b: ty::PolyTraitRef<'tcx>,
1888+
a: ty::TraitRef<'tcx>,
1889+
b: ty::TraitRef<'tcx>,
18901890
) -> TypeTrace<'tcx> {
18911891
TypeTrace {
18921892
cause: cause.clone(),
1893-
values: PolyTraitRefs(ExpectedFound::new(a_is_expected, a, b)),
1893+
values: TraitRefs(ExpectedFound::new(a_is_expected, a, b)),
18941894
}
18951895
}
18961896

compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs

+4-9
Original file line numberDiff line numberDiff line change
@@ -3394,12 +3394,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
33943394
(obligation.cause.clone(), terr)
33953395
};
33963396
self.report_and_explain_type_error(
3397-
TypeTrace::poly_trait_refs(
3398-
&cause,
3399-
true,
3400-
ty::Binder::dummy(expected_trait_ref),
3401-
ty::Binder::dummy(found_trait_ref),
3402-
),
3397+
TypeTrace::trait_refs(&cause, true, expected_trait_ref, found_trait_ref),
34033398
terr,
34043399
)
34053400
}
@@ -3493,11 +3488,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
34933488
&& not_tupled
34943489
{
34953490
self.report_and_explain_type_error(
3496-
TypeTrace::poly_trait_refs(
3491+
TypeTrace::trait_refs(
34973492
&obligation.cause,
34983493
true,
3499-
ty::Binder::dummy(expected_trait_ref),
3500-
ty::Binder::dummy(found_trait_ref),
3494+
expected_trait_ref,
3495+
found_trait_ref,
35013496
),
35023497
ty::error::TypeError::Mismatch,
35033498
)

0 commit comments

Comments
 (0)