10BC0 Mark derive with `$crate::` by upsuper · Pull Request #239 · servo/rust-cssparser · GitHub
Skip to content

Conversation

@upsuper
Copy link
Contributor

@upsuper upsuper commented Feb 27, 2019

There is a problem currently that for example I create a procedural macro cstr, if users use

use cstr::cstr;
let x = cstr!(...);

the compiler would complain

error: cannot find derive macro cstr_internal__build_bytes in this scope

This is because the custom derive macro is not imported. So if users want to use this macro, they would need to either use the traditional #[macro_use] extern crate cstr; or use cstr::*;. Neither is optimal.

This PR adds $crate:: to the derive so that users of procedural macro can just import the macro they need.


This change is Reviewable

@upsuper upsuper requested a review from SimonSapin February 27, 2019 10:14
@nox
Copy link
Contributor

nox commented Feb 27, 2019

That's a breaking change, IIRC that's not supported by older Rust versions. If we make a breaking change we should rather remove hacks and use a proper procedural macro directly etc.

@upsuper
Copy link
Contributor Author

upsuper commented Feb 27, 2019

Hmmm... CI fails with interesting errors :/

The support of this syntax is from 1.30, fwiw.

@upsuper upsuper closed this Feb 27, 2019
@upsuper upsuper deleted the procedural-masquerade-2018 branch February 27, 2019 10:27
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.

2 participants