Uh oh!
There was an error while loading. Please reload this page.
distinguish "no data" from "heterogeneous" in ABI - #57645
Conversation
nikomatsakis
commented
Jan 15, 2019
PS, @glandium, you may want to try this build to see if it fixes your problem =) |
nikomatsakis
commented
Jan 15, 2019
One interesting test where the right behavior is not obvious: #[repr(C)]pubstructMiddleFieldPhantom{puba:f32,pubb:f32,pubc:[u32;0],pubd:PhantomData<u8>,}/// In the case where the VLA is in the middle, but the only thing/// that comes next is phantomdata, we still consider that to be/// `has_vla: false`. Not clear if that is correct but also not clear/// that it is wrong.#[rustc_layout(abi)]pubtypeTest4 = MiddleFieldPhantom;//~^ ERROR abi: Aggregate { sized: true, has_vla: false } |
74313f5 to
01e206dCompare
This comment has been minimized.
This comment has been minimized.
01e206d to
a1defb3Comparenikomatsakis
commented
Jan 16, 2019
Tests just needed to be blessed. Hopefully ok now. |
913d548 to
6beebd0Comparenikomatsakis
commented
Jan 16, 2019
@bors try |
bors
commented
Jan 16, 2019
⌛ Trying commit 6beebd0d109004f208b4241229ecedf12a752971 with merge 896270e14094a65293b52bbbf9b447c557dda848... |
nikomatsakis
commented
Jan 16, 2019
@glandium when the try build above completes, we should produce an |
bors
commented
Jan 16, 2019
☔ The latest upstream changes (presumably #57321) made this pull request unmergeable. Please resolve the merge conflicts. |
bors
commented
Jan 16, 2019
☀️ Test successful - checks-travis |
glandium
commented
Jan 17, 2019
I don't know what commit to give |
nikomatsakis
commented
Jan 17, 2019
@glandium I think 896270e is correct; not sure why it didn't work, maybe @pietroalbini or @Mark-Simulacrum have a suggestion (they're the ones who advised me on how to do it) |
emilyalbini
commented
Jan 17, 2019
This command works for me: |
glandium
commented
Jan 18, 2019
So it looks like bors only built aarch64-unknown-linux-gnu host rustc? I can't test those, because we don't build Firefox on those. For aarch64-pc-windows-msvc, we build on x86_64-pc-windows-msvc. |
emilyalbini
commented
Jan 18, 2019
We can't do try builds for windows at the moment though. |
There was a problem hiding this comment.
Is a check for repr.c() not warranted here?
There was a problem hiding this comment.
Ah, never mind, its an array, which is repr(C) by definition.
There was a problem hiding this comment.
See #56877 (comment) about VLA-ness of 0-sized arrays.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Is there any particular reason other than a gut feeling for short-circuiting the code inside? To me it seems like a likely no-op performance wise.
There was a problem hiding this comment.
Similarly a style nit, this could be written as just
ifletAbi::Aggregate{ has_vla, .. } = &mut abi {*has_vla |= any_variant_has_vla && def.repr.c();}There was a problem hiding this comment.
Note that this field is always false for things that are not
#[repr(C)]
Seems like a difficult requirement to uphold in the future without something asserting this somewhere. I feel like the code downstream should be able to handle this field regardless of the overall ABI (i.e. interpret it semantically).
If an aggregate has a VLA within itself, it itself becomes variable-length, in which case it would make sense to just name this field as is_variable_length...
Which then brings up a question: does it make sense for a variable-length aggregate to also be sized? Well, at least the #[repr(C)] struct Foo { last: [T; 0] } would be Aggregate { sized: true, variable_length: true }, but then what really is it – a variable length aggregate or a zero-sized aggregate? Hmm...
To be fair, I’m not sure what ABI interactions arise here – the currently implemented behaviour may well be the correct one...
Uh oh!
There was an error while loading. Please reload this page.
nagisa
commented
Jan 18, 2019
I feel like this could still use a codegen test for aarch regression, but sadly our codegen testing infrastructure does not currently allow testing assembly... |
glandium
commented
Jan 18, 2019
I'm told this affects Fennec for aarch64 Android as well, and we build those on Linux. Can you do a try x86_64-pc-linux-gnu build (with aarch64 std)? |
arielb1
commented
Jan 20, 2019
I'll look at this when I'll have the time - don't know when will that be. |
nikomatsakis
commented
Jan 22, 2019
I found this comment by @parched somewhat persuasive -- it basically argues that we don't really have a way to represent "VLA" in Rust today (it's almost a |
d0c4260 to
784a26dCompareglandium
commented
Jan 24, 2019
Can you do a try x86_64-pc-linux-gnu build (with aarch64 std)? |
pnkfelix
commented
Jan 24, 2019
@nikomatsakis wrote:
can you update the PR description to reflect this change, so that the eventual bors commit will have a commit message that reflects reality? |
03dc540 to
99105b6Comparenikomatsakis
commented
Jan 24, 2019
@eddyb I believe this now implements the change you wanted in the way that you wanted it =) if you approve, I'll squash the commits. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
030a15c to
f622ed1Comparenikomatsakis
commented
Jan 24, 2019
Squashed and rebased. r? @eddyb |
f622ed1 to
500a5caCompareeddyb
commented
Jan 24, 2019
r=me with description updated |
Also, add a testing infrastructure and tests that lets us dump layout.
500a5ca to
8e4c57fComparenikomatsakis
commented
Jan 25, 2019
@bors r=eddyb p=1 Giving high priority because this is blocking some folks at Mozilla |
bors
commented
Jan 25, 2019
📌 Commit 8e4c57f has been approved by |
…ates, r=eddyb distinguish "no data" from "heterogeneous" in ABI Ignore zero-sized types when computing whether something is a homogeneous aggregate, except be careful of VLA. cc rust-lang#56877 r? @arielb1 cc @eddyb
Rollup of 5 pull requests Successful merges: - #56233 (Miri and miri-related code contains repetitions of `(n << amt) >> amt`) - #57645 (distinguish "no data" from "heterogeneous" in ABI) - #57734 (Fix evaluating trivial drop glue in constants) - #57886 (Add suggestion for moving type declaration before associated type bindings in generic arguments.) - #57890 (Fix wording in diagnostics page) Failed merges: r? @ghost
Ignore zero-sized types when computing whether something is a homogeneous aggregate, except be careful of VLA.
cc #56877
r? @arielb1
cc @eddyb