-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
In current nightly (2019-11-18 and also 2019-11-16) and stable (1.39.0), tuple structs can not be instantiated from an outside module directly if
- all of the members are public
- at least one of the struct members has an attribute (like
#[serde(rename = "some_name")]
)
Example code that is broken:
In the same module the code works:
Same with normal structs:
The broken code works in 1.38.0:
Meta
One of the affected installations:
rustc 1.41.0-nightly (5c5b8afd8 2019-11-16)
binary: rustc
commit-hash: 5c5b8afd80e6fa1d24632153cb2257c686041d41
commit-date: 2019-11-16
host: x86_64-apple-darwin
release: 1.41.0-nightly
LLVM version: 9.0
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-bugCategory: This is a bug.Category: This is a bug.P-highHigh priorityHigh priorityT-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.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
Erk- commentedon Nov 19, 2019
It seems to only happen with external attributes. Attributes like
#[deprecated]
and similar does not show this bug.[-]tuple structs with all-public fields can not be instantiated if one of the fields has an attribute[/-][+]tuple structs with all-public fields can not be instantiated if one of the fields has an external attribute[/+]petrochenkov commentedon Nov 19, 2019
Minimized:
petrochenkov commentedon Nov 20, 2019
Similarly to #66487, this issue was introduced by #63468 and recently unmasked for derive helper attributes by #64694.
pnkfelix commentedon Nov 21, 2019
Based on @petrochenkov 's assertion that this was introduced by PR #63468, marking this as a stable-to-stable regression.
pnkfelix commentedon Nov 22, 2019
Marking P-high, mostly because of the risk that a crate might rely on being able to use struct literal expressions in other modules, and then a later version of that crate wants to put an attribute on of the fields of the struct literal.
petrochenkov commentedon Nov 23, 2019
Fixed in #66669.