rust/compiler
bors 7b552967b8 Auto merge of #105961 - fmease:iat-type-directed-probing, r=jackh726
Type-directed probing for inherent associated types

When probing for inherent associated types (IATs), equate the Self-type found in the projection with the Self-type of the relevant inherent impl blocks and check if all predicates are satisfied.
Previously, we didn't look at the Self-type or at the bounds and just picked the first inherent impl block containing an associated type with the name we were searching for which is obviously incorrect.

Regarding the implementation, I basically copied what we do during method probing (`assemble_inherent_impl_probe`, `consider_probe`). Unfortunately, I had to duplicate a lot of the diagnostic code found in `rustc_hir_typeck::method::suggest` which we don't have access to in `rustc_hir_analysis`. Not sure if there is a simple way to unify the error handling. Note that in the future, `rustc_hir_analysis::astconv` might not actually be the place where we resolve inherent associated types (see https://github.com/rust-lang/rust/pull/103621#issuecomment-1304309565) but `rustc_hir_typeck` (?) in which case the duplication may naturally just disappear. While inherent associated *constants* are currently resolved during "method" probing, I did not find a straightforward way to incorporate IAT lookup into it as types and values (functions & constants) are two separate entities for which distinct code paths are taken.

Fixes #104251 (incl. https://github.com/rust-lang/rust/issues/104251#issuecomment-1338501171).
Fixes #105305.
Fixes #107468.

`@rustbot` label T-types F-inherent_associated_types
r? types
2023-02-20 00:37:20 +00:00
..
rustc Add a new rustc_driver dylib to rexport rustc_driver_impl 2023-02-02 07:34:41 +01:00
rustc_abi Rollup merge of #107592 - workingjubilee:use-16-bit-enum-on-16-bit-targets, r=WaffleLapkin 2023-02-17 12:39:05 +01:00
rustc_apfloat compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_arena compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
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 Better label for illegal impl trait types 2023-02-14 23:12:27 +00:00
rustc_ast_passes Rollup merge of #107489 - compiler-errors:non_lifetime_binders, r=cjgillot 2023-02-17 00:19:34 +01:00
rustc_ast_pretty Expand const-if-const trait bounds correctly 2023-02-07 21:00:12 +00:00
rustc_attr Add feature gate for non_lifetime_binders 2023-02-16 03:39:58 +00:00
rustc_baked_icu_data update ICU4X to 1.1.0 2023-02-04 22:28:59 +01:00
rustc_borrowck Replace mk_foo calls with infer_foo where possible. 2023-02-17 22:24:31 +11:00
rustc_builtin_macros Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726 2023-02-19 21:18:07 +00:00
rustc_codegen_cranelift Stop implementing _with_overflow intrinsics in codegen backends. 2023-02-18 22:06:29 +00:00
rustc_codegen_gcc s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_codegen_llvm Make dyn* have the same scalar pair ABI as corresponding fat pointer 2023-02-18 19:47:34 +00:00
rustc_codegen_ssa Auto merge of #107921 - cjgillot:codegen-overflow-check, r=tmiasko 2023-02-19 18:17:26 +00:00
rustc_const_eval Stop implementing _with_overflow intrinsics in codegen backends. 2023-02-18 22:06:29 +00:00
rustc_data_structures if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r) 2023-02-16 15:26:00 +00:00
rustc_driver Remove unneeded extern crate 2023-02-02 07:47:39 +01:00
rustc_driver_impl Remove save-analysis. 2023-02-16 15:14:45 +11:00
rustc_error_codes Add extended error message for E0523 2023-02-06 06:58:30 -05:00
rustc_error_messages Remove save-analysis. 2023-02-16 15:14:45 +11:00
rustc_errors Rollup merge of #108031 - jieyouxu:issue-108019, r=estebank 2023-02-18 13:26:46 +01:00
rustc_expand Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_feature Adjust tracking issue for non_lifetime_binders 2023-02-18 02:42:43 +00:00
rustc_fs_util Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
rustc_graphviz Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_hir if $c:expr { Some($r:expr) } else { None } =>> $c.then(|| $r) 2023-02-16 15:26:00 +00:00
rustc_hir_analysis Auto merge of #105961 - fmease:iat-type-directed-probing, r=jackh726 2023-02-20 00:37:20 +00:00
rustc_hir_pretty Use Mutability::{is_mut, is_not} 2023-01-30 12:26:26 +00:00
rustc_hir_typeck Deduplicate fresh_item_substs 2023-02-19 18:36:35 +01:00
rustc_incremental incremental: migrate diagnostics 2023-01-30 17:11:35 +00:00
rustc_index Fix IndexVec::drain_enumerated 2023-01-19 15:25:33 +00:00
rustc_infer Collapse placeholders to root universe in canonicalizer if not preserving universes 2023-02-18 19:49:40 +00:00
rustc_interface Move provider fields back to rustc_query_impl 2023-02-16 14:55:05 +01:00
rustc_lexer Update lexer lifetime test 2023-02-14 23:25:01 +08:00
rustc_lint Rollup merge of #108162 - clubby789:issue-108155, r=Nilstrieb 2023-02-18 13:26:47 +01:00
rustc_lint_defs Extend BYTE_SLICE_IN_PACKED_STRUCT_WITH_DERIVE. 2023-02-09 11:47:12 +11:00
rustc_llvm Add kernel-address sanitizer support for freestanding targets 2023-02-14 20:54:25 -05: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 Replace mk_foo calls with infer_foo where possible. 2023-02-17 22:24:31 +11:00
rustc_middle Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726 2023-02-19 21:18:07 +00:00
rustc_mir_build Replace more mk_foo calls with infer_foo. 2023-02-17 22:24:34 +11:00
rustc_mir_dataflow Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_mir_transform Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726 2023-02-19 21:18:07 +00:00
rustc_monomorphize remove bound_type_of query; make type_of return EarlyBinder; change type_of in metadata 2023-02-16 17:05:56 -07:00
rustc_parse Rollup merge of #108031 - jieyouxu:issue-108019, r=estebank 2023-02-18 13:26:46 +01:00
rustc_parse_format Replace some thens with some then_somes 2023-02-16 15:26:03 +00:00
rustc_passes Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726 2023-02-19 21:18:07 +00:00
rustc_plugin_impl
rustc_privacy add predicate evaluation logic 2023-02-17 09:32:39 +00:00
rustc_query_impl Auto merge of #108058 - Zoxc:query-ctxtx-byval, r=cjgillot 2023-02-17 08:23:53 +00:00
rustc_query_system Auto merge of #107542 - compiler-errors:param-envs-with-inference-vars-are-cursed, r=jackh726 2023-02-18 23:43:42 +00:00
rustc_resolve Rollup merge of #108129 - GuillaumeGomez:correctly-handle-links-starting-with-whitespace, r=petrochenkov 2023-02-19 14:47:55 +01:00
rustc_serialize compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_session Auto merge of #99679 - repnop:kernel-address-sanitizer, r=cuviper 2023-02-18 03:05:11 +00:00
rustc_smir
rustc_span Rollup merge of #107489 - compiler-errors:non_lifetime_binders, r=cjgillot 2023-02-17 00:19:34 +01:00
rustc_symbol_mangling Use IntoIterator for mk_fn_sig. 2023-02-17 22:24:34 +11:00
rustc_target Auto merge of #106476 - keith:ks/add-sanitizer-support-for-modern-ios-platforms, r=badboy 2023-02-18 05:58:41 +00:00
rustc_trait_selection Auto merge of #108128 - clubby789:builtin-derived-attr, r=jackh726 2023-02-19 21:18:07 +00:00
rustc_traits Add Clause::ConstArgHasType variant 2023-02-17 09:30:33 +00:00
rustc_transmute s/eval_usize/eval_target_usize/ for clarity 2023-02-14 08:51:19 +00:00
rustc_ty_utils Rollup merge of #108203 - compiler-errors:rpitit-fix-defaults-2, r=jackh726 2023-02-19 14:47:56 +01:00
rustc_type_ir make first component of dyn* use pointer layout+type, and adjust DynStar comment 2023-02-18 19:24:55 +00:00