You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
rustbot
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
May 9, 2026
Thinking about this a bit more, I'm wondering if maybe check_externally_implementable_items should be done only at link time? tcx.used_crate_source() may report that only a dylib exists even when at link time an rlib will be available and linked in. And tcx.dependency_formats() will report everything as NotLinked inside rlibs and would ideally only be called during the link step for -Zno-link/-Zlink-only to work (it is currently broken because dependency_formats is called during codegen. i've been working on moving this call to the link step for the past several months). On the other hand for all cases that the check caught before this PR, doing it before linking is fine. So splitting it into separate checks for duplicate explicit impls and for a default impl conflicting with an explicit impl would preserve early error messages (especially for cargo check) What do you think @jdonszelmann?
Thinking about this a bit more, I'm wondering if maybe check_externally_implementable_items should be done only at link time? tcx.used_crate_source() may report that only a dylib exists even when at link time an rlib will be available and linked in. And tcx.dependency_formats() will report everything as NotLinked inside rlibs and would ideally only be called during the link step for -Zno-link/-Zlink-only to work (it is currently broken because dependency_formats is called during codegen.
So splitting it into separate checks for duplicate explicit impls and for a default impl conflicting with an explicit impl would preserve early error messages (especially for cargo check)
@bjorn3 I'm done with the split, what do you think?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
5 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR rejects explicit EII implementations that would override a default implementation already selected through a linked dylib.
The check is intentionally split:
Fixes #156320.