Skip to content

E0158 explanation refers to statics, when it should be talking about associated consts #105585

Closed
@kpreid

Description

@kpreid

Location

https://doc.rust-lang.org/nightly/error_codes/E0158.html

Summary

The introduction says that this error is about using an associated const in a pattern, and a user encountered it in that context. However, every paragraph after the erroneous code example talks about why you can't match a static, not why you can't match an associated const.

This seems like it might have been accidentally copied without edits from some other error, but there is no other copy of that text. (Was E0158 repurposed, perhaps?)

Proposed improvement

  • E0158 should explain why associated consts may not be matched, and
  • The text discussing static should be moved to E0530, which is the code actually produced by trying to use a static in a pattern, and which currently has only erroneous code samples and not an explanation of why.

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions