Begin to implement type system layer of unsafe binders
This commit is contained in:
parent
b22856d192
commit
9a1c5eb5b3
79 changed files with 536 additions and 305 deletions
|
@ -178,7 +178,8 @@ impl<'tcx> InherentCollect<'tcx> {
|
|||
| ty::Ref(..)
|
||||
| ty::Never
|
||||
| ty::FnPtr(..)
|
||||
| ty::Tuple(..) => self.check_primitive_impl(id, self_ty),
|
||||
| ty::Tuple(..)
|
||||
| ty::UnsafeBinder(_) => self.check_primitive_impl(id, self_ty),
|
||||
ty::Alias(ty::Projection | ty::Inherent | ty::Opaque, _) | ty::Param(_) => {
|
||||
Err(self.tcx.dcx().emit_err(errors::InherentNominal { span: item_span }))
|
||||
}
|
||||
|
|
|
@ -225,7 +225,8 @@ pub(crate) fn orphan_check_impl(
|
|||
| ty::FnDef(..)
|
||||
| ty::FnPtr(..)
|
||||
| ty::Never
|
||||
| ty::Tuple(..) => (LocalImpl::Allow, NonlocalImpl::DisallowOther),
|
||||
| ty::Tuple(..)
|
||||
| ty::UnsafeBinder(_) => (LocalImpl::Allow, NonlocalImpl::DisallowOther),
|
||||
|
||||
ty::Closure(..)
|
||||
| ty::CoroutineClosure(..)
|
||||
|
|
|
@ -2318,13 +2318,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
self.lower_fn_ty(hir_ty.hir_id, bf.safety, bf.abi, bf.decl, None, Some(hir_ty)),
|
||||
)
|
||||
}
|
||||
hir::TyKind::UnsafeBinder(_binder) => {
|
||||
let guar = self
|
||||
.dcx()
|
||||
.struct_span_err(hir_ty.span, "unsafe binders are not yet implemented")
|
||||
.emit();
|
||||
Ty::new_error(tcx, guar)
|
||||
}
|
||||
hir::TyKind::UnsafeBinder(binder) => Ty::new_unsafe_binder(
|
||||
tcx,
|
||||
ty::Binder::bind_with_vars(
|
||||
self.lower_ty(binder.inner_ty),
|
||||
tcx.late_bound_vars(hir_ty.hir_id),
|
||||
),
|
||||
),
|
||||
hir::TyKind::TraitObject(bounds, lifetime, repr) => {
|
||||
if let Some(guar) = self.prohibit_or_lint_bare_trait_object_ty(hir_ty) {
|
||||
// Don't continue with type analysis if the `dyn` keyword is missing
|
||||
|
|
|
@ -322,6 +322,11 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
|
|||
self.add_constraints_from_sig(current, sig_tys.with(hdr), variance);
|
||||
}
|
||||
|
||||
ty::UnsafeBinder(ty) => {
|
||||
// FIXME(unsafe_binders): This is covariant, right?
|
||||
self.add_constraints_from_ty(current, ty.skip_binder(), variance);
|
||||
}
|
||||
|
||||
ty::Error(_) => {
|
||||
// we encounter this when walking the trait references for object
|
||||
// types, where we use Error as the Self type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue