rust-lang / rust-lang/rust

Give `resolve_const_param_in_non_trivial_anon_const` more contextual information

Open
#142,387 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics C-enhancement T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Hm, it would be really nice if we could actually pass a more rich description of the position that's disallowing the const, probably via the AnonConstKind, so that we don't have to say "here" but instead something like "in array repeat expressions" or "in const generic args" something.

Right now the errors just say "here", but I think we could pass in enough information in the resolver to know what position a non-trivial const arg actually is, which would greatly help discovery of the issue.

Originally posted by @compiler-errors in https://github.com/rust-lang/rust/pull/142157#pullrequestreview-2908579896

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names the resolver and AnonConstKind but no files or tests; begin by locating resolve_const_param_in_non_trivial_anon_const and the diagnostic that currently says “here.” Done means the diagnostic identifies the relevant position, such as array repeat expressions or const generic arguments, with coverage for the affected cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.