-
Notifications
You must be signed in to change notification settings - Fork 276
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
Mark appropriate const fns as promotable #471
Conversation
Could you please add a link to the rustc commit? :) |
Can't, the PR isn't even open yet ;) I'll do that when I get there. Could you place this PR into a branch so we're following the rustc rules for lockstep upgrades correctly? |
And now we have a PR: rust-lang/rust#51500 |
I'd ask @alexcrichton and @gnzlbg to do it since I never did before :) |
|
That part I knew, the branch naming and where to put it is the part I'm completely oblivious of :) |
It might be obvious, but what is a promotable const fn (neither the commit msgs here nor in rustc upstream explain)? Also, it would be cool to add some tests that would break without the promotable attribute (you can add them inline, or in stdsimd/crates/coresimd/tests). |
A promotable const fn is one that is marked with the We have such tests in the rustc repository, I'll check if you have compile-fail tests, if not, this is untestable anyway, |
So does that mean that all |
No further functions should need this attribute. These two PRs just marked all the const fns callable from stable code (directly or indirectly) as promotable (because they already were stable). Now we can continue stabilizing const fns without stabilizing their promotability at the same time |
coresimd/ppsv/api/masks.rs
Outdated
@@ -11,25 +11,29 @@ macro_rules! impl_mask_minimal { | |||
/// Creates a new instance with each vector elements initialized | |||
/// with the provided values. | |||
#[inline] | |||
#[promotable_const_fn] | |||
pub const fn new($($elem_name: bool),*) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which stable code can call the const functions in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to find that out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh... other than removing the attribute and following the fallout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you post the fallout? I am curious because nothing in this module should be reachable from stable code and IIRC nothing in the stable API of the crate uses it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, only the stdsimd/arch/detect/cache.rs functions should be reachable from stable code =/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh... will do, I might have been a little overeager in marking things here, because it was hard to tell what was called from where.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be that I screwed up. Worst case we can just merge this as is, and once the next nightly I can try removing the attribute from all places where it shouldn't be needed. Let me know when you want this merged (probably after the PR upstream is reviewed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, removed all unnecessary attributes
I have not found any such tests. So we'd have to add such tests, which is a lot of effort for little gain, as it's tested by the rustc test suite and will be checked here once the attribute is part of rustc |
We're going an alternative route, so no attributes are needed |
This is in preparation for doing the same change to rustc. The feature and attribute don't exist yet, so there'll be some warnings, but they'll go away once the actual change hits nightly