1
Fork 0

Begin to implement type system layer of unsafe binders

This commit is contained in:
Michael Goulet 2024-12-21 17:05:40 +00:00
parent b22856d192
commit 9a1c5eb5b3
79 changed files with 536 additions and 305 deletions

View file

@ -49,7 +49,8 @@ fn resolve_instance_raw<'tcx>(
| ty::Adt(..)
| ty::Dynamic(..)
| ty::Array(..)
| ty::Slice(..) => {}
| ty::Slice(..)
| ty::UnsafeBinder(..) => {}
// Drop shims can only be built from ADTs.
_ => return Ok(None),
}

View file

@ -666,6 +666,11 @@ fn layout_of_uncached<'tcx>(
tcx.mk_layout(layout)
}
ty::UnsafeBinder(bound_ty) => {
let ty = tcx.instantiate_bound_regions_with_erased(bound_ty.into());
cx.layout_of(ty)?.layout
}
// Types with no meaningful known layout.
ty::Alias(..) => {
// NOTE(eddyb) `layout_of` query should've normalized these away,

View file

@ -202,6 +202,11 @@ where
}
}
ty::UnsafeBinder(bound_ty) => {
let ty = self.tcx.instantiate_bound_regions_with_erased(bound_ty.into());
queue_type(self, ty);
}
_ if tcx.type_is_copy_modulo_regions(self.typing_env, component) => {}
ty::Closure(_, args) => {

View file

@ -37,6 +37,8 @@ fn sized_constraint_for_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option<Ty<'
| Never
| Dynamic(_, _, ty::DynStar) => None,
UnsafeBinder(_) => todo!(),
// these are never sized
Str | Slice(..) | Dynamic(_, _, ty::Dyn) | Foreign(..) => Some(ty),