mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-30 16:05:31 +00:00
Make sure that args are compatible in `resolve_associated_item` Implements a similar check to the one that we have in projection for GATs (#102488, #123240), where we check that the args of an impl item are compatible before returning it. This is done in `resolve_assoc_item`, which is backing `Instance::resolve`, so this is conceptually generalizing the check from GATs to methods/assoc consts. This is important to make sure that the inliner will only visit and substitute MIR bodies that are compatible w/ their trait definitions. This shouldn't happen in codegen, but there are a few ways to get the inliner to be invoked (via calls to `optimized_mir`) before codegen, namely polymorphization and CTFE. Fixes #121957 Fixes #120792 Fixes #120793 Fixes #121063