-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Description
The following error results when attempting to create a constant from some non-constant function:
error[E0015]: calls in constants are limited to constant functions, struct and enum constructors
This may confuse rustaceans coming from languages where "constructors" are specially defined functions, since, in this case, it refers to Foo { field: Expression }
rather than, say, Foo::new()
.
Better phrasing may be struct and enum literals
?
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
steveklabnik commentedon Nov 28, 2017
SGTM
krk commentedon Feb 19, 2018
This issue seems to be fulfilled by the merge.
estebank commentedon Feb 28, 2018
@krk that PR wasn't merged. Picking it up and adding a test for it would be enough.
Rollup merge of rust-lang#50031 - krk:issue-46336, r=estebank