Skip to content

Commit 2c48ae6

Browse files
committed
Auto merge of #40658 - eddyb:lay-more-out, r=arielb1
Use ty::layout for ABI computation instead of LLVM types. This is the first step in creating a backend-agnostic library for computing call ABI details from signatures. I wanted to open the PR *before* attempting to move `cabi_*` from trans to avoid rebase churn in #39999. **EDIT**: As I suspected, #39999 needs this PR to fully work (see #39999 (comment)). The first 3 commits add more APIs to `ty::layout` and replace non-ABI uses of `sizing_type_of`. These APIs are probably usable by other backends, and miri too (cc @stoklund @solson). The last commit rewrites `rustc_trans::cabi_*` to use `ty::layout` and new `rustc_trans::abi` APIs. Also, during the process, a couple trivial bugs were identified and fixed: * `msp430`, `nvptx`, `nvptx64`: type sizes *in bytes* were compared with `32` and `64` * `x86` (`fastcall`): `f64` was incorrectly not treated the same way as `f32` Although not urgent, this PR also uses the more general "homogenous aggregate" logic to fix #32045.
2 parents ebb10a6 + f0636b6 commit 2c48ae6

38 files changed

+1442
-1819
lines changed

src/librustc/middle/intrinsicck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'a, 'gcx, 'tcx> ExprVisitor<'a, 'gcx, 'tcx> {
8989
let from = unpack_option_like(self.infcx.tcx.global_tcx(), from);
9090
match (&from.sty, sk_to) {
9191
(&ty::TyFnDef(..), SizeSkeleton::Known(size_to))
92-
if size_to == Pointer.size(&self.infcx.tcx.data_layout) => {
92+
if size_to == Pointer.size(self.infcx) => {
9393
struct_span_err!(self.infcx.tcx.sess, span, E0591,
9494
"`{}` is zero-sized and can't be transmuted to `{}`",
9595
from, to)

0 commit comments

Comments
 (0)