rust/compiler/rustc_middle/src
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
..
dep_graph Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
hir compiler: Directly use rustc_abi in metadata and middle 2024-11-03 13:38:47 -08:00
hooks Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
infer Remove associated type based effects logic 2024-10-24 09:46:36 +00:00
middle Rollup merge of #132544 - dianne:unstable-library-feature-backticks, r=compiler-errors 2024-11-04 18:12:46 +01:00
mir Consolidate type system const evaluation under traits::evaluate_const 2024-11-12 02:54:03 +00:00
query query/plumbing: adjust comment to reality 2024-11-10 15:13:33 +01:00
thir various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
traits Manually register some bounds for a better span 2024-11-08 04:56:08 +00:00
ty Rollup merge of #132927 - BoxyUwU:consolidate_type_system_const_eval, r=compiler-errors 2024-11-12 08:07:18 +01:00
util ty::KContainer -> ty::AssocItemContainer::K 2024-11-04 04:45:52 +00:00
arena.rs compiler: Directly use rustc_abi in metadata and middle 2024-11-03 13:38:47 -08:00
error.rs Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
lib.rs move strict provenance lints to new feature gate, remove old feature gates 2024-10-21 15:22:17 +01:00
lint.rs Remove module passes filtering 2024-10-19 16:20:51 +02:00
macros.rs Improve const traits diagnostics for new desugaring 2024-10-02 19:45:17 +08:00
metadata.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
tests.rs Give an item related to issue 27438 a more meaningful name 2024-04-30 22:27:19 +02:00
thir.rs compiler: Directly use rustc_abi in metadata and middle 2024-11-03 13:38:47 -08:00
values.rs compiler: Directly use rustc_abi in metadata and middle 2024-11-03 13:38:47 -08:00