Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add rustc_abi(assert_eq) to test some guaranteed or at least highly expected ABI compatibility guarantees #115372

Merged
merged 12 commits into from
Sep 8, 2023

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Aug 30, 2023

This new repr(transparent) test is super useful, it would have found #115336 and found #115404, #115481, #115509.

@rustbot
Copy link
Collaborator

rustbot commented Aug 30, 2023

r? @davidtwco

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 30, 2023
test_transparent!(pair, (i32, f32));
test_transparent!(tuple, (i32, f32, i64, f64));
test_transparent!(zst, ());
test_transparent!(empty_array, [u32; 0]);
Copy link
Member Author

@RalfJung RalfJung Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect this will fail on some targets due to #115336. However that's a tier 2 target so I think we don't run tests?

@RalfJung RalfJung force-pushed the abi-assert-eq branch 2 times, most recently from 072bfa5 to 3a81c97 Compare August 30, 2023 11:55
@@ -43,7 +43,6 @@ pub extern "C" fn test_WithZst(_: WithZst) -> WithZst { loop {} }
#[repr(transparent)]
pub struct WithZeroSizedArray(*const f32, [i8; 0]);

// Apparently we use i32* when newtype-unwrapping f32 pointers. Whatever.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems to be from a time when LLVM still had pointee types, so I think it can be removed.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Sep 2, 2023

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@RalfJung RalfJung changed the title add rustc_abi(assert_eq) to test some repr(transparent) cases add rustc_abi(assert_eq) to test some guaranteed or at least highly expected ABI compatibility guarantees Sep 2, 2023
@RalfJung RalfJung force-pushed the abi-assert-eq branch 3 times, most recently from cf929af to ad14c49 Compare September 2, 2023 12:52
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the abi-assert-eq branch 2 times, most recently from a26f3a5 to 8522721 Compare September 2, 2023 12:57
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 8, 2023
add rustc_abi(assert_eq) to test some guaranteed or at least highly expected ABI compatibility guarantees

This new repr(transparent) test is super useful, it would have found rust-lang#115336 and found rust-lang#115404, rust-lang#115481, rust-lang#115509.
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Sep 8, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 8, 2023
@RalfJung
Copy link
Member Author

RalfJung commented Sep 8, 2023

It also fails on arm, not just aarch64
@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Sep 8, 2023

📌 Commit e726be2 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 8, 2023
@bors
Copy link
Contributor

bors commented Sep 8, 2023

⌛ Testing commit e726be2 with merge cd71a37...

@bors
Copy link
Contributor

bors commented Sep 8, 2023

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing cd71a37 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 8, 2023
@bors bors merged commit cd71a37 into rust-lang:master Sep 8, 2023
12 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 8, 2023
@RalfJung RalfJung deleted the abi-assert-eq branch September 8, 2023 13:45
@bors bors mentioned this pull request Sep 8, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (cd71a37): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.0% [0.6%, 4.4%] 5
Improvements ✅
(primary)
-1.2% [-1.5%, -0.9%] 2
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) -1.2% [-1.5%, -0.9%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 629.695s -> 631.473s (0.28%)
Artifact size: 318.12 MiB -> 318.18 MiB (0.02%)

bors added a commit to rust-lang-ci/rust that referenced this pull request May 1, 2024
Support Result<T, E> across FFI when niche optimization can be used

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
fmease added a commit to fmease/rust that referenced this pull request May 5, 2024
Support Result<T, E> across FFI when niche optimization can be used

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
bors added a commit to rust-lang-ci/rust that referenced this pull request May 5, 2024
Support Result<T, E> across FFI when niche optimization can be used

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
fmease added a commit to fmease/rust that referenced this pull request May 5, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to rust-lang#122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
fmease added a commit to fmease/rust that referenced this pull request May 5, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to rust-lang#122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
bors added a commit to rust-lang-ci/rust that referenced this pull request May 6, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to rust-lang#122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang#110503

Additional ABI and codegen tests were added in rust-lang#115372
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request May 11, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to #122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang/rust#110503

Additional ABI and codegen tests were added in rust-lang/rust#115372
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request May 18, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to #122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang/rust#110503

Additional ABI and codegen tests were added in rust-lang/rust#115372
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request May 24, 2024
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to #122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of rust-lang/rfcs#3391
Tracking issue: rust-lang/rust#110503

Additional ABI and codegen tests were added in rust-lang/rust#115372
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants