-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Don't mark "safe" intrinsics as unsafe #86327
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: ![Screenshot from 2021-06-15 14-58-42](https://user-images.githubusercontent.com/3050060/122056942-65ddad00-cdea-11eb-829e-5f5e258387de.png) After: ![Screenshot from 2021-06-15 14-59-22](https://user-images.githubusercontent.com/3050060/122056956-6aa26100-cdea-11eb-94d8-e18b4956cfa4.png) 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