rust/compiler
bors 014026d1a7 Auto merge of #87153 - michaelwoerister:debuginfo-names-dyn-trait-projection-bounds, r=wesleywiser
[debuginfo] Emit associated type bindings in trait object type names.

This PR updates debuginfo type name generation for trait objects to include associated type bindings and auto trait bounds -- so that, for example, the debuginfo type name of `&dyn Iterator<Item=Foo>` and `&dyn Iterator<Item=Bar>` don't both map to just `&dyn Iterator` anymore.

The following table shows examples of debuginfo type names before and after the PR:
| type | before |  after |
|------|---------|-------|
| `&dyn Iterator<Item=u32>>` | `&dyn Iterator` | `&dyn Iterator<Item=u32>` |
| `&(dyn Iterator<Item=u32>> + Sync)` | `&dyn Iterator` | `&(dyn Iterator<Item=u32> + Sync)` |
| `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `&dyn SomeTrait<bool, i8>` | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)`  |

For targets that need C++-like type names, we use `assoc$<Item,u32>` instead of `Item=u32`:
| type | before |  after |
|------|---------|-------|
| `&dyn Iterator<Item=u32>>` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> > > >` |
| `&(dyn Iterator<Item=u32>> + Sync)` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> >,Sync> >` |
| `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `ref$<dyn$<SomeTrait<bool, i8> > >` | `ref$<dyn$<SomeTrait<bool,i8,assoc$<Bar,u32> > >,Send> >`  |

The PR also adds self-profiling measurements for debuginfo type name generation (re. https://github.com/rust-lang/rust/issues/86431). It looks like the compiler spends up to 0.5% of its time in that task, so the potential for optimizing it via caching seems limited.

However, the perf run also shows [the biggest regression](https://perf.rust-lang.org/detailed-query.html?commit=585e91c718b0b2c5319e1fffd0ff1e62aaf7ccc2&base_commit=b9197978a90be6f7570741eabe2da175fec75375&benchmark=tokio-webpush-simple-debug&run_name=incr-unchanged) in a test case that does not even invoke the code in question. This suggests that the length of the names we generate here can affect performance by influencing how much data the linker has to copy around.

Fixes https://github.com/rust-lang/rust/issues/86134.
2021-07-19 21:25:43 +00:00
..
rustc
rustc_apfloat Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
rustc_arena
rustc_ast Use LocalExpnId where possible. 2021-07-17 19:41:02 +02:00
rustc_ast_lowering Remove refs from pat slices 2021-07-15 16:09:57 -05:00
rustc_ast_passes Auto merge of #83918 - workingjubilee:stable-rangefrom-pat, r=joshtriplett 2021-07-11 06:31:42 +00:00
rustc_ast_pretty Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
rustc_attr Enhance well-formedness checks for #[repr(...)] attributes 2021-07-09 22:03:48 +02:00
rustc_builtin_macros Auto merge of #87225 - estebank:cleanup, r=oli-obk 2021-07-19 18:44:27 +00:00
rustc_codegen_cranelift Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, r=petrochenkov 2021-07-18 14:21:56 +09:00
rustc_codegen_llvm Auto merge of #86950 - tmiasko:personality, r=nagisa 2021-07-18 20:33:23 +00:00
rustc_codegen_ssa Auto merge of #87153 - michaelwoerister:debuginfo-names-dyn-trait-projection-bounds, r=wesleywiser 2021-07-19 21:25:43 +00:00
rustc_data_structures Some perf optimizations and logging 2021-07-17 16:09:17 -04:00
rustc_driver Auto merge of #80182 - in42:stack_trace, r=tmandry 2021-07-02 05:40:51 +00:00
rustc_error_codes Rollup merge of #86838 - lambinoo:I-69630-rust_const_unstable_check_const, r=oli-obk 2021-07-08 18:30:34 +02:00
rustc_errors Various diagnostics clean ups/tweaks 2021-07-19 08:43:35 -07:00
rustc_expand Only use assign_id! for ast nodes that support attributes 2021-07-17 23:03:58 -05:00
rustc_feature Auto merge of #87201 - GuillaumeGomez:rollup-4loi2q9, r=GuillaumeGomez 2021-07-16 19:04:16 +00:00
rustc_fs_util
rustc_graphviz Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
rustc_hir Remove refs from pat slices 2021-07-15 16:09:57 -05:00
rustc_hir_pretty Rollup merge of #86358 - klensy:pp-loop, r=Mark-Simulacrum 2021-06-29 00:26:55 +09:00
rustc_incremental Move OnDiskCache to rustc_query_impl. 2021-07-18 11:14:07 +02:00
rustc_index
rustc_infer Some perf optimizations and logging 2021-07-17 16:09:17 -04:00
rustc_interface Remove deadlock virtual call. 2021-07-18 11:14:08 +02:00
rustc_lexer Rename 'bad prefix' to 'unknown prefix'. 2021-06-26 23:11:14 +08:00
rustc_lint Auto merge of #86970 - inquisitivecrystal:force-warn, r=davidtwco 2021-07-19 13:18:04 +00:00
rustc_lint_defs Compute a better lint_node_id during expansion 2021-07-17 23:03:56 -05:00
rustc_llvm Upgrade cc crate to 1.0.69 2021-07-13 17:58:50 +09:00
rustc_macros Move OnDiskCache to rustc_query_impl. 2021-07-18 11:14:07 +02:00
rustc_metadata Auto merge of #86698 - cjgillot:modc, r=estebank 2021-07-18 10:42:23 +00:00
rustc_middle Rollup merge of #87268 - SkiFire13:fix-uninit-ref-list, r=nagisa 2021-07-19 11:37:49 +02:00
rustc_mir Auto merge of #85686 - ptrojahn:loop_reinitialize, r=estebank 2021-07-18 02:13:12 +00:00
rustc_mir_build Auto merge of #87123 - RalfJung:miri-provenance-overhaul, r=oli-obk 2021-07-17 15:26:27 +00:00
rustc_parse Auto merge of #87242 - JohnTitor:rollup-t9rmwpo, r=JohnTitor 2021-07-18 08:15:17 +00:00
rustc_parse_format Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
rustc_passes Warn about useless assignments of variables/fields to themselves 2021-07-14 16:29:35 +02:00
rustc_plugin_impl
rustc_privacy Make resolutions a query. 2021-07-06 19:22:27 +02:00
rustc_query_impl Remove deadlock virtual call. 2021-07-18 11:14:08 +02:00
rustc_query_system
rustc_resolve Compute a better lint_node_id during expansion 2021-07-17 23:03:56 -05:00
rustc_save_analysis rustc_span: Revert addition of proc_macro field to ExpnKind::Macro 2021-07-10 23:03:35 +03:00
rustc_serialize
rustc_session Make --force-warns a normal lint level option 2021-07-17 23:13:59 -07:00
rustc_span Auto merge of #87225 - estebank:cleanup, r=oli-obk 2021-07-19 18:44:27 +00:00
rustc_symbol_mangling Revert "Revert "Merge CrateDisambiguator into StableCrateId"" 2021-07-06 11:28:04 +02:00
rustc_target Auto merge of #87124 - Andy-Python-Programmer:code_model_uefi_patch, r=petrochenkov 2021-07-17 10:15:33 +00:00
rustc_trait_selection Auto merge of #87225 - estebank:cleanup, r=oli-obk 2021-07-19 18:44:27 +00:00
rustc_traits Add initial implementation of HIR-based WF checking for diagnostics 2021-07-16 16:29:02 -05:00
rustc_ty_utils Add impl_constness query 2021-07-10 20:54:49 +08:00
rustc_type_ir
rustc_typeck Auto merge of #87225 - estebank:cleanup, r=oli-obk 2021-07-19 18:44:27 +00:00