Traverse CrateGroupInfo when gathering CcInfo linking_context entries for use_cc_common_link#3787
Conversation
UebelAndre
left a comment
There was a problem hiding this comment.
Thanks! Is there a unit test you could add somewhere in //test/unit or something? Would love to have some protection against regressions.
|
Yeah I was wondering where I should put that, since there's only one test I think actually exercising this experimental flag and the configuration looks mildly complex. But I'll see if I can add something to it. |
6983cb3 to
ac7d5c0
Compare
|
Turns out with further testing there's more places that don't account for crate groups. So this patch was incomplete and would fix direct dependencies, but not indirect dependencies, which happens during establish_cc_info. I've updated it to factor out the crate group flattening into a separate function plus the added tests. |
|
We also encountered the same issue, and this PR works well for us. |
UebelAndre
left a comment
There was a problem hiding this comment.
In general I think the change looks good, I just want to always make sure there's some regression testing. For the new tests, can you show what the error looks like without the fix applied? I otherwise defer to @krasimirgg to make sure this solves for their needs as well 😄
Thanks again!
|
Looks very reasonable! +1 for adding some test coverage, as these types of things tend to regress due to "spooky action at a distance" sometimes. To share some context: internally, we don't use |
|
Is there somewhere else I should be adding coverage that isn't covered by what I've added in this PR? |
No, I think you found it but if this feature is ever going to move out of experimental we'll probably need to add unit tests for it at I just want to know what the failure signature looks like without the fix and then see this fix resolve that for now. |
ac7d5c0 to
c342400
Compare
… for use_cc_common_link Certain code written before crate groups were introduced wasn't adjusted to traverse groups, specifically code that traverses crate deps to discover cc_info. collect_deps properly does flatten crate_groups, so this moves the code for flattening a list of DepVariantInfo into a utility function, 'flatten_crate_groups'. This fixes rust_library_group and rust_prost_library for experimental_use_cc_common_link.
c342400 to
0f11b65
Compare
This fixes rust_library_group and rust_prost_library for experimental_use_cc_common_link
Closes #3786