-
Notifications
You must be signed in to change notification settings - Fork 66
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
Expects the syn crate to be imported by the user as the name syn #202
Comments
Wouldn't this pin
I don't see this changing. I don't relish the idea of touching every single file in |
I'm not sure I understand you fully, but the answer should be "no". Darling requires syn If there's ever a syn 2.x (unlikely, from what I understand), then the current setup will fail for anyone who does
🤷 your crate; I've made you aware of it at least. |
Re-exporting doesn't change how dependency resolution works, so no worries there. Any semver-compatible version can be chosen, just as if the user added
I guess just to ask for clarity for potential contributors: Do you oppose the idea itself or would you be fine with someone else (who might need it) to do it? |
That's what I was worried about, so thanks for clarifying. Given that, I'd be fine with a PR that made generated code use
I'd like to see the impact on part of the codebase before making a final decision; for example, having to thread a crate root into I'd also be curious to understand better the situation in which the name |
The primary reason is to allow people to rename dependencies. A key reason I've needed such a feature is when there are two semver-incompatible versions of a dependency that I need. The playground shows an example of that
The same way you protect against people creating types also named |
I’m surprised that this has been an issue in practice, given darling’s fairly-specific use-case.
I’ll be curious to see the impact such a change has on code readability in |
I've just done this in colin-kiegel/rust-derive-builder#275.
|
While creating the reproduction for #201, I originally did not add
syn
as my own dependency:This causes the error:
Ideally, darling would not expect that the user has a crate named
syn
in scope. A better idea is to re-export syn from the darling crate and then you can use that path without worry.A related problem is if darling itself is renamed. SNAFU uses the
crate_root
attribute to allow the end user to specify what thesnafu
crate should actually be called.The text was updated successfully, but these errors were encountered: