Tuple-struct constructor visibility leads to inconsistency in pattern matching #76494
Labels
A-visibility
Area: Visibility / privacy
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following code:
produces the following error:
This is caused by the fact that tuple structs have their 'constructor' visibility set to their most restrictive field visibility:
rust/compiler/rustc_resolve/src/build_reduced_graph.rs
Lines 799 to 809 in 08deb86
This behavior seems quite inconsistent. As a user, I would expect that tuple structs and named structs are just two different ways of naming the fields of a struct, and behave identically w.r.t privacy.
Is there a reason for this difference in behavior, or is this just a historical quirk of the resolver?
Thanks to @guswynn for bringing this to my attention.
The text was updated successfully, but these errors were encountered: