Skip to content

Commit f4a3ed0

Browse files
committed
Avoid a FnPtr deconstruct-and-recreate.
1 parent 9e95a2b commit f4a3ed0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: compiler/rustc_middle/src/ty/layout.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -986,10 +986,11 @@ where
986986
safe: None,
987987
})
988988
}
989-
ty::FnPtr(sig_tys, hdr) if offset.bytes() == 0 => {
990-
let fn_sig = sig_tys.with(hdr);
991-
tcx.layout_of(param_env.and(Ty::new_fn_ptr(tcx, fn_sig))).ok().map(|layout| {
992-
PointeeInfo { size: layout.size, align: layout.align.abi, safe: None }
989+
ty::FnPtr(..) if offset.bytes() == 0 => {
990+
tcx.layout_of(param_env.and(this.ty)).ok().map(|layout| PointeeInfo {
991+
size: layout.size,
992+
align: layout.align.abi,
993+
safe: None,
993994
})
994995
}
995996
ty::Ref(_, ty, mt) if offset.bytes() == 0 => {

0 commit comments

Comments
 (0)