only set noalias on Box with the global allocator
This commit is contained in:
parent
5a1e5449c8
commit
f391c0793b
17 changed files with 75 additions and 28 deletions
|
@ -969,6 +969,8 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Compute the information for the pointer stored at the given offset inside this type.
|
||||
/// This will recurse into fields of ADTs to find the inner pointer.
|
||||
fn ty_and_layout_pointee_info_at(
|
||||
this: TyAndLayout<'tcx>,
|
||||
cx: &C,
|
||||
|
@ -1068,15 +1070,17 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME(eddyb) This should be for `ptr::Unique<T>`, not `Box<T>`.
|
||||
// Fixup info for the first field of a `Box`. Recursive traversal will have found
|
||||
// the raw pointer, so size and align are set to the boxed type, but `pointee.safe`
|
||||
// will still be `None`.
|
||||
if let Some(ref mut pointee) = result {
|
||||
if let ty::Adt(def, _) = this.ty.kind() {
|
||||
if def.is_box() && offset.bytes() == 0 {
|
||||
let optimize = tcx.sess.opts.optimize != OptLevel::No;
|
||||
pointee.safe = Some(PointerKind::Box {
|
||||
unpin: optimize && this.ty.boxed_ty().is_unpin(tcx, cx.param_env()),
|
||||
});
|
||||
}
|
||||
if offset.bytes() == 0 && this.ty.is_box() {
|
||||
debug_assert!(pointee.safe.is_none());
|
||||
let optimize = tcx.sess.opts.optimize != OptLevel::No;
|
||||
pointee.safe = Some(PointerKind::Box {
|
||||
unpin: optimize && this.ty.boxed_ty().is_unpin(tcx, cx.param_env()),
|
||||
global: this.ty.is_box_global(tcx),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue