-
Notifications
You must be signed in to change notification settings - Fork 406
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
Traverse custom alias-like rules in the rust analyzer aspect #1190
Traverse custom alias-like rules in the rust analyzer aspect #1190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not going to lie, this is one of the stranger PRs, but I assume it solves a useful problem :)
rust/private/rust_analyzer.bzl
Outdated
if BuildInfo in dep: | ||
build_info = dep[BuildInfo] | ||
dep_infos = [] | ||
if hasattr(ctx.rule.attr, "proc_macro_deps"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels worth a comment - I'm assuming this is for sniffing whether we're a rules_rust rule vs some other one, which happens to also expose BuildInfo
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug :) I wanted to test if there is 'deps' attribute, not a 'proc_macro_deps' attribute. Fixed now.
if hasattr(ctx.rule.attr, "proc_macro_deps"): | ||
dep_infos += [dep[RustAnalyzerInfo] for dep in ctx.rule.attr.proc_macro_deps if RustAnalyzerInfo in dep] | ||
if hasattr(ctx.rule.attr, "crate") and ctx.rule.attr.crate != None: | ||
dep_infos.append(ctx.rule.attr.crate[RustAnalyzerInfo]) | ||
if hasattr(ctx.rule.attr, "actual") and ctx.rule.attr.actual != None: | ||
dep_infos.append(ctx.rule.attr.actual[RustAnalyzerInfo]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably sniff for whether actual
has a RustAnalyzerInfo
before trying to read it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
aa83917
to
90f0c3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
8aa19f5
to
166b4fa
Compare
No description provided.