granite-rust/compiler
Matthias Krüger 3cb1a4676a
Rollup merge of #111279 - compiler-errors:core-item-resolve, r=cjgillot
More robust debug assertions for `Instance::resolve` on built-in traits with non-standard trait items

In #111264, a user added a new item to the `Future` trait, but the code in [`resolve_associated_item`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ty_utils/instance/fn.resolve_associated_item.html) implicitly assumes that the `Future` trait is defined with only one method (`Future::poll`) and treats the generator body as the implementation of that method.

This PR adds some debug assertions to make sure that that new methods defined on `Future`/`Generator`/etc. don't accidentally resolve to the wrong item when they are added, and adds a helpful comment guiding a compiler dev (or curious `#![no_core]` user) to what must be done to support adding new associated items to these built-in implementations.

I am open to discuss whether a test should be added, but I chose against it because I opted to make these `bug!()`s instead of, e.g., diagnostics or fatal errors. Arguably it doesn't need a test because it's not a bug that can be triggered by an end user, and internal-facing misuses of core kind of touch on rust-lang/compiler-team#620 -- however, I think the assertions I added in this PR are still a very useful way to make sure this bug doesn't waste debugging resources down the line.

Fixes #111264
2023-05-06 13:30:06 +02:00
..
rustc fix link 2023-03-11 10:53:47 -06:00
rustc_abi Reorder to keep duplicate checks in sync. 2023-05-05 16:30:32 -07:00
rustc_apfloat compiler: remove unnecessary imports and qualified paths 2022-12-10 18:45:34 +01:00
rustc_arena Deny the unsafe_op_in_unsafe_fn lint in 2023-04-28 21:00:54 -07:00
rustc_ast Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors 2023-05-05 18:40:33 +05:30
rustc_ast_lowering Rollup merge of #110791 - compiler-errors:negative-bounds, r=oli-obk 2023-05-04 00:17:23 +05:30
rustc_ast_passes Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors 2023-05-05 18:40:33 +05:30
rustc_ast_pretty Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors 2023-05-05 18:40:33 +05:30
rustc_attr Improve check-cfg diagnostics (part 2) 2023-05-05 13:06:48 +02:00
rustc_baked_icu_data Regen baked data 2023-05-02 10:45:16 -07:00
rustc_borrowck Rollup merge of #111132 - lcnr:nll-generalize, r=b-naber 2023-05-05 12:46:27 +09:00
rustc_builtin_macros Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors 2023-05-05 18:40:33 +05:30
rustc_codegen_cranelift Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
rustc_codegen_gcc Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3 2023-05-03 16:42:48 -07:00
rustc_codegen_llvm Rollup merge of #111167 - cuviper:type-decl-disubprogram, r=michaelwoerister 2023-05-06 13:30:05 +02:00
rustc_codegen_ssa Rollup merge of #110985 - Amanieu:normalize_asm_spans, r=b-naber 2023-05-06 13:30:04 +02:00
rustc_const_eval Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr 2023-05-04 05:54:09 +00:00
rustc_data_structures Use the full Fingerprint when stringifying Svh 2023-04-30 14:28:30 -04:00
rustc_driver Remove unneeded extern crate 2023-02-02 07:47:39 +01:00
rustc_driver_impl Rollup merge of #110989 - jyn514:bug-report-url, r=WaffleLapkin 2023-05-06 13:30:04 +02:00
rustc_error_codes Spelling - compiler 2023-04-17 16:09:18 -04:00
rustc_error_messages Rollup merge of #111104 - Manishearth:icuup, r=compiler-errors 2023-05-03 16:42:50 -07:00
rustc_errors Mark ErrorGuaranteed constructor as deprecated so people don't use it 2023-05-05 17:58:46 +00:00
rustc_expand Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors 2023-05-05 18:40:33 +05:30
rustc_feature Rollup merge of #109677 - dpaoliello:rawdylib, r=michaelwoerister,wesleywiser 2023-05-06 09:09:30 +09:00
rustc_fluent_macro Remove unused synstructure dep 2023-04-22 22:03:33 +01:00
rustc_fs_util Add try_canonicalize to rustc_fs_util and use it over fs::canonicalize 2023-03-16 21:50:23 +01:00
rustc_graphviz Fix uninlined_format_args for some compiler crates 2023-01-05 19:01:12 +01:00
rustc_hir Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors 2023-05-05 18:40:33 +05:30
rustc_hir_analysis Rollup merge of #110577 - compiler-errors:drop-impl-fulfill, r=lcnr 2023-05-06 13:30:03 +02:00
rustc_hir_pretty Rip it out 2023-05-01 16:15:13 +08:00
rustc_hir_typeck Rollup merge of #111261 - compiler-errors:error-guaranteed-should-be-scarier-to-construct, r=BoxyUwU 2023-05-06 09:09:34 +09:00
rustc_incremental Rollup merge of #111024 - saethlin:stringify-full-svh, r=oli-obk 2023-05-04 08:09:04 +02:00
rustc_index Decorative changes to IndexVec 2023-04-24 13:53:37 +00:00
rustc_infer Rollup merge of #110577 - compiler-errors:drop-impl-fulfill, r=lcnr 2023-05-06 13:30:03 +02:00
rustc_interface Rollup merge of #109677 - dpaoliello:rawdylib, r=michaelwoerister,wesleywiser 2023-05-06 09:09:30 +09:00
rustc_lexer address comments 2023-05-02 10:32:07 +00:00
rustc_lint Improve check-cfg diagnostics (part 2) 2023-05-05 13:06:48 +02:00
rustc_lint_defs Improve check-cfg diagnostics (part 2) 2023-05-05 13:06:48 +02:00
rustc_llvm Rollup merge of #111167 - cuviper:type-decl-disubprogram, r=michaelwoerister 2023-05-06 13:30:05 +02:00
rustc_log Stabilize IsTerminal 2023-04-10 17:24:23 +09:00
rustc_macros Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
rustc_metadata Rollup merge of #109677 - dpaoliello:rawdylib, r=michaelwoerister,wesleywiser 2023-05-06 09:09:30 +09:00
rustc_middle Rollup merge of #111279 - compiler-errors:core-item-resolve, r=cjgillot 2023-05-06 13:30:06 +02:00
rustc_mir_build Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors 2023-05-05 18:40:33 +05:30
rustc_mir_dataflow Make PlaceMention a non-mutating use. 2023-04-29 16:14:33 +00:00
rustc_mir_transform Reject borrows of projections in ConstProp. 2023-05-04 21:51:44 +00:00
rustc_monomorphize Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr 2023-05-04 05:54:09 +00:00
rustc_parse Rollup merge of #111230 - zacklukem:eq-less-to-less-eq, r=compiler-errors 2023-05-06 13:30:05 +02:00
rustc_parse_format Fix typos in compiler 2023-04-10 22:02:52 +02:00
rustc_passes Auto merge of #111014 - klensy:no-rc, r=WaffleLapkin 2023-05-04 20:49:23 +00:00
rustc_plugin_impl Add rustc_fluent_macro to decouple fluent from rustc_macros 2023-04-18 18:56:22 +00:00
rustc_privacy Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnr 2023-05-04 05:54:09 +00:00
rustc_query_impl Remove QueryEngine trait 2023-04-26 07:46:13 +02:00
rustc_query_system Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
rustc_resolve Rollup merge of #110982 - cjgillot:elided-self-const, r=petrochenkov 2023-05-04 19:18:20 +02:00
rustc_serialize Factor out more repeated code in {write,read}_leb128!. 2023-05-04 13:52:14 +10:00
rustc_session Rollup merge of #109677 - dpaoliello:rawdylib, r=michaelwoerister,wesleywiser 2023-05-06 09:09:30 +09:00
rustc_smir Add GeneratorDrop terminator to SMIR 2023-05-05 10:34:55 -03:00
rustc_span Rollup merge of #111279 - compiler-errors:core-item-resolve, r=cjgillot 2023-05-06 13:30:06 +02:00
rustc_symbol_mangling Rollup merge of #105452 - rcvalle:rust-cfi-3, r=bjorn3 2023-05-03 16:42:48 -07:00
rustc_target Change ABI order in is_stable 2023-04-29 13:01:46 +01:00
rustc_trait_selection Rollup merge of #110577 - compiler-errors:drop-impl-fulfill, r=lcnr 2023-05-06 13:30:03 +02:00
rustc_traits Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
rustc_transmute Remove unused TypeFoldable/TypeVisitable impls. 2023-04-26 15:19:50 +10:00
rustc_ty_utils Rollup merge of #111279 - compiler-errors:core-item-resolve, r=cjgillot 2023-05-06 13:30:06 +02:00
rustc_type_ir Rollup merge of #110838 - nnethercote:more-Folder-Visitable-cleanups, r=lcnr 2023-04-27 21:34:14 +02:00