Skip to content

Commit a002f45

Browse files
committed
Remove sub_types_or_anon
1 parent a0e1291 commit a002f45

File tree

3 files changed

+2
-113
lines changed

3 files changed

+2
-113
lines changed

compiler/rustc_mir/src/borrow_check/type_check/mod.rs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,32 +1130,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
11301130
self.relate_types(sub, ty::Variance::Covariant, sup, locations, category)
11311131
}
11321132

1133-
/// Try to relate `sub <: sup`; if this fails, instantiate opaque
1134-
/// variables in `sub` with their inferred definitions and try
1135-
/// again. This is used for opaque types in places (e.g., `let x:
1136-
/// impl Foo = ..`).
1137-
fn sub_types_or_anon(
1138-
&mut self,
1139-
sub: Ty<'tcx>,
1140-
sup: Ty<'tcx>,
1141-
locations: Locations,
1142-
category: ConstraintCategory,
1143-
) -> Fallible<()> {
1144-
if let Err(terr) = self.sub_types(sub, sup, locations, category) {
1145-
if let ty::Opaque(..) = sup.kind() {
1146-
// When you have `let x: impl Foo = ...` in a closure,
1147-
// the resulting inferend values are stored with the
1148-
// def-id of the base function.
1149-
let parent_def_id =
1150-
self.tcx().closure_base_def_id(self.body.source.def_id()).expect_local();
1151-
return self.eq_opaque_type_and_type(sub, sup, parent_def_id, locations, category);
1152-
} else {
1153-
return Err(terr);
1154-
}
1155-
}
1156-
Ok(())
1157-
}
1158-
11591133
fn eq_types(
11601134
&mut self,
11611135
a: Ty<'tcx>,
@@ -1490,7 +1464,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14901464
let rv_ty = rv.ty(body, tcx);
14911465
let rv_ty = self.normalize(rv_ty, location);
14921466
if let Err(terr) =
1493-
self.sub_types_or_anon(rv_ty, place_ty, location.to_locations(), category)
1467+
self.sub_types(rv_ty, place_ty, location.to_locations(), category)
14941468
{
14951469
span_mirbug!(
14961470
self,
@@ -1777,9 +1751,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
17771751

17781752
let locations = term_location.to_locations();
17791753

1780-
if let Err(terr) =
1781-
self.sub_types_or_anon(sig.output(), dest_ty, locations, category)
1782-
{
1754+
if let Err(terr) = self.sub_types(sig.output(), dest_ty, locations, category) {
17831755
span_mirbug!(
17841756
self,
17851757
term,

src/test/ui/type-alias-impl-trait/issue-85113.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/test/ui/type-alias-impl-trait/issue-85113.stderr

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)