-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Proc macro hygiene regression #46489
Copy link
Copy link
Open
Labels
A-hygieneArea: Macro hygieneArea: Macro hygieneA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-hygieneArea: Macro hygieneArea: Macro hygieneA-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Something in the range bb42071...f9b0897, likely #46343 (CC @jseyfried), broke Servo.
We have a
#[dom_struct]attribute implemented in adom_structcrate like this:Each of the derives is defined in a respective crate. The
scriptcrate depends on all of these crates and uses#[dom_struct]. Some of the derives generate code that reference items defined inscript. For example,#[derive(DomObject)]implements thescript::dom::bindings::refector::DomObjecttrait.Since rustc 1.24.0-nightly (f9b0897 2017-12-02), every use of
#[dom_struct]fails with:I suppose that these errors come from code generated by the derives, and that
{{root}}refers to the root of thedom_structcrate where the#[derive(…)]tokens come from. Indeed, thejsanddomare not an cannot be available there, they’re in thescriptcrate which depends ondom_struct.We can work around this by erasing hygiene data in the
#[derive(…)]tokens:… but this seems like a valid pattern that shouldn’t necessitate such hacks.