-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
document + UI test E0208
and make its output more user-friendly
#106931
Conversation
Looks good to me, thanks! As you mentioned, it needs approval from the compiler team too. r? @estebank |
@@ -10,7 +10,7 @@ trait Trait { | |||
} | |||
|
|||
#[rustc_variance] | |||
struct Foo<T: Trait> { //~ ERROR [o] | |||
struct Foo<T: Trait> { //~ ERROR E0208 |
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 is first a test tool for the compiler.
In this idea, losing the short version of the information makes the test much less useful.
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 agree with cjgillot -- these UI tests are specifically checking for [+, -]
, etc error outputs to assert the variances of an item's generic parameters.
Replacing them with E0208
and a generic error message makes all of them far less useful -- it seems very easy to accidentally --bless
a test and not notice the output change, versus // ERROR
attributes which need to be "blessed" manually.
Secondly, I don't think a structured suggestion to remove the attribute is necessarily useful.
@compiler-errors Yeah, I get that and perhaps we can work the old behavior back in somehow. The point though, is that if an error has a code, then it should be documented, tested and usable from a users perspective. This could become helpful for someone learning about variance, etc. Perhaps we can add a note with just the old one like EDIT: Alternatively, if you think this really should be purely internal then it shouldn't have an error code. |
This error is purely internal. It certainly isn't a good candidate for stabilization in the state that it's currently written, not even considering that it's a -- The problem with
Or something... seems like a lot of overhead. |
@compiler-errors Oh, I am absolutely not saying it should be stabilized, just that perhaps it could be used for more than just testing. What about having |
Well in that case, I'd rather just remove the error code from this error, and keep it fully internal. If we want to add a new error code and some other variance inspection tool (maybe via a warning rather than an error), then it should be suggested and implemented separately. |
@compiler-errors I've removed the error code from @rustbot ready |
This is fine then @bors r+ |
Yup I'm fine with it. Sorry didn't see the notification. |
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#105977 (Transform async `ResumeTy` in generator transform) - rust-lang#106927 (make `CastError::NeedsDeref` create a `MachineApplicable` suggestion) - rust-lang#106931 (document + UI test `E0208` and make its output more user-friendly) - rust-lang#107027 (Remove extra removal from test path) - rust-lang#107037 (Fix Dominators::rank_partial_cmp to match documentation) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Cleans up
E0208
's output a lot. It could actually be useful for someone learning about variance now. I also added a UI test for it intests/ui/error-codes/
and wrote some docs for it.r? @GuillaumeGomez another error code, can't be bothered to find the issue :P. Obviously there's some compiler stuff, so you'll have to hand it off.
Part of #61137.