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

rustc: Search all derives for inert attributes #52230

Merged
merged 1 commit into from Jul 12, 2018

Conversation

Projects
None yet
5 participants
@alexcrichton
Copy link
Member

alexcrichton commented Jul 10, 2018

This commit fixes an apparent mistake in librustc_resolve where when the
proc_macro feature is enabled (or rust_2018_preview) the resolution of
custom attributes for custom derive was tweaked. Previously when an attribute
failed to resolve it was attempted to locate if there is a custom derive also in
scope which declares the attribute, but only the first custom derive directive
was search.

Instead this commit fixes the loop to search all custom derive invocations
looking for any which register the attribute in question.

Closes #52219

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jul 10, 2018

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Jul 10, 2018

@@ -412,7 +428,7 @@ impl<'a> Resolver<'a> {
attrs
});
}
return Err(Determinacy::Undetermined);

This comment has been minimized.

@petrochenkov

petrochenkov Jul 10, 2018

Contributor

Hmm, I think the return was actually correct, but misplaced - we can return once we've found an inert attribute and processed it, we don't need to go through remaining traits and possibly repeat the process, so the return should go inside if inert_attrs.contains(&attr_name) { ... }

This comment has been minimized.

@alexcrichton

alexcrichton Jul 10, 2018

Author Member

Oh right yes indeed!

This comment has been minimized.

@alexcrichton

alexcrichton Jul 10, 2018

Author Member

should be updated now!

rustc: Search all derives for inert attributes
This commit fixes an apparent mistake in librustc_resolve where when the
`proc_macro` feature is enabled (or `rust_2018_preview`) the resolution of
custom attributes for custom derive was tweaked. Previously when an attribute
failed to resolve it was attempted to locate if there is a custom derive also in
scope which declares the attribute, but only the first custom derive directive
was search.

Instead this commit fixes the loop to search all custom derive invocations
looking for any which register the attribute in question.

Closes #52219

@alexcrichton alexcrichton force-pushed the alexcrichton:attr-and-derive branch from f8d67a9 to 743a817 Jul 10, 2018

@petrochenkov

This comment has been minimized.

Copy link
Contributor

petrochenkov commented Jul 10, 2018

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jul 10, 2018

📌 Commit 743a817 has been approved by petrochenkov

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jul 12, 2018

⌛️ Testing commit 743a817 with merge d334027...

bors added a commit that referenced this pull request Jul 12, 2018

Auto merge of #52230 - alexcrichton:attr-and-derive, r=petrochenkov
rustc: Search all derives for inert attributes

This commit fixes an apparent mistake in librustc_resolve where when the
`proc_macro` feature is enabled (or `rust_2018_preview`) the resolution of
custom attributes for custom derive was tweaked. Previously when an attribute
failed to resolve it was attempted to locate if there is a custom derive also in
scope which declares the attribute, but only the first custom derive directive
was search.

Instead this commit fixes the loop to search all custom derive invocations
looking for any which register the attribute in question.

Closes #52219
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jul 12, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: petrochenkov
Pushing d334027 to master...

@bors bors merged commit 743a817 into rust-lang:master Jul 12, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@alexcrichton alexcrichton deleted the alexcrichton:attr-and-derive branch Jul 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.