-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Unstably allow assume intrinsic in const contexts #76973
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// check-pass | ||
|
||
// Check that `const_assume` feature allow `assume` intrinsic | ||
// to be used in const contexts. | ||
|
||
#![feature(core_intrinsics, const_assume)] | ||
|
||
extern crate core; | ||
|
||
use core::intrinsics::assume; | ||
|
||
pub const unsafe fn foo(x: usize, y: usize) -> usize { | ||
assume(y != 0); | ||
x / y | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this the kind of test that should be made a unit test instead (#76268)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I only saw There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think this should be a unit-test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's kind of weird since most intrinsics not tested in |
||
|
||
fn main() {} |
Uh oh!
There was an error while loading. Please reload this page.