Uh oh!
There was an error while loading. Please reload this page.
Improve Error Messaging for Unconstructed Structs and Enum Variants in Generic Contexts - #92569
Conversation
rust-highfive
commented
Jan 5, 2022
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @davidtwco (or someone else) soon. Please see the contribution instructions for more information. |
George-lewis
commented
Jan 5, 2022
r? @estebank |
There was a problem hiding this comment.
Can we assume this won't fail here? Is it ok for it to fail?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Please also add a UI test ( |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
I think you need to run ./x.py test --bless src/test/ui/typeck/issue-87181-empty-tuple-fields.rs.
There was a problem hiding this comment.
I think I might be missing something? I ran your command and it generated the stderr file, but the test still fails, and it's showing me some JSON.
Edit: I figured it out, I needed a //~^ ERROR in there
George-lewis
commented
Jan 5, 2022
@camelid Did I pick an acceptable filename for the ui test? I couldn't find much guidance in the contribution guide |
camelid
commented
Jan 5, 2022
The name seems fine to me. |
This comment has been minimized.
This comment has been minimized.
Proposal: Go beyond the scope of the ticket to improve error handling to support tuple-structs with elements, and also add the check to member access rather than just to method calls For instance we can cover this case as so: structBar<T>{bar:T}structFoo(u8);implFoo{fnfoo(){}}fnmain(){let thing = Bar{bar:Foo};
thing.bar.0;}error[E0609]: no field `0` on type `fn(u8) -> Foo{Foo}`
--> test.rs:12:15
|
12 | thing.bar.0;
| --------- ^
| |
| help: call the constructor: `(thing.bar)(_)`
|
= help: placeholder
error: aborting due to previous error
For more information about this error, try `rustc --explain E0609`.Also, if the original code has unnecessary brackets, like |
George-lewis
commented
Jan 5, 2022
I have expanded the scope a little in line with my proposal. Now, the same checks are applied to field accesses, and non-empty tuple constructors are handled. There are 2 new tests to cover these cases. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
bors
commented
Apr 26, 2022
💔 Test failed - checks-actions |
George-lewis
commented
Apr 26, 2022
It seems like there might have been a network error? |
estebank
commented
Apr 26, 2022
@bors retry |
bors
commented
Apr 26, 2022
🔒 Merge conflict This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again. How do I rebase?Assuming
You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial. Please avoid the "Resolve conflicts" button on GitHub. It uses Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Error message |
estebank
commented
Apr 26, 2022
It seems like you'll have to rebase. You might want to squash all your commits into one before doing that to make it easier to resolve the merge conflicts. |
George-lewis
commented
Apr 26, 2022
It does seem that way. I'm looking at it now and it looks like some new diagnostics were implemented, so I'll have to figure out what it does so I can integrate it with my diagnostics 🤔 |
bors
commented
Apr 26, 2022
☔ The latest upstream changes (presumably #96428) made this pull request unmergeable. Please resolve the merge conflicts. |
George-lewis
commented
Apr 26, 2022
Oh God |
I think I messed up the rebase. At this point I just want to make a new branch Edit: I'm in the process of making a new branch now. |
George-lewis
commented
Apr 26, 2022
Unfortunately I had to force push, but I think it should be ok now |
estebank
commented
Apr 26, 2022
@bors r+ |
bors
commented
Apr 26, 2022
📌 Commit a6b570b has been approved by |
Rollup of 6 pull requests Successful merges: - rust-lang#92569 (Improve Error Messaging for Unconstructed Structs and Enum Variants in Generic Contexts) - rust-lang#96370 (Cleanup `report_method_error` a bit) - rust-lang#96383 (Fix erased region escaping into wfcheck due to rust-lang#95395) - rust-lang#96385 (Recover most `impl Trait` and `dyn Trait` lifetime bound suggestions under NLL) - rust-lang#96410 (rustdoc: do not write `{{root}}` in `pub use ::foo` docs) - rust-lang#96430 (Fix handling of `!` in rustdoc search) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Improves error messaging for empty-tuple structs and enum variants in certain generic contexts. See new ui tests for examples.
Closes#87181