-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Unchecked div/rem no longer generic #29288
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
Conversation
Now they are [ui](8|16|32|64)_unchecked_(div|rem)
r? @aturon (rust_highfive has picked a reviewer for you, use r? to override) |
I'd also like to change |
Rather than this approach, I’d prefer intrinsics checked their specialisation instead. Similarly to the SSE intrinsics code. See this which results in E511. |
I would also kinda tend to err on the side of ease of implementation of intrinsics, but @GBGamer I'm curious was there a use case other than bad monomorphizations which motivated this? |
@alexcrichton because it's really ugly. |
Intrinsics are regarded as things that should essentially never be called directly: just once for each type, to build up safe abstractions. I.e. inaccuracies in their type signatures aren't thought to be the end of the world. |
@huonw: that may be true, that doesn't mean it doesn't bother me :P. However, I think that switching to the |
@huonw The issue I have is this: #![feature(core_intrinsics)]
fn main() {
unsafe { std::intrinsics::unchecked_sdiv((),()); }
} ends up spitting out
and also that you can call |
Sure, I'm all for "last minute" (i.e. like |
I've an idea. One sec, let me try something. |
Similarly to the simd intrinsics. I believe this is a better solution than #29288, and I could implement it as well for overflowing_add/sub/mul. Also rename from udiv/sdiv to div, and same for rem.
Similarly to the simd intrinsics. I believe this is a better solution than #29288, and I could implement it as well for overflowing_add/sub/mul. Also rename from udiv/sdiv to div, and same for rem.
Now they are
[ui](8|16|32|64)_unchecked_(div|rem)
This is more in line with the other mathematical intrinsics, and means you can't, for example, call
unchecked_sdiv((),())
anymore.