Skip to content
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

typeck: don't suggest inaccessible private fields #76524

Merged

Conversation

davidtwco
Copy link
Member

Fixes #76077.

This PR adjusts the missing field diagnostic logic in typeck so that when none of the missing fields in a struct expr are accessible then the error is less confusing.

r? @estebank

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 9, 2020
src/test/ui/issues/issue-76077.rs Show resolved Hide resolved
@davidtwco davidtwco force-pushed the issue-76077-inaccessible-private-fields branch from 8530836 to 786ba36 Compare September 10, 2020 11:51
@estebank
Copy link
Contributor

@bors r+

Approving. Feel free to change the wording of the message and reapprove, but otherwise we can do it at a later time.

@bors
Copy link
Contributor

bors commented Sep 10, 2020

📌 Commit 786ba36acff04c1ae3e44895a4d30053f495b3d5 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 10, 2020
This commit adjusts the missing field diagnostic logic for struct
expressions in typeck to improve the diagnostic when the missing
fields are inaccessible.

Signed-off-by: David Wood <david@davidtw.co>
This commit adjusts the missing field diagnostic logic for struct
patterns in typeck to improve the diagnostic when the missing fields are
inaccessible.

Signed-off-by: David Wood <david@davidtw.co>
@davidtwco davidtwco force-pushed the issue-76077-inaccessible-private-fields branch from 786ba36 to 409c141 Compare September 10, 2020 17:52
@estebank
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Sep 10, 2020

📌 Commit 409c141 has been approved by estebank

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#75857 (Syntactically permit unsafety on mods)
 - rust-lang#76289 (Add docs about crate level documentation support)
 - rust-lang#76514 (Add revisions to const generic issue UI tests.)
 - rust-lang#76524 (typeck: don't suggest inaccessible private fields)
 - rust-lang#76548 (Validate removal of AscribeUserType, FakeRead, and Shallow borrow)
 - rust-lang#76555 (Reword `trivial_casts` lint in rustc book to better explain what it does.)
 - rust-lang#76559 (add the `const_evaluatable_checked` feature)
 - rust-lang#76563 (small typo fix in rustc_parse docs)
 - rust-lang#76565 (take reference to Place directly instead of taking reference to Box<Place>)
 - rust-lang#76567 (use push(char) to add chars (single-char &strs) to strings instead of push_str(&str))
 - rust-lang#76568 (Add missing examples on core traits' method)

Failed merges:

r? `@ghost`
@bors bors merged commit 9f8a782 into rust-lang:master Sep 10, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 10, 2020
@davidtwco davidtwco deleted the issue-76077-inaccessible-private-fields branch September 14, 2020 10:03
bors added a commit to rust-lang/cargo that referenced this pull request Dec 2, 2020
Fix semver documentation tests.

GitHub just updated the VM image to include the latest stable rust (1.48), which included some minor changes to diagnostic outputs.  This updates the semver chapter tests which validates that the correct error is displayed for the 1.48 release.  These diagnostics were changed via rust-lang/rust#76524 and rust-lang/rust#73996.
ehuss pushed a commit to ehuss/cargo that referenced this pull request Dec 4, 2020
Fix semver documentation tests.

GitHub just updated the VM image to include the latest stable rust (1.48), which included some minor changes to diagnostic outputs.  This updates the semver chapter tests which validates that the correct error is displayed for the 1.48 release.  These diagnostics were changed via rust-lang/rust#76524 and rust-lang/rust#73996.
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 10, 2021
typeck: don't suggest inaccessible fields in struct literals and suggest ignoring inaccessible fields in struct patterns

Fixes rust-lang#87872.

This PR adjusts the missing field diagnostic logic in typeck so that when any of the missing fields in a struct literal or pattern is inaccessible then the error is less confusing, even if some of the missing fields are accessible.

See also rust-lang#76524.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E0063 should not suggest adding inaccessible private fields
5 participants