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

ConnectionExt cannot be imported automatically #661

Open
mahkoh opened this issue Feb 23, 2022 · 3 comments
Open

ConnectionExt cannot be imported automatically #661

mahkoh opened this issue Feb 23, 2022 · 3 comments
Labels
stable API Things that might require API changes

Comments

@mahkoh
Copy link

mahkoh commented Feb 23, 2022

There are multiple traits called ConnectionExt, multiple of which often must be used within the same module. IDEs are unable to import these traits automatically due to the name conflicts or will import them but cause errors at compile time. This would not be a problem if these traits were prefixed with their protocol.

@psychon
Copy link
Owner

psychon commented Feb 23, 2022

IDEs are unable to import these traits automatically due to the name conflicts or will import them but cause errors at compile time.

Just so that I understand this correctly: The problem is not that the IDE does not find the right trait, the problem is that it could end up with something like the following (which fails to compile because there are two ConnectionExts in scope), right?

use x11rb::protocol::{shm::ConnectionExt, sync::ConnectionExt};

@mahkoh
Copy link
Author

mahkoh commented Feb 23, 2022

That's correct. CLion is also able to find all of the methods. The problem happens once I try to compile the program.

@eduardosm
Copy link
Collaborator

You probably want to do something like this (note the as _):

use x11rb::protocol::{shm::ConnectionExt as _, sync::ConnectionExt as _};

That will bring trait methods into scope, but not the trait name itself.

@psychon psychon added the stable API Things that might require API changes label May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable API Things that might require API changes
Projects
None yet
Development

No branches or pull requests

3 participants