Skip to content

feat(features): remove FeatureBits bounds that are not elaborated and seal FeatureBits#20

Open
mkroening wants to merge 2 commits intomainfrom
features-trait
Open

feat(features): remove FeatureBits bounds that are not elaborated and seal FeatureBits#20
mkroening wants to merge 2 commits intomainfrom
features-trait

Conversation

@mkroening
Copy link
Member

When users wanted to be generic over FeatureBits before, they had to duplicate the list of non-supertrait where bounds because only supertrait bounds are elaborated:

fn foo<T: FeatureBits>(features: T)
where
    virtio::F: From<T> + AsRef<T> + AsMut<T>;

This PR removes the not-elaborated where clauses to make generic code less verbose:

fn foo<T: FeatureBits>(features: T);

Of course, if the generic function wants to use some non-elaborated bounds, that is still possible.

cargo-semver-checks detects this as a breaking change, but I don't think it actually is. I think it does not handle the fact that Trait: Supertrait is equivalent to Trait where Self: Supertrait.

Still, we need to do a breaking release anyway because of #18, so this PR also seals FeatureBits. I don't think anyone would want to implement FeatureBits outside this crate without the internal helper macros anyway.

@mkroening mkroening requested a review from phip1611 January 29, 2026 13:54
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.

1 participant