Skip to content
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

Use rustversion and remove const_fn! #353

Merged
merged 4 commits into from
Mar 24, 2022
Merged

Use rustversion and remove const_fn! #353

merged 4 commits into from
Mar 24, 2022

Conversation

josephlr
Copy link
Contributor

@josephlr josephlr commented Mar 24, 2022

The first two commit cleanup some out-of-date documentation

The third commit uses the rustversion create to make the methods from #352 const if the user is on a new enough compiler version.

The fourth commit removes the const_fn! macro, and uses rustversion to just enable the GlobalDescriptorTable const methods if the const_fn feature is selected.

In theory, we could also remove/deprecate the const_fn feature, and just have the GDT methods be const unconditionally if the compiled on nightly. That's a more complicated question, so I'll leave it for a follow up PR.

@josephlr
Copy link
Contributor Author

Actually I just realized we don't need to deprecate the const_fn feature to get rid of the const_fn! macro. We can just do:

#[cfg_attr(feature = "const_fn", rustversion::attr(all(), const))]

Signed-off-by: Joe Richey <[email protected]>
Copy link
Member

@Freax13 Freax13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

@phil-opp phil-opp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me too!

src/structures/gdt.rs Show resolved Hide resolved
@josephlr josephlr changed the title Use rustversion, remove const_fn!, deprecate const_fn feature Use rustversion and remove const_fn! Mar 24, 2022
@josephlr josephlr merged commit 27032e3 into master Mar 24, 2022
@josephlr josephlr deleted the rustversion branch March 24, 2022 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants