-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Treat dependencies of proc-macro crates like normal dependencies #69976
Changes from all commits
a309a52
ec2ab8f
a6d099c
9dc999e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -558,9 +558,10 @@ impl<'a> CrateLoader<'a> { | |
dep_kind: DepKind, | ||
) -> CrateNumMap { | ||
debug!("resolving deps of external crate"); | ||
if crate_root.is_proc_macro_crate() { | ||
return CrateNumMap::new(); | ||
} | ||
|
||
// Note that we need to resolve deps for proc-macro crates (just like normal crates) | ||
// since we may need to decode `Span`s that reference the `CrateNums` | ||
// of transitive dependencies | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: this comment looks unnecessary, like "look, nothing unusual is happening here, move along". It's the removed special case that required a comment, but didn't have it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We still special-case proc macros is some places, so I thought it was worthwhile to explain why we do this (in case someone ever thinks of re-adding this an an optimization). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's nothing here about proc macros anymore though? I would agree with @petrochenkov that this comment seems more confusing than helpful. We should have a test that ensures this doesn't get re-added? |
||
|
||
// The map from crate numbers in the crate we're resolving to local crate numbers. | ||
// We map 0 and all other holes in the map to our parent crate. The "additional" | ||
|
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.
Why does this need a different check from the above
crate_types.iter().any(|t| t == "proc-macro")
?Generally it also feels wrong or at least odd that we're putting proc macros seemingly twice, once into the host and once into the target directory. That feels reminiscent of a flag @Zoxc, IIRC, added (-Zdual-macros, or so, I don't recall exactly).
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.
The
crate_types.iter().any(|t| t == "proc-macro")
check is looking for proc macro crates. This check is looking for dependencies of proc-macros, which may not be proc-macros themselves.For example, suppose we have the dependency graph
normal_crate_one
->proc_macro_crate
->normal_crate_two
. The cratenormal_crate_two
is not a proc macro crate - but since it's a dependency ofproc_macro_crate
, it will end up in the host dir.