Skip to content

"constant expression depends on a generic parameter" error can be improved. #71142

Open
@eddyb

Description

@eddyb

Original discussion happened at #70452 (comment).


This was my last proposal in that comment thread (#70452 (comment)):

So perhaps a better phrasing for the error itself might be "cannot prove/determine/guarantee/etc. that constant expression will evaluate successfully" and then we can search its Substs for type/const parameters and list them out to give the more helpful information.

We should also link https://github.com/rust-lang/rust/issues/68436, in some sort of help messaging along the lines of "there is no way to currently write the necessary where clause, watch this space".

cc @rust-lang/wg-diagnostics @varkor @yodaldevoid

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.PG-const-genericsProject group: Const genericsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions