rust/compiler
Aman Arora 23c0334fd3 2229: Reduce the size of closures with capture_disjoint_fields
One key observation while going over the closure size profile of rustc
was that we are disjointly capturing one or more fields starting at an
immutable reference.

Disjoint capture over immutable reference doesn't add too much value
because the fields can either be borrowed immutably or copied.

One possible edge case of the optimization is when a fields of a struct
have a longer lifetime than the structure, therefore we can't completely
get rid of all the accesses on top of sharef refs, only the rightmost
one. Here is a possible example:

```rust
struct MyStruct<'a> {
   a: &'static A,
   b: B,
   c: C<'a>,
}

fn foo<'a, 'b>(m: &'a MyStruct<'b>) -> impl FnMut() + 'static {
    let c = || drop(&*m.a.field_of_a);
    // Here we really do want to capture `*m.a` because that outlives `'static`

    // If we capture `m`, then the closure no longer outlives `'static'
    // it is constrained to `'a`
}
```
2021-06-29 03:16:43 -04:00
..
rustc use jemallocator in rustc/rustdoc 2021-04-04 14:10:26 -07:00
rustc_apfloat Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
rustc_arena Remove (lots of) dead code 2021-03-27 22:16:33 -04:00
rustc_ast Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011 2021-06-28 01:20:01 +00:00
rustc_ast_lowering Auto merge of #86321 - JohnTitor:rollup-q61c8q4, r=JohnTitor 2021-06-15 20:15:23 +00:00
rustc_ast_passes Auto merge of #86164 - FabianWolff:issue-86053, r=davidtwco 2021-06-17 06:34:12 +00:00
rustc_ast_pretty Rollup merge of #86358 - klensy:pp-loop, r=Mark-Simulacrum 2021-06-29 00:26:55 +09:00
rustc_attr remove cfg(bootstrap) 2021-05-24 11:07:48 -04:00
rustc_builtin_macros Auto merge of #86599 - Amanieu:asm_raw, r=nagisa 2021-06-25 20:44:28 +00:00
rustc_codegen_cranelift Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011 2021-06-28 01:20:01 +00:00
rustc_codegen_llvm Auto merge of #86267 - ZuseZ4:master, r=nagisa 2021-06-26 19:20:41 +00:00
rustc_codegen_ssa Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011 2021-06-28 01:20:01 +00:00
rustc_data_structures Rollup merge of #86387 - JohnTitor:now-no-unused-lifetimes, r=Mark-Simulacrum 2021-06-22 07:37:53 +09:00
rustc_driver Use Option::map() instead of if let 2021-06-26 22:26:26 +02:00
rustc_error_codes Auto merge of #86279 - JohnTitor:transparent-zero-size-fields, r=nikomatsakis 2021-06-24 07:29:59 +00:00
rustc_errors Auto merge of #85903 - bjorn3:rustc_serialize_cleanup, r=varkor 2021-06-07 14:40:26 +00:00
rustc_expand Don't lint :pat when re-parsing a macro from another crate. 2021-06-24 22:04:55 +00:00
rustc_feature Panic on trying to find non-feature incompleteness 2021-06-28 18:37:54 -04:00
rustc_fs_util Optimize away a fs::metadata call. 2021-01-06 08:33:15 -08:00
rustc_graphviz Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
rustc_hir Rollup merge of #86223 - fee1-dead:better-E0121, r=petrochenkov 2021-06-23 00:20:18 +02:00
rustc_hir_pretty Rollup merge of #86358 - klensy:pp-loop, r=Mark-Simulacrum 2021-06-29 00:26:55 +09:00
rustc_incremental Do not require the DefPathTable to construct the on-disk cache. 2021-06-08 22:23:03 +02:00
rustc_index Remove unused feature gates 2021-05-31 13:55:43 +02:00
rustc_infer Auto merge of #86164 - FabianWolff:issue-86053, r=davidtwco 2021-06-17 06:34:12 +00:00
rustc_interface Auto merge of #86267 - ZuseZ4:master, r=nagisa 2021-06-26 19:20:41 +00:00
rustc_lexer Rename 'bad prefix' to 'unknown prefix'. 2021-06-26 23:11:14 +08:00
rustc_lint Auto merge of #86446 - Smittyvb:rustc_insignificant_dtor-ice, r=Mark-Simulacrum 2021-06-29 02:48:08 +00:00
rustc_lint_defs Rollup merge of #86673 - m-ou-se:disjoint-capture-edition-lint, r=nikomatsakis 2021-06-29 08:46:15 +09:00
rustc_llvm Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkov 2021-06-06 03:59:17 +00:00
rustc_macros Lint for unused borrows as part of UNUSED_MUST_USE 2021-06-18 15:09:40 +08:00
rustc_metadata Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011 2021-06-28 01:20:01 +00:00
rustc_middle Rollup merge of #86671 - m-ou-se:non-fmt-panic-future-incompatible, r=nikomatsakis 2021-06-29 08:46:14 +09:00
rustc_mir Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkov 2021-06-26 08:24:31 +00:00
rustc_mir_build fixup! Editon 2021 enables precise capture 2021-06-27 21:46:55 -04:00
rustc_parse No reserved_prefix suggestion in proc macro call_site. 2021-06-26 23:11:14 +08:00
rustc_parse_format remove cfg(bootstrap) 2021-05-24 11:07:48 -04:00
rustc_passes Check that #[cmse_nonsecure_entry] is applied to a function definition 2021-06-25 17:49:41 +02:00
rustc_plugin_impl Use () for plugin_registrar_fn. 2021-05-12 13:58:43 +02:00
rustc_privacy Add more tests + visit_ty in some places 2021-06-09 19:28:41 +01:00
rustc_query_impl Auto merge of #85154 - cjgillot:lessfn, r=bjorn3 2021-06-15 14:52:58 +00:00
rustc_query_system Auto merge of #85154 - cjgillot:lessfn, r=bjorn3 2021-06-15 14:52:58 +00:00
rustc_resolve Fix garbled suggestion for missing lifetime specifier 2021-06-28 00:56:24 +02:00
rustc_save_analysis Revert "Merge CrateDisambiguator into StableCrateId" 2021-06-07 10:37:45 +02:00
rustc_serialize Emit warnings for unused fields in custom targets. 2021-06-17 21:48:02 +02:00
rustc_session Auto merge of #86267 - ZuseZ4:master, r=nagisa 2021-06-26 19:20:41 +00:00
rustc_span Auto merge of #86386 - inquisitivecrystal:better-errors-for-display-traits-v3, r=estebank 2021-06-23 03:16:04 +00:00
rustc_symbol_mangling Revert "Merge CrateDisambiguator into StableCrateId" 2021-06-07 10:37:45 +02:00
rustc_target Point to the updated version of some dead links 2021-06-23 19:36:51 -04:00
rustc_trait_selection Auto merge of #86386 - inquisitivecrystal:better-errors-for-display-traits-v3, r=estebank 2021-06-23 03:16:04 +00:00
rustc_traits Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
rustc_ty_utils Revert "Merge CrateDisambiguator into StableCrateId" 2021-06-07 10:37:45 +02:00
rustc_type_ir Remove unused feature gates 2021-05-31 13:55:43 +02:00
rustc_typeck 2229: Reduce the size of closures with capture_disjoint_fields 2021-06-29 03:16:43 -04:00