rust/compiler/rustc_hir_analysis
Noah Lev 9a30ec8149 Implement MVP for opaque generic const arguments
This is meant to be the interim successor to generic const expressions.
Essentially, const item RHS's will be allowed to do arbitrary const
operations using generics. The limitation is that these const items will
be treated opaquely, like ADTs in nominal typing, such that uses of them
will only be equal if the same const item is referenced. In other words,
two const items with the exact same RHS will not be considered equal.

I also added some logic to check feature gates that depend on others
being enabled (like oGCA depending on mGCA).

= Coherence =

During coherence, OGCA consts should be normalized ambiguously because
they are opaque but eventually resolved to a real value. We don't want
two OGCAs that have the same value to be treated as distinct for
coherence purposes. (Just like opaque types.)

This actually doesn't work yet because there are pre-existing
fundamental issues with equate relations involving consts that need to
be normalized. The problem is that we normalize only one layer of the
const item and don't actually process the resulting anon const. Normally
the created inference variable should be handled, which in this case
would cause us to hit the anon const, but that's not happening.
Specifically, `visit_const` on `Generalizer` should be updated to be
similar to `visit_ty`.
2026-02-08 18:15:11 +00:00
..
src Implement MVP for opaque generic const arguments 2026-02-08 18:15:11 +00:00
Cargo.toml Convert to inline diagnostics in rustc_hir_analysis 2026-02-06 10:05:35 +01:00
README.md Update links in compiler/rustc_hir_analysis/README.md for type checking 2025-12-26 16:34:49 +09:00

For high-level intro to how type checking works in rustc, see the hir typeck chapter of the rustc dev guide.