rust/compiler/rustc_ty_utils/src
Matthias Krüger dd0fa6f871
Rollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnr
make `compare_const_impl` a query and use it in `instance.rs`

Fixes #88365

the bug in #88365 was caused by some `instance.rs` code using the `PartialEq` impl on `Ty` to check that the type of the associated const in an impl is the same as the type of the associated const in the trait definition. This was wrong for two reasons:
- the check typeck does is that the impl type is a subtype of the trait definition's type (see `mismatched_impl_ty_2.rs` which [was ICEing](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f6d60ebe6745011f0d52ab2bc712025d) before this PR on stable)
- it assumes that if two types are equal then the `PartialEq` impl will reflect that which isnt true for higher ranked types or type level constants when `feature(generic_const_exprs)` is enabled (see `mismatched_impl_ty_3.rs` for higher ranked types which was [ICEing on stable](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d7af131a655ed515b035624626c62c71))

r? `@lcnr`
2022-10-06 16:29:43 +02:00
..
abi.rs Move utils from rustc_middle to rustc_ty_utils 2022-10-03 09:12:03 -05:00
assoc.rs separate definitions and HIR owners 2022-09-24 23:21:19 +09:00
common_traits.rs Don't consider !Unpin references as noalias 2021-03-21 20:10:53 +01:00
consts.rs It's not about types or consts, but the lack of regions 2022-10-04 14:10:44 +00:00
errors.rs UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic 2022-09-21 11:39:53 -04:00
implied_bounds.rs RPITIT placeholder items 2022-09-09 01:31:44 +00:00
instance.rs Rollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnr 2022-10-06 16:29:43 +02:00
layout_sanity_check.rs Move utils from rustc_middle to rustc_ty_utils 2022-10-03 09:12:03 -05:00
layout.rs It's not about types or consts, but the lack of regions 2022-10-04 14:10:44 +00:00
lib.rs Rollup merge of #98496 - BoxyUwU:instancers_bad_equality, r=lcnr 2022-10-06 16:29:43 +02:00
needs_drop.rs remove the Subst trait, always use EarlyBinder 2022-09-19 11:37:27 +02:00
representability.rs Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
ty.rs remove the Subst trait, always use EarlyBinder 2022-09-19 11:37:27 +02:00