Address more PR feedback
This commit is contained in:
parent
bb8d6f790b
commit
1398fe7a5e
2 changed files with 5 additions and 4 deletions
|
@ -121,7 +121,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
||||||
if a.const_.ty().is_bool() { a.const_.try_to_bool() } else { None }
|
if a.const_.ty().is_bool() { a.const_.try_to_bool() } else { None }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Transform "&(*a)" ==> "a".
|
/// Transform `&(*a)` ==> `a`.
|
||||||
fn simplify_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
fn simplify_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
||||||
if let Rvalue::Ref(_, _, place) = rvalue {
|
if let Rvalue::Ref(_, _, place) = rvalue {
|
||||||
if let Some((base, ProjectionElem::Deref)) = place.as_ref().last_projection() {
|
if let Some((base, ProjectionElem::Deref)) = place.as_ref().last_projection() {
|
||||||
|
@ -141,7 +141,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Transform "Len([_; N])" ==> "N".
|
/// Transform `Len([_; N])` ==> `N`.
|
||||||
fn simplify_len(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
fn simplify_len(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
||||||
if let Rvalue::Len(ref place) = *rvalue {
|
if let Rvalue::Len(ref place) = *rvalue {
|
||||||
let place_ty = place.ty(self.local_decls, self.tcx).ty;
|
let place_ty = place.ty(self.local_decls, self.tcx).ty;
|
||||||
|
@ -157,7 +157,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Transform "Aggregate(RawPtr, \[p, ()\])" ==> "Cast(PtrToPtr, p)".
|
/// Transform `Aggregate(RawPtr, [p, ()])` ==> `Cast(PtrToPtr, p)`.
|
||||||
fn simplify_ptr_aggregate(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
fn simplify_ptr_aggregate(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
||||||
if let Rvalue::Aggregate(box AggregateKind::RawPtr(pointee_ty, mutability), fields) = rvalue
|
if let Rvalue::Aggregate(box AggregateKind::RawPtr(pointee_ty, mutability), fields) = rvalue
|
||||||
{
|
{
|
||||||
|
|
|
@ -2791,7 +2791,8 @@ pub unsafe fn vtable_align(_ptr: *const ()) -> usize {
|
||||||
#[rustc_intrinsic_must_be_overridden]
|
#[rustc_intrinsic_must_be_overridden]
|
||||||
#[cfg(not(bootstrap))]
|
#[cfg(not(bootstrap))]
|
||||||
pub const fn aggregate_raw_ptr<P: AggregateRawPtr<D, Metadata = M>, D, M>(_data: D, _meta: M) -> P {
|
pub const fn aggregate_raw_ptr<P: AggregateRawPtr<D, Metadata = M>, D, M>(_data: D, _meta: M) -> P {
|
||||||
// No fallback because `libcore` doesn't want to know the layout
|
// To implement a fallback we'd have to assume the layout of the pointer,
|
||||||
|
// but the whole point of this intrinsic is that we shouldn't do that.
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue