-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
fn main() {
module::TupleStruct(0);
}
pub mod module {
pub struct TupleStruct(u8);
}
On stable/beta, the error message is very good:
error[E0450]: cannot invoke tuple struct constructor with private fields
--> <anon>:2:5
|
2 | module::TupleStruct(0);
| ^^^^^^^^^^^^^^^^^^^ cannot construct with a private field
...
6 | pub struct TupleStruct(u8);
| --- private field declared here
error: aborting due to previous error
On nightly, it's flat out lying to the user:
error: tuple struct `TupleStruct` is private
--> <anon>:2:5
|
2 | module::TupleStruct(0);
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
nixpulvis
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.