rust/compiler/rustc_middle
Matthias Krüger ea61714d52
Rollup merge of #132927 - BoxyUwU:consolidate_type_system_const_eval, r=compiler-errors
Consolidate type system const evaluation under `traits::evaluate_const`

Part of #130704

Fixes #128232
Fixes #118545

Removes `ty::Const::{normalize_internal, eval_valtree}` and `InferCtxt::(try_)const_eval_resolve`, consolidating the associated logic into `evaluate_const` in `rustc_trait_selection`. This results in an API for `ty::Const` that is free of any normalization/evaluation functions that would be incorrect to use under `min_generic_const_args`/`associated_const_equality`/`generic_const_exprs` or, more generally, that would be incorrect to use in the presence of generic type system constants.

Moving this logic to `rustc_trait_selection` and out of `rustc_middle` is also a pre-requisite for ensuring that we do not evaluate constants whose where clauses do not hold.

From this point it should be relatively simple (hah) to implement more complex normalization of type system constants such as: checking wf'ness before invoking CTFE machinery, or being able to normalize const aliases that still refer to generic parameters.

r? `@compiler-errors`
2024-11-12 08:07:18 +01:00
..
src Rollup merge of #132927 - BoxyUwU:consolidate_type_system_const_eval, r=compiler-errors 2024-11-12 08:07:18 +01:00
Cargo.toml Do not run lints that cannot emit 2024-10-19 16:19:44 +02:00
messages.ftl Tweak E0320 overflow error wording 2024-11-05 21:54:45 +00:00
README.md

For more information about how rustc works, see the rustc dev guide.