Skip to content

Commit 4d5bc51

Browse files
committed
perf: keep pointeesized builtin impls
1 parent e1ad8d3 commit 4d5bc51

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,11 +1263,6 @@ fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item<'_>) -> Result<(), ErrorGuarant
12631263
debug!(?item.owner_id);
12641264

12651265
let def_id = item.owner_id.def_id;
1266-
if tcx.is_lang_item(def_id.into(), LangItem::PointeeSized) {
1267-
// `PointeeSized` is removed during lowering.
1268-
return Ok(());
1269-
}
1270-
12711266
let trait_def = tcx.trait_def(def_id);
12721267
if trait_def.is_marker
12731268
|| matches!(trait_def.specialization_kind, TraitSpecializationKind::Marker)

compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,11 @@ where
477477
G::consider_builtin_sizedness_candidates(self, goal, SizedTraitKind::MetaSized)
478478
}
479479
Some(TraitSolverLangItem::PointeeSized) => {
480-
unreachable!("`PointeeSized` is removed during lowering");
480+
G::consider_builtin_sizedness_candidates(
481+
self,
482+
goal,
483+
SizedTraitKind::PointeeSized,
484+
)
481485
}
482486
Some(TraitSolverLangItem::Copy | TraitSolverLangItem::Clone) => {
483487
G::consider_builtin_copy_clone_candidate(self, goal)

compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,15 @@ where
141141
// impl {Meta,}Sized for str, [T], dyn Trait
142142
ty::Str | ty::Slice(_) | ty::Dynamic(..) => match sizedness {
143143
SizedTraitKind::Sized => Err(NoSolution),
144-
SizedTraitKind::MetaSized => Ok(ty::Binder::dummy(vec![])),
145-
SizedTraitKind::PointeeSized => unreachable!(),
144+
SizedTraitKind::MetaSized | SizedTraitKind::PointeeSized => {
145+
Ok(ty::Binder::dummy(vec![]))
146+
}
146147
},
147148

148149
// impl {} for extern type
149150
ty::Foreign(..) => match sizedness {
150151
SizedTraitKind::Sized | SizedTraitKind::MetaSized => Err(NoSolution),
151-
SizedTraitKind::PointeeSized => unreachable!(),
152+
SizedTraitKind::PointeeSized => Ok(ty::Binder::dummy(vec![])),
152153
},
153154

154155
ty::Alias(..) | ty::Param(_) | ty::Placeholder(..) => Err(NoSolution),

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
100100
);
101101
}
102102
Some(LangItem::PointeeSized) => {
103-
bug!("`PointeeSized` is removed during lowering");
103+
self.assemble_builtin_sized_candidate(
104+
obligation,
105+
&mut candidates,
106+
SizedTraitKind::PointeeSized,
107+
);
104108
}
105109
Some(LangItem::Unsize) => {
106110
self.assemble_candidates_for_unsizing(obligation, &mut candidates);

0 commit comments

Comments
 (0)