-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Add X to crate attributes to enable message is not very clear #55941
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-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.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The message above is what I get attempting to use try_from. The issue is that it's not clear where crate attributes are, or whey they go. The rust book makes little mention of them. Adding this to "lib.rs", causes new errors such as:
As a result, it's really not clear how to resolve this error.
The descriptive error rustc --explain E0658 also doesn't demonstrate what to do correctly.
The error message should explain which file to add the #[feature] line too. Additionally, the E0658 should explain not just what file, but what to do in a multi-file case (ie lib.rs contains mod foo, and foo.rs wants to use the feature).
This would help to make this easier to resolve and access these features.
EDIT: It would be also useful to handle the mod tests situation as well where you want to test a feature like TryFrom in mod tests, because that likely needs different/other handling?