-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Don't mark "safe" intrinsics as unsafe #86327
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Can you add a test for this? |
Well, I have no idea how to do that... Only a few specific intrinsics listed in the typeck function are safe to call, and we don't run DOM tests on std/core. If you have an idea by any chance? |
I thought intrinsics were part of the compiler, not the standard library? Anyway, you can replicate however the standard library does it in a standalone file with #![no_core] and then test that. |
Oh good idea! |
Done, thanks again for the tip! |
📌 Commit 58617eb492a72efb581884f48565a2e7e8c2dcfe has been approved by |
@bors r- until we check whether this is applied to all |
58617eb
to
790b91b
Compare
I added the abi check. |
Could we add something like this to the test ? extern "C" {
// @has 'foo/fn.needs_drop.html'
// @has - '//pre[@class="rust fn"]' 'pub unsafe extern "C" fn needs_drop() -> !'
pub fn needs_drop() -> !;
} |
790b91b
to
f683040
Compare
@lqd Added your test as well! |
@bors r+ |
📌 Commit f683040 has been approved by |
Don't mark "safe" intrinsics as unsafe A good example of this is [intrinsics::abort](https://doc.rust-lang.org/nightly/core/intrinsics/fn.abort.html). Before:  After:  cc `@jyn514` r? `@lqd`
Rollup of 8 pull requests Successful merges: - rust-lang#85283 (Avoid possible filename collision in coverage tests) - rust-lang#86200 (Updates `Clone` docs for `Copy` comparison.) - rust-lang#86209 (fix minor wording/typo issues in core::option docs) - rust-lang#86242 (rustdoc- dont ICE on `ConstEvaluatable` predicates) - rust-lang#86280 (Add a regression test for issue-76510) - rust-lang#86293 (Allow to run only a few GUI tests) - rust-lang#86327 (Don't mark "safe" intrinsics as unsafe) - rust-lang#86345 (Remove some duplicate `char` assoc items on RELEASES.md) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
A good example of this is intrinsics::abort.
Before:
After:
cc @jyn514
r? @lqd