rust/compiler
Guillaume Gomez 707e956946
Rollup merge of #145361 - xizheyin:145294, r=compiler-errors
Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved

Fixes rust-lang/rust#145294

I initially tried the desired suggestion in this issue, but since that suggestion occurs in the expected type, it is inappropriate to suggest for expected expressions (see other suggest methods in the same file). I believe that suppressing the incorrect suggestion is the more appropriate choice here.

I opted for a slightly more general approach: when the expected type and actual type are the same ADT (e.g., both are Result in this example), we assume that code tend to compare the internal generic parameters(i.e. `Option<&str>` vs `Option<String>`, instead of `E = _` vs `Result<Option<String>>>`). When `E` is an unresolved infer type in the expected type (`_` in this example), we should not wrapp the actual type.

Two commits show the difference.

r? compiler
2025-08-14 11:39:40 +02:00
..
rustc rename stable_mir to rustc_public, and rustc_smir to rustc_public_bridge 2025-07-14 09:25:54 +00:00
rustc_abi Reuse sign_extend helper 2025-07-29 14:17:48 +00:00
rustc_arena Introduce Arena::try_alloc_from_iter. 2025-04-19 01:13:18 +00:00
rustc_ast Extract ast TraitImplHeader 2025-08-11 17:05:36 -05:00
rustc_ast_ir Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_ast_lowering Rollup merge of #145153 - joshtriplett:macro-kinds-plural, r=petrochenkov 2025-08-13 18:43:01 +02:00
rustc_ast_passes Extract ast TraitImplHeader 2025-08-11 17:05:36 -05:00
rustc_ast_pretty Extract ast TraitImplHeader 2025-08-11 17:05:36 -05:00
rustc_attr_parsing Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
rustc_baked_icu_data
rustc_borrowck Cleanup assoc parent utils 2025-08-13 09:33:09 -05:00
rustc_builtin_macros Rollup merge of #145238 - estebank:attr-overhaul, r=jdonszelmann 2025-08-12 20:37:53 +10:00
rustc_codegen_cranelift Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
rustc_codegen_gcc Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
rustc_codegen_llvm Rollup merge of #145323 - scrabsha:push-pqwvmznzzmpr, r=jdonszelmann 2025-08-14 11:39:39 +02:00
rustc_codegen_ssa Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
rustc_const_eval Rollup merge of #145266 - camsteffen:reduce-queries, r=petrochenkov 2025-08-14 11:39:38 +02:00
rustc_data_structures Allow pretty printing paths with -Zself-profile-events=args 2025-07-25 22:24:21 +02:00
rustc_driver Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_driver_impl Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_error_codes resolve: Split extern prelude into two scopes 2025-08-13 17:45:40 +03:00
rustc_error_messages Remove unused feature gates 2025-06-28 23:36:46 +00:00
rustc_errors Rollup merge of #144558 - estebank:issue-68119, r=lcnr 2025-08-11 12:21:08 +10:00
rustc_expand Rollup merge of #145153 - joshtriplett:macro-kinds-plural, r=petrochenkov 2025-08-13 18:43:01 +02:00
rustc_feature Rework NameValueStr 2025-08-11 17:02:43 +00:00
rustc_fluent_macro Remove all unused feature gates from the compiler 2025-06-08 14:50:42 +00:00
rustc_fs_util Retry if creating temp fails with access denied 2025-04-25 11:28:36 +00:00
rustc_graphviz
rustc_hashes
rustc_hir Rollup merge of #145323 - scrabsha:push-pqwvmznzzmpr, r=jdonszelmann 2025-08-14 11:39:39 +02:00
rustc_hir_analysis Cleanup assoc parent utils 2025-08-13 09:33:09 -05:00
rustc_hir_pretty Propagate TraitImplHeader to hir 2025-08-11 17:05:42 -05:00
rustc_hir_typeck Rollup merge of #145361 - xizheyin:145294, r=compiler-errors 2025-08-14 11:39:40 +02:00
rustc_incremental Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obk 2025-05-07 12:39:54 +00:00
rustc_index Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_index_macros Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_infer remove from_forall 2025-08-11 09:18:46 +02:00
rustc_interface Fix parallel rustc not being reproducible due to unstable sorting of items. 2025-08-13 08:59:32 +08:00
rustc_lexer test(lexer): Add frontmatter unit test 2025-07-10 10:25:29 -05:00
rustc_lint Rollup merge of #145266 - camsteffen:reduce-queries, r=petrochenkov 2025-08-14 11:39:38 +02:00
rustc_lint_defs Rollup merge of #145274 - compiler-errors:unused-must-use, r=fmease 2025-08-13 07:03:49 +02:00
rustc_llvm Auto merge of #145093 - nikic:dead-on-return, r=nnethercote 2025-08-13 04:18:43 +00:00
rustc_log Add documentation for init_logger_with_additional_layer 2025-06-12 12:11:15 +02:00
rustc_macros remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
rustc_metadata Switch to a bitflags MacroKinds to support macros with more than one kind 2025-08-12 09:24:45 -07:00
rustc_middle Rollup merge of #145323 - scrabsha:push-pqwvmznzzmpr, r=jdonszelmann 2025-08-14 11:39:39 +02:00
rustc_mir_build Auto merge of #143376 - dianne:guard-scope, r=matthewjasper 2025-08-09 03:19:26 +00:00
rustc_mir_dataflow Escape diff strings in graphviz 2025-08-08 00:20:55 -05:00
rustc_mir_transform Cleanup assoc parent utils 2025-08-13 09:33:09 -05:00
rustc_monomorphize Rollup merge of #145323 - scrabsha:push-pqwvmznzzmpr, r=jdonszelmann 2025-08-14 11:39:39 +02:00
rustc_next_trait_solver significantly improve provisional cache rebasing 2025-08-11 15:51:03 +02:00
rustc_parse Rollup merge of #145238 - estebank:attr-overhaul, r=jdonszelmann 2025-08-12 20:37:53 +10:00
rustc_parse_format update to literal-escaper-0.0.5 2025-07-08 10:16:44 +00:00
rustc_passes Rollup merge of #145323 - scrabsha:push-pqwvmznzzmpr, r=jdonszelmann 2025-08-14 11:39:39 +02:00
rustc_pattern_analysis Rollup merge of #144545 - ChayimFriedman2:bool-witness-order, r=Nadrieril 2025-08-08 14:22:44 -05:00
rustc_privacy Propagate TraitImplHeader to hir 2025-08-11 17:05:42 -05:00
rustc_proc_macro Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_public fix missing parenthesis in pretty discriminant 2025-08-09 01:35:50 +08:00
rustc_public_bridge Remove useless lifetime parameter. 2025-07-23 23:54:37 +00:00
rustc_query_impl Remove unused allow attrs 2025-07-07 12:58:16 +00:00
rustc_query_system remove rustc_attr_data_structures 2025-07-31 14:19:27 +02:00
rustc_resolve Auto merge of #144793 - petrochenkov:extprel3, r=davidtwco 2025-08-13 22:52:17 +00:00
rustc_sanitizers rename TraitRef::from_method to from_assoc 2025-08-09 14:22:01 +08:00
rustc_serialize use div_ceil instead of manual logic 2025-07-05 10:55:42 +02:00
rustc_session Fix parallel rustc not being reproducible due to unstable sorting of items. 2025-08-13 08:59:32 +08:00
rustc_span Port the #[linkage] attribute to the new attribute system 2025-08-13 21:01:37 +02:00
rustc_symbol_mangling Rollup merge of #144949 - nnethercote:more-Printer-cleanups, r=davidtwco 2025-08-13 18:42:59 +02:00
rustc_target Rollup merge of #145241 - tomtor:avr-layout, r=nikic 2025-08-13 18:43:02 +02:00
rustc_thread_pool Drop rust-version from rustc_thread_pool 2025-08-04 15:03:49 -07:00
rustc_trait_selection Rollup merge of #145266 - camsteffen:reduce-queries, r=petrochenkov 2025-08-14 11:39:38 +02:00
rustc_traits Auto merge of #144446 - nnethercote:opt-region-constraints, r=lcnr 2025-08-01 04:06:21 +00:00
rustc_transmute Tidy up Cargo.toml files. 2025-07-31 19:58:04 +10:00
rustc_ty_utils Propagate TraitImplHeader to hir 2025-08-11 17:05:42 -05:00
rustc_type_ir simplify stack handling, be completely lazy 2025-08-12 10:08:26 +02:00
rustc_type_ir_macros Split TypeFolder and FallibleTypeFolder 2025-04-15 18:30:35 +00:00