rust/compiler
bors 068161ea48 Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, r=compiler-errors
use semantic equality for const param type equality assertion

Fixes #107898

See added test for what caused this ICE

---

The current in assertion in `relate.rs` is rather inadequate when keeping in mind future expansions to const generics:
- it will ICE when there are infer vars in a projection in a const param ty
- it will spurriously return false when either ty has infer vars because of using `==` instead of `infcx.at(..).eq`
- i am also unsure if it would be possible with `adt_const_params` to craft a situation where the const param type is not wf causing `normalize_erasing_regions` to `bug!` when we would have emitted a diagnostic.

This impl feels pretty Not Great to me  although i am not sure what a better idea would be.

- We have to have the logic behind a query because neither `relate.rs` or `combine.rs` have access to trait solving machinery (without evaluating nested obligations this assert will become _far_ less useful under lazy norm, which consts are already doing)
- `relate.rs` does not have access to canonicalization machinery which is necessary in order to have types potentially containing infer vars in query arguments.

We could possible add a method to `TypeRelation` to do this assertion rather than a query but to avoid implementing the same logic over and over we'd probably end up with the logic in a free function somewhere in `rustc_trait_selection` _anyway_ so I don't think that would be much better.

We could also just remove this assertion, it should not actually be necessary for it to be present. It has caught some bugs in the past though so if possible I would like to keep it.

r? `@compiler-errors`
2023-02-15 05:17:58 +00:00
..
rustc Add a new rustc_driver dylib to rexport rustc_driver_impl 2023-02-02 07:34:41 +01:00
rustc_abi also do not add noalias on not-Unpin Box 2023-02-06 12:17:41 +01:00
rustc_apfloat
rustc_arena
rustc_ast rustc_ast: Merge impls and reorder methods for attributes and meta items 2023-02-11 23:23:17 +04:00
rustc_ast_lowering remove unused imports 2023-02-06 17:40:18 +03:00
rustc_ast_passes
rustc_ast_pretty Expand const-if-const trait bounds correctly 2023-02-07 21:00:12 +00:00
rustc_attr
rustc_baked_icu_data update ICU4X to 1.1.0 2023-02-04 22:28:59 +01:00
rustc_borrowck s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_builtin_macros Extend BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE. 2023-02-09 11:47:12 +11:00
rustc_codegen_cranelift s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_codegen_gcc s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_codegen_llvm Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_codegen_ssa s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_const_eval Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_data_structures Refactor refcounted structural_impls via functors 2023-02-14 12:14:58 +00:00
rustc_driver Remove unneeded extern crate 2023-02-02 07:47:39 +01:00
rustc_driver_impl Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa 2023-02-13 11:34:57 +01:00
rustc_error_codes Add extended error message for E0523 2023-02-06 06:58:30 -05:00
rustc_error_messages Rollup merge of #107673 - lukas-code:update-icu4x, r=davidtwco 2023-02-14 18:24:41 +01:00
rustc_errors Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa 2023-02-13 11:34:57 +01:00
rustc_expand Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa 2023-02-13 11:34:57 +01:00
rustc_feature change the marker attribute to only_local 2023-02-14 12:18:33 +01:00
rustc_fs_util
rustc_graphviz
rustc_hir rustc_resolve: Remove Resolver::clone_output 2023-02-13 00:10:15 +04:00
rustc_hir_analysis Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_hir_pretty Use Mutability::{is_mut, is_not} 2023-01-30 12:26:26 +00:00
rustc_hir_typeck s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_incremental incremental: migrate diagnostics 2023-01-30 17:11:35 +00:00
rustc_index
rustc_infer Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, r=compiler-errors 2023-02-15 05:17:58 +00:00
rustc_interface rustc_resolve: Remove Resolver::clone_output 2023-02-13 00:10:15 +04:00
rustc_lexer
rustc_lint Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00
rustc_lint_defs Extend BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE. 2023-02-09 11:47:12 +11:00
rustc_llvm Update the minimum external LLVM to 14 2023-02-10 16:06:25 -08:00
rustc_log Rollup merge of #107895 - matthiaskrgr:cl, r=compiler-errors 2023-02-11 17:18:44 +01:00
rustc_macros Use derive attributes for uninteresting traversals 2023-02-14 15:09:40 +00:00
rustc_metadata rustc_resolve: Remove Resolver::clone_output 2023-02-13 00:10:15 +04:00
rustc_middle Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, r=compiler-errors 2023-02-15 05:17:58 +00:00
rustc_mir_build s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_mir_dataflow s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_mir_transform s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_monomorphize Make visiting traits generic over the Interner 2023-02-13 10:24:49 +00:00
rustc_parse Rollup merge of #103478 - SpanishPear:spanishpear/issue_103366_fix, r=TaKO8Ki 2023-02-14 18:02:50 +01:00
rustc_parse_format remove redundant clones 2023-02-10 18:08:25 +01:00
rustc_passes add a #[rustc_coinductive] attribute 2023-02-14 11:53:22 +01:00
rustc_plugin_impl
rustc_privacy Make visiting traits generic over the Interner 2023-02-13 10:24:49 +00:00
rustc_query_impl Simplify tls::enter_context. 2023-02-09 15:25:45 +11:00
rustc_query_system Create a single value cache for the () query key 2023-02-11 23:38:01 +01:00
rustc_resolve rustc_resolve: Remove Resolver::clone_output 2023-02-13 00:10:15 +04:00
rustc_save_analysis Review changes 2023-01-31 07:54:01 +00:00
rustc_serialize
rustc_session Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa 2023-02-13 11:34:57 +01:00
rustc_smir
rustc_span add a #[rustc_coinductive] attribute 2023-02-14 11:53:22 +01:00
rustc_symbol_mangling Pre-intern some commonly used type variables. 2023-02-13 09:25:36 +11:00
rustc_target Update the minimum external LLVM to 14 2023-02-10 16:06:25 -08:00
rustc_trait_selection Auto merge of #107940 - BoxyUwU:const_ty_assertion_use_semantic_equality, r=compiler-errors 2023-02-15 05:17:58 +00:00
rustc_traits Rename folder traits' tcx method to interner 2023-02-13 10:24:51 +00:00
rustc_transmute s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_ty_utils s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_type_ir Auto merge of #108056 - matthiaskrgr:rollup-oa6bxvh, r=matthiaskrgr 2023-02-14 21:07:04 +00:00