let ty = self.ty
.builtin_deref(true)
.unwrap_or_else(|| {
- bug!("deref projection of non-dereferencable ty {:?}", self)
+ bug!("deref projection of non-dereferenceable ty {:?}", self)
})
.ty;
PlaceTy::from_ty(ty)
#[derive(Debug, Copy, Clone)]
pub enum AllocCheck {
/// Allocation must be live and not a function pointer.
- Dereferencable,
+ Dereferenceable,
/// Allocations needs to be live, but may be a function pointer.
Live,
/// Allocation may be dead.
}
Err(ptr) => {
let (allocation_size, alloc_align) =
- self.get_size_and_align(ptr.alloc_id, AllocCheck::Dereferencable)?;
+ self.get_size_and_align(ptr.alloc_id, AllocCheck::Dereferenceable)?;
// Test bounds. This also ensures non-NULL.
// It is sufficient to check this for the end pointer. The addition
// checks for overflow.
// # Function pointers
// (both global from `alloc_map` and local from `extra_fn_ptr_map`)
if let Ok(_) = self.get_fn_alloc(id) {
- return if let AllocCheck::Dereferencable = liveness {
+ return if let AllocCheck::Dereferenceable = liveness {
// The caller requested no function pointers.
throw_unsup!(DerefFunctionPointer)
} else {
"non-integer slice length in wide pointer", self.path);
// We do not check that `len * elem_size <= isize::MAX`:
// that is only required for references, and there it falls out of the
- // "dereferencable" check performed by Stacked Borrows.
+ // "dereferenceable" check performed by Stacked Borrows.
}
ty::Foreign(..) => {
// Unsized, but not wide.
if place.layout.is_unsized() {
self.check_wide_ptr_meta(place.meta, place.layout)?;
}
- // Make sure this is dereferencable and all.
+ // Make sure this is dereferenceable and all.
let (size, align) = self.ecx.size_and_align_of(place.meta, place.layout)?
// for the purpose of validity, consider foreign types to have
// alignment and size determined by the layout (size will be 0,
}
}
- pub fn check_dereferencable(&self, span: Span, expected: Ty<'tcx>, inner: &Pat) -> bool {
+ pub fn check_dereferenceable(&self, span: Span, expected: Ty<'tcx>, inner: &Pat) -> bool {
if let PatKind::Binding(..) = inner.kind {
if let Some(mt) = self.shallow_resolve(expected).builtin_deref(true) {
if let ty::Dynamic(..) = mt.ty.kind {
discrim_span: Option<Span>,
) -> Ty<'tcx> {
let tcx = self.tcx;
- let (box_ty, inner_ty) = if self.check_dereferencable(span, expected, &inner) {
+ let (box_ty, inner_ty) = if self.check_dereferenceable(span, expected, &inner) {
// Here, `demand::subtype` is good enough, but I don't
// think any errors can be introduced by using `demand::eqtype`.
let inner_ty = self.next_ty_var(TypeVariableOrigin {
) -> Ty<'tcx> {
let tcx = self.tcx;
let expected = self.shallow_resolve(expected);
- let (rptr_ty, inner_ty) = if self.check_dereferencable(pat.span, expected, &inner) {
+ let (rptr_ty, inner_ty) = if self.check_dereferenceable(pat.span, expected, &inner) {
// `demand::subtype` would be good enough, but using `eqtype` turns
// out to be equally general. See (note_1) for details.