[ty] Split invalid-base error code into two error codes#18245
Merged
AlexWaygood merged 2 commits intomainfrom May 21, 2025
Merged
[ty] Split invalid-base error code into two error codes#18245AlexWaygood merged 2 commits intomainfrom
invalid-base error code into two error codes#18245AlexWaygood merged 2 commits intomainfrom
Conversation
Contributor
|
AlexWaygood
commented
May 21, 2025
Comment on lines
-906
to
-911
| if base_ty.is_never() { | ||
| // A class base of type `Never` can appear in unreachable code. It | ||
| // does not indicate a problem, since the actual construction of the | ||
| // class will never happen. | ||
| continue; | ||
| } |
Member
Author
There was a problem hiding this comment.
I moved this check into ClassBase::try_from_ty so that we don't create the MroError in the first place for classes that inherit from Never
Member
Author
There was a problem hiding this comment.
The changes in this file are a drive-by fix to try to solve the indeterminacy we've seen in the order of some of our duplicate-base diagnostics. See e.g. #18226 (comment) -- it's been changing randomly on several PRs that touch mro.rs
invalid-base diagnostic into two diagnosticsinvalid-base error code into two error codes
65d51c9 to
ba769c1
Compare
ba769c1 to
04472b4
Compare
carljm
approved these changes
May 21, 2025
419f3dd to
eb3e7d5
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Our
invalid-basediagnostic currently catches two somewhat distinct things:type)type[]types, instances oftype, etc.)The fact that it's doing two distinct things makes it hard to document the lint, and would also make it hard for users to suppress the lint in a fine-grained way (the first category of errors is much more serious than the second category). This PR therefore splits the diagnostic into two:
invalid-baseandunsupported-base. It also adds documentation for both new error codes.Test Plan
Snapshots