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

Move segment types into a new registers::segmentation module #309

merged 1 commit into from Sep 20, 2021


Copy link

The segment types themselves and the related traits do not require the instructions feature, so I think that it makes sense to move them to the top-level registers module. The instructions::segmentation module still re-exports all the types, so this change should not break any code. I also moved the SegmentSelector type from the gdt module to the new module since it's more related to the segment registers than to the GDT.

This should fix cargo doc errors reported in #307 since the segment types are now available even without the instructions feature. Some special handling was necessary for the GsBase and KernelGsBase types: They now use a #[cfg_attr(feature = "instructions", doc = "...")] to append the link to the swap method only when it is available.

To ensure that we don't regress on this, I added cargo doc --no-default-features as a step in our CI script.

Fixes #307

The segment types themselves do not require the `instructions` feature, so it makes sense to move them to the top-level `registers` module. The `instructions::segmentation` module still re-exports all the types, so this change should not break any code.

Fixes #307
Copy link

@josephlr We are currently blocked from releasing the sgx crate due to this bug.

Copy link

@josephlr josephlr left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me, I checked over everything and the docs (with and without default features) look reasonable. We could just remove the entire x86_64::instructions::segmentation module when we remove the deprecated free functions.

@josephlr josephlr merged commit 022598a into master Sep 20, 2021
@josephlr josephlr deleted the fix-307 branch September 20, 2021 18:52
josephlr added a commit that referenced this pull request Sep 20, 2021
Signed-off-by: Joe Richey <>
@josephlr josephlr mentioned this pull request Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

cargo doc is broken when default-featues = false
3 participants