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

unsafe_textures feature flag is not additive #1410

Open
antonilol opened this issue Jun 17, 2024 · 3 comments
Open

unsafe_textures feature flag is not additive #1410

antonilol opened this issue Jun 17, 2024 · 3 comments

Comments

@antonilol
Copy link
Contributor

Reference on feature flags: https://doc.rust-lang.org/cargo/reference/features.html#feature-unification

If I, in a library, use Texture<'a> and a user of my library enables the unsafe_textures feature flag on sdl2, then the code in the library no longer compiles, because the changes (the difference between having unsafe_textures enabled or disabled) are not SemVer compatible.

I suggest making a new struct, that wraps Texture<'static> (or the contents of it) and provides unsafe methods to use it (unsafe because it is not known if the pointer is still valid), could even be without feature flag to allow using both, where needed. (I did not test this, so this idea to fix this might not be entirely accurate)

@antonilol
Copy link
Contributor Author

looks to be the case for hidapi as well, adding and removing an enum member is a breaking change.

event.rs:301, enum member is cfg'ed out:

    #[cfg(feature = "hidapi")]
    ControllerSensorUpdated = SDL_EventType::SDL_CONTROLLERSENSORUPDATE as u32,

@Cobrand
Copy link
Member

Cobrand commented Jun 24, 2024

Impossible without features for the first one unfortunately.

For Hidapi I think the feature can be removed as it used to be experimental in SDL2 but now is quite stable, but I'm not 100% sure.

@antonilol
Copy link
Contributor Author

just found out, related to #943

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

No branches or pull requests

2 participants