Auto merge of #134625 - compiler-errors:unsafe-binders-ty, r=oli-obk · rust-lang/rust@f334342 (original) (raw)

File tree

79 files changed

lines changed

79 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -263,7 +263,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
263 263 &self,
264 264 negative_impls,
265 265 span.to(of_trait.as_ref().map_or(span, |t
266 -"negative trait bounds are not yet fully implemented; \
266 +"negative trait bounds are not fully implemented; \
267 267 use marker types for now"
268 268 );
269 269 }
Original file line number Diff line number Diff line change
@@ -1607,6 +1607,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
1607 1607 | ty::CoroutineWitness(..)
1608 1608 | ty::Never
1609 1609 | ty::Tuple(_)
1610 + | ty::UnsafeBinder(_)
1610 1611 | ty::Alias(_, _)
1611 1612 | ty::Param(_)
1612 1613 | ty::Bound(_, _)
@@ -1648,6 +1649,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
1648 1649 | ty::Dynamic(_, _, _)
1649 1650 | ty::CoroutineWitness(..)
1650 1651 | ty::Never
1652 + | ty::UnsafeBinder(_)
1651 1653 | ty::Alias(_, _)
1652 1654 | ty::Param(_)
1653 1655 | ty::Bound(_, _)
Original file line number Diff line number Diff line change
@@ -432,6 +432,7 @@ fn push_debuginfo_type_name<'tcx>(
432 432 push_closure_or_coroutine_name(tcx, def_id, args, qualified, output, visited);
433 433 }
434 434 }
435 + ty::UnsafeBinder(_) => todo!("FIXME(unsafe_binders)"),
435 436 ty::Param(_)
436 437 | ty::Error(_)
437 438 | ty::Infer(_)
Original file line number Diff line number Diff line change
@@ -178,7 +178,8 @@ fn const_to_valtree_inner<'tcx>(
178 178 | ty::Closure(..)
179 179 | ty::CoroutineClosure(..)
180 180 | ty::Coroutine(..)
181 - | ty::CoroutineWitness(..) => Err(ValTreeCreationError::NonSupportedType(ty)),
181 + | ty::CoroutineWitness(..)
182 + | ty::UnsafeBinder(_) => Err(ValTreeCreationError::NonSupportedType(ty)),
182 183 }
183 184 }
184 185
@@ -358,7 +359,10 @@ pub fn valtree_to_const_value<'tcx>(
358 359 | ty::FnPtr(..)
359 360 | ty::Str
360 361 | ty::Slice(_)
361 - | ty::Dynamic(..) => bug!("no ValTree should have been created for type {:?}", ty.kind()),
362 + | ty::Dynamic(..)
363 + | ty::UnsafeBinder(_) => {
364 +bug!("no ValTree should have been created for type {:?}", ty.kind())
365 +}
362 366 }
363 367 }
364 368
Original file line number Diff line number Diff line change
@@ -90,6 +90,7 @@ pub(crate) fn eval_nullary_intrinsic<'tcx>(
90 90 | ty::CoroutineClosure(_, _)
91 91 | ty::Coroutine(_, _)
92 92 | ty::CoroutineWitness(..)
93 + | ty::UnsafeBinder(_)
93 94 | ty::Never
94 95 | ty::Tuple(_)
95 96 | ty::Error(_) => ConstValue::from_target_usize(0u64, &tcx),
Original file line number Diff line number Diff line change
@@ -505,6 +505,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
505 505 // We don't want to do any queries, so there is not much we can do with ADTs.
506 506 ty::Adt(..) => false,
507 507
508 + ty::UnsafeBinder(ty) => is_very_trivially_sized(ty.skip_binder()),
509 +
508 510 ty::Alias(..) | ty::Param(_) ty::Placeholder(..) => false,
509 511
510 512 ty::Infer(ty::TyVar(_)) => false,
Original file line number Diff line number Diff line change
@@ -768,6 +768,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
768 768 // Nothing to check.
769 769 interp_ok(true)
770 770 }
771 + ty::UnsafeBinder(_) => todo!("FIXME(unsafe_binder)"),
771 772 // The above should be all the primitive types. The rest is compound, we
772 773 // check them by visiting their fields/variants.
773 774 ty::Adt(..)
Original file line number Diff line number Diff line change
@@ -38,7 +38,8 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> {
38 38 | ty::FnPtr(..)
39 39 | ty::Never
40 40 | ty::Tuple(_)
41 - | ty::Dynamic(_, _, _) => self.pretty_print_type(ty),
41 + | ty::Dynamic(_, _, _)
42 + | ty::UnsafeBinder(_) => self.pretty_print_type(ty),
42 43
43 44 // Placeholders (all printed as `_` to uniformize them).
44 45 ty::Param(_) | ty::Bound(..) ty::Placeholder(_) ty::Infer(_) ty::Error(_) => {
Original file line number Diff line number Diff line change
@@ -178,7 +178,8 @@ impl<'tcx> InherentCollect<'tcx> {
178 178 | ty::Ref(..)
179 179 | ty::Never
180 180 | ty::FnPtr(..)
181 - | ty::Tuple(..) => self.check_primitive_impl(id, self_ty),
181 + | ty::Tuple(..)
182 + | ty::UnsafeBinder(_) => self.check_primitive_impl(id, self_ty),
182 183 ty::Alias(ty::Projection | ty::Inherent ty::Opaque, _) ty::Param(_) => {
183 184 Err(self.tcx.dcx().emit_err(errors::InherentNominal { span: item_span }))
184 185 }
Original file line number Diff line number Diff line change
@@ -225,7 +225,8 @@ pub(crate) fn orphan_check_impl(
225 225 | ty::FnDef(..)
226 226 | ty::FnPtr(..)
227 227 | ty::Never
228 - | ty::Tuple(..) => (LocalImpl::Allow, NonlocalImpl::DisallowOther),
228 + | ty::Tuple(..)
229 + | ty::UnsafeBinder(_) => (LocalImpl::Allow, NonlocalImpl::DisallowOther),
229 230
230 231 ty::Closure(..)
231 232 | ty::CoroutineClosure(..)