rust/compiler
Guillaume Gomez 3648dd552a
Rollup merge of #99449 - compiler-errors:assoc-const-missing-item, r=lcnr
Do not resolve associated const when there is no provided value

Fixes #98629, since now we just delay a bug when we're not able to evaluate a const item due to the value not actually being provided by anything. This means compilation proceeds forward to where the "missing item in impl" error is emitted.

----

The root issue here is that when we're looking for the defining `LeafDef` in `resolve_associated_item`, we end up getting the trait's AssocItem instead of the impl's AssocItem (which does not exist). This resolution "succeeds" even if the trait's item has no default value, and then since this item has no value to evaluate, it turns into a const eval error.

This root issue becomes problematic (as in #98629) when this const eval error happens in wfcheck (for example, due to normalizing the param-env of something that references this const). Since this happens sooner than the check that an impl actually provides all of the items that a trait requires (which happens during later typecheck), we end up aborting compilation early with only this un-informative message.

I'm not exactly sure _why_ this bug arises due to #96591 -- perhaps valtrees are evaluated more eagerly than in the old system?

r? ``@oli-obk`` or ``@lcnr`` since y'all are familiar with const eval and reviewed #96591, though feel free to reassign.

This is a regression from stable to beta, so I would be open to considering this for beta backport. It seems correct to me, especially given the improvements in the other UI tests this PR touches, but may have some side-effects that I'm unaware of...?
2022-07-23 23:34:30 +02:00
..
rustc Don't rerun the build script for the compiler each time on linux 2022-07-10 23:57:25 -05:00
rustc_apfloat Update smallvec to 1.8.1. 2022-06-27 08:48:55 +10:00
rustc_arena Rollup merge of #97711 - Nilstrieb:rustc-arena-ub, r=wesleywiser 2022-07-07 18:06:49 +05:30
rustc_ast Stabilize let_chains 2022-07-16 20:17:58 -03:00
rustc_ast_lowering Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
rustc_ast_passes Auto merge of #98180 - notriddle:notriddle/rustdoc-fn, r=petrochenkov,GuillaumeGomez 2022-07-19 19:36:57 +00:00
rustc_ast_pretty Parse closure binders 2022-07-12 16:25:16 +04:00
rustc_attr middle: add implies_by to #[unstable] 2022-07-20 14:53:01 +01:00
rustc_borrowck Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa 2022-07-20 22:19:30 +00:00
rustc_builtin_macros Rollup merge of #99508 - TaKO8Ki:avoid-symbol-to-string-conversion-in-BuiltinLintDiagnostics, r=compiler-errors 2022-07-20 18:58:20 +02:00
rustc_codegen_cranelift various nits from review 2022-07-20 17:12:08 -04:00
rustc_codegen_gcc Auto merge of #99420 - RalfJung:vtable, r=oli-obk 2022-07-22 01:33:49 +00:00
rustc_codegen_llvm Auto merge of #99420 - RalfJung:vtable, r=oli-obk 2022-07-22 01:33:49 +00:00
rustc_codegen_ssa Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiser 2022-07-22 11:53:40 +05:30
rustc_const_eval interpret: fix vtable check debug assertion 2022-07-22 10:37:03 -04:00
rustc_data_structures Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
rustc_driver Rename debugging_opts to unstable_opts 2022-07-13 17:47:06 -05:00
rustc_error_codes region_outlives_predicate no snapshot 2022-07-21 13:09:01 +02:00
rustc_error_messages clippy::perf fixes 2022-07-20 11:48:11 +02:00
rustc_errors Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa 2022-07-20 22:19:30 +00:00
rustc_expand Auto merge of #99320 - NiklasJonsson:84447/rustc_expand, r=compiler-errors 2022-07-23 07:59:54 +00:00
rustc_feature Stabilize let_chains 2022-07-16 20:17:58 -03:00
rustc_fs_util
rustc_graphviz Fully stabilize NLL 2022-06-03 17:16:41 -04:00
rustc_hir Address more nits 2022-07-21 16:43:10 +00:00
rustc_hir_pretty use rustc_hir_pretty::qpath_to_string to avoid span_to_snippet when rendering path 2022-07-17 04:58:38 +00:00
rustc_incremental Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
rustc_index Edit rustc_index::vec::IndexVec::pick3_mut docs 2022-07-21 08:52:18 -05:00
rustc_infer Rollup merge of #99580 - fmease:fix-issue-99565, r=estebank 2022-07-23 12:08:11 +02:00
rustc_interface Auto merge of #98162 - nextsilicon:support_lto_embed_bitcode, r=davidtwco 2022-07-21 10:13:59 +00:00
rustc_lexer fix typo in comment 2022-06-28 19:59:09 +05:30
rustc_lint Rollup merge of #99433 - cjgillot:erase-foreign-sig, r=compiler-errors 2022-07-20 11:29:39 +05:30
rustc_lint_defs avoid a Symbol to String conversion 2022-07-20 18:19:25 +09:00
rustc_llvm Auto merge of #98162 - nextsilicon:support_lto_embed_bitcode, r=davidtwco 2022-07-21 10:13:59 +00:00
rustc_log clippy::complexity fixes 2022-05-26 13:14:24 +02:00
rustc_macros clippy::perf fixes 2022-07-20 11:48:11 +02:00
rustc_metadata Fix typo/grammar in locator.rs doc comment 2022-07-23 07:31:20 +02:00
rustc_middle Rollup merge of #99580 - fmease:fix-issue-99565, r=estebank 2022-07-23 12:08:11 +02:00
rustc_mir_build Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank" 2022-07-20 07:55:58 +00:00
rustc_mir_dataflow Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa 2022-07-20 22:19:30 +00:00
rustc_mir_transform Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiser 2022-07-22 11:53:40 +05:30
rustc_monomorphize Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiser 2022-07-22 11:53:40 +05:30
rustc_parse Stabilize let_chains 2022-07-16 20:17:58 -03:00
rustc_parse_format Add diagnostic width span when '0$' is used as width. 2022-07-20 13:39:56 +01:00
rustc_passes Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisa 2022-07-20 22:19:30 +00:00
rustc_plugin_impl remove currently unused deps 2022-06-13 22:20:51 +03:00
rustc_privacy clippy::perf fixes 2022-07-20 11:48:11 +02:00
rustc_query_impl consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable) 2022-07-20 17:12:07 -04:00
rustc_query_system consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable) 2022-07-20 17:12:07 -04:00
rustc_resolve Use span_bug in case of unexpected rib kind 2022-07-23 13:26:45 +09:00
rustc_save_analysis Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot 2022-07-14 14:14:21 +05:30
rustc_serialize use BufReader for counting zero bytes 2022-07-02 22:51:42 +09:00
rustc_session Rollup merge of #99528 - matthiaskrgr:2022_07_perf, r=estebank 2022-07-21 18:42:07 +02:00
rustc_smir Rustfmt 2022-06-02 10:29:00 +00:00
rustc_span Auto merge of #99420 - RalfJung:vtable, r=oli-obk 2022-07-22 01:33:49 +00:00
rustc_symbol_mangling consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable) 2022-07-20 17:12:07 -04:00
rustc_target do not mark interior mutable shared refs as dereferenceable 2022-07-22 14:25:41 -04:00
rustc_trait_selection Rollup merge of #99449 - compiler-errors:assoc-const-missing-item, r=lcnr 2022-07-23 23:34:30 +02:00
rustc_traits Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
rustc_ty_utils Do not resolve associated const when there is no provided value 2022-07-22 18:58:07 +00:00
rustc_type_ir Remove unused StableMap and StableSet types from rustc_data_structures 2022-07-20 13:11:39 +02:00
rustc_typeck Rollup merge of #99580 - fmease:fix-issue-99565, r=estebank 2022-07-23 12:08:11 +02:00