You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #108106 - the8472:layout-opt, r=wesleywiser
Improve niche placement by trying two strategies and picking the better result
Fixes#104807Fixes#105371
Determining which sort order is better requires calculating the struct size (so we can calculate the niche offset). But that in turn depends on the field order, so happens after sorting. So the simple way to solve that is to run the whole thing twice and pick the better result.
1st commit is just code motion, the meat is in the later ones.
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
467
467
= note: the raw bytes of the constant (size: 8, align: 4) {
468
-
00 10 00 00 00 00 00 00 │ ........
468
+
00 00 00 00 00 10 00 00 │ ........
469
469
}
470
470
471
471
error[E0080]: it is undefined behavior to use this value
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
478
478
= note: the raw bytes of the constant (size: 8, align: 4) {
479
-
09 00 00 00 03 00 00 00 │ ........
479
+
03 00 00 00 09 00 00 00 │ ........
480
480
}
481
481
482
482
error[E0080]: it is undefined behavior to use this value
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
467
467
= note: the raw bytes of the constant (size: 16, align: 8) {
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
478
478
= note: the raw bytes of the constant (size: 16, align: 8) {
0 commit comments