Implement core::arch::return_address and tests#154972
Implement core::arch::return_address and tests#154972chorman0773 wants to merge 3 commits intorust-lang:mainfrom
core::arch::return_address and tests#154972Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Helpful comment, thanks rustbot 😐 |
There was a problem hiding this comment.
I'm not a huge fan of the doc comment's language. Could you try iterating on it a bit?
I think adding the cranelift implementation in this PR would also make sense (and maybe a gcc backend implementation -- not sure how easy that is?).
r=me with at least the comment fixed.
|
Reminder, once the PR becomes ready for a review, use |
|
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
|
I've changed the wording of the comment arround a bit, in part to make it more clear than returning null is something the compiler tries to do if it can't return a useful value for some reason, but doesn't guarantee. I've also added a cranelift impl. I'll figure out gcc/miri in a future PR. @rustbot ready |
|
r=me with commits squashed r? me |
Fix typo Apply suggestions from code review Wording/docs changes. Co-authored-by: Ralf Jung <post@ralfj.de> Change signature according to Ralf's comment Fix call to `core::intrinsics::return_address()` according to the new signature Add cranelift implementation for intrinsic Change wording on `return_address!()` to be clear that returning a null pointer is best-effort. Fix formatting of doc comment Fix mistake in cranelift codegen
…-Simulacrum Implement `core::arch::return_address` and tests Tracking issue: rust-lang#154966 Implements libs-team#768
Rollup of 9 pull requests Successful merges: - #155370 (Add regression test for dead code elimination with drop + panic) - #154823 (Replace the spdx-rs dependency with a minimal in-tree SPDX tag-value parser) - #154972 (Implement `core::arch::return_address` and tests) - #155294 (Add test for coalescing of diagnostic attribute duplicates) - #155352 (triagebot.toml: Sync `assign.owners` with `autolabel."T-compiler"`) - #155431 (Add temporary scope to assert_matches) - #152995 (ACP Implementation of PermissionsExt for Windows ) - #153873 (deprecate `std::char` constants and functions) - #154865 (libtest: use binary search for --exact test filtering)
|
This pull request was unapproved. This PR was contained in a rollup (#155506), which was unapproved. |
|
Oh ok. lang-ref forgets to mention that the intrinsic doesn't work on some targets (wasm). |
|
@rustbot ready |
|
@bors r+ rollup=iffy |
This comment has been minimized.
This comment has been minimized.
Implement `core::arch::return_address` and tests Tracking issue: #154966 Implements libs-team#768
This comment has been minimized.
This comment has been minimized.
|
💔 Test for ec8f768 failed: CI. Failed job:
|
| /// | ||
| /// ## Example | ||
| /// ``` | ||
| /// # #![cfg(not(miri))] // FIXME: Figure out how to make miri work before stabilizing this macro |
There was a problem hiding this comment.
Miri should probably just pick an arbitrary 64bit integer and return that? Or is that too adversarial and we should return null?
There was a problem hiding this comment.
It probably should (though I see it doing either). Right now, I'd like something landed though. My plan is to figure out miri (and codegen_gcc) before stabilization.
There was a problem hiding this comment.
(I suppose we could briefly discuss whether it is "fine" to return just null tomorrow)
There was a problem hiding this comment.
That's more of a Miri thing than an opsem thing so I'd prefer to discuss that in the PR which implements it.
There was a problem hiding this comment.
Fair. In any case, the main thing a random implementation would detect is someone doing a null test, then some form of stupid shenanigans like transmuting to a function pointer and calling it (or .read()ing it). Raw .read() or transmute/call would be detected since null pointer would trip anyways.
|
@rustbot ready |
View all comments
Tracking issue: #154966
Implements libs-team#768