1
Fork 0
rust/compiler
bors 20976bae5c Auto merge of #97293 - est31:remove_box, r=oli-obk
Add #[rustc_box] and use it inside alloc

This commit adds an alternative content boxing syntax, and uses it inside alloc.

```Rust
#![feature(box_syntax)]

fn foo() {
    let foo = box bar;
}
```

is equivalent to

```Rust
#![feature(rustc_attrs)]

fn foo() {
    let foo = #[rustc_box] Box::new(bar);
}
```

The usage inside the very performance relevant code in
liballoc is the only remaining relevant usage of box syntax
in the compiler (outside of tests, which are comparatively easy to port).

box syntax was originally designed to be used by all Rust
developers. This introduces a replacement syntax more tailored
to only being used inside the Rust compiler, and with it,
lays the groundwork for eventually removing box syntax.

[Earlier work](https://github.com/rust-lang/rust/pull/87781#issuecomment-894714878) by `@nbdd0121` to lower `Box::new` to `box` during THIR -> MIR building ran into borrow checker problems, requiring the lowering to be adjusted in a way that led to [performance regressions](https://github.com/rust-lang/rust/pull/87781#issuecomment-894872367). The proposed change in this PR lowers `#[rustc_box] Box::new` -> `box` in the AST -> HIR lowering step, which is way earlier in the compiler, and thus should cause less issues both performance wise as well as regarding type inference/borrow checking/etc. Hopefully, future work can move the lowering further back in the compiler, as long as there are no performance regressions.
2022-06-02 13:20:19 +00:00
..
rustc Auto merge of #96737 - ChrisDenton:win-manifest, r=wesleywiser 2022-06-02 07:58:29 +00:00
rustc_apfloat Addressed comments by @compiler-errors and @bjorn3 2022-03-30 17:04:46 -04:00
rustc_arena mark FIXMES for all the places found that are probably offset_from 2022-03-29 20:18:28 -04:00
rustc_ast Rollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillot 2022-05-23 07:43:50 +02:00
rustc_ast_lowering Remove #[rustc_box] attr during lowering 2022-06-01 02:44:12 +02:00
rustc_ast_passes clippy::complexity fixes 2022-05-26 13:14:24 +02:00
rustc_ast_pretty Rollup merge of #97254 - jhpratt:remove-crate-vis, r=cjgillot 2022-05-23 07:43:50 +02:00
rustc_attr RFC3239: Implement compact cfg(target(..)) 2022-05-24 13:51:36 +02:00
rustc_borrowck Rollup merge of #97023 - cjgillot:uniform-anon, r=estebank 2022-06-02 11:13:22 +02:00
rustc_builtin_macros Auto merge of #97461 - eddyb:proc-macro-less-payload, r=bjorn3 2022-05-28 16:49:52 +00:00
rustc_codegen_cranelift rename PointerAddress → PointerExposeAddress 2022-06-01 14:08:17 -04:00
rustc_codegen_gcc Finish bumping stage0 2022-05-27 07:36:17 -04:00
rustc_codegen_llvm Auto merge of #97214 - Mark-Simulacrum:stage0-bump, r=pietroalbini 2022-05-29 16:28:21 +00:00
rustc_codegen_ssa rename PointerAddress → PointerExposeAddress 2022-06-01 14:08:17 -04:00
rustc_const_eval Rollup merge of #97626 - RalfJung:expose, r=tmiasko 2022-06-02 06:44:29 +09:00
rustc_data_structures Tweak insert docs 2022-05-31 22:08:14 -07:00
rustc_driver errors: lazily load fallback fluent bundle 2022-04-13 02:44:59 +01:00
rustc_error_codes rustc: Stricter checking for #[link] attributes 2022-05-15 02:45:47 +03:00
rustc_error_messages migrate check_for_for_in_in_typo diagnostic 2022-05-31 16:28:05 -05:00
rustc_errors Mention filename in suggestion when it differs from primary span 2022-06-01 09:52:03 -07:00
rustc_expand Rollup merge of #97536 - est31:remove_unused_lifetimes, r=compiler-errors 2022-05-29 16:25:05 -07:00
rustc_feature Add #[rustc_box] 2022-06-01 02:28:34 +02:00
rustc_fs_util
rustc_graphviz update graphviz links 2022-05-12 18:31:42 +09:00
rustc_hir Rollup merge of #97023 - cjgillot:uniform-anon, r=estebank 2022-06-02 11:13:22 +02:00
rustc_hir_pretty use hir::Let in hir::Guard 2022-05-09 20:35:58 +08:00
rustc_incremental rename visit item-like methods 2022-05-13 11:46:06 -04:00
rustc_index Auto merge of #95418 - cjgillot:more-disk, r=davidtwco 2022-05-20 20:49:55 +00:00
rustc_infer Rollup merge of #97023 - cjgillot:uniform-anon, r=estebank 2022-06-02 11:13:22 +02:00
rustc_interface Update to rebased rustc-rayon 0.4 2022-05-27 20:20:41 -07:00
rustc_lexer Reduce max hash in raw strings from u16 to u8 2022-03-23 22:13:55 +01:00
rustc_lint Fix TyKind lint, make consts no longer fn, etc 2022-05-28 11:38:22 -07:00
rustc_lint_defs Fix typo 2022-05-23 14:07:40 +02:00
rustc_llvm Add LLVM based mingw-w64 targets 2022-05-13 20:14:15 +02:00
rustc_log clippy::complexity fixes 2022-05-26 13:14:24 +02:00
rustc_macros errors: simplify referring to fluent attributes 2022-05-30 13:38:19 +01:00
rustc_metadata Auto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errors 2022-05-30 09:19:03 +00:00
rustc_middle Rollup merge of #97023 - cjgillot:uniform-anon, r=estebank 2022-06-02 11:13:22 +02:00
rustc_mir_build rename PointerAddress → PointerExposeAddress 2022-06-01 14:08:17 -04:00
rustc_mir_dataflow Add a pointer to address cast kind 2022-05-31 00:00:00 +00:00
rustc_mir_transform Add a pointer to address cast kind 2022-05-31 00:00:00 +00:00
rustc_monomorphize Auto merge of #97168 - SparrowLii:accesses, r=cjgillot 2022-05-26 11:15:15 +00:00
rustc_parse Rollup merge of #97587 - pvdrz:maybe-recover-from-bad-qpath-stage-2, r=davidtwco 2022-06-02 11:13:24 +02:00
rustc_parse_format Make rustc_parse_format compile on stable 2022-05-03 11:26:58 +02:00
rustc_passes Auto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errors 2022-05-30 09:19:03 +00:00
rustc_plugin_impl
rustc_privacy Rollup merge of #97096 - tmiasko:reachable-constructor, r=petrochenkov 2022-05-18 07:40:58 +09:00
rustc_query_impl Auto merge of #97287 - compiler-errors:type-interner, r=jackh726,oli-obk 2022-05-29 08:20:13 +00:00
rustc_query_system Auto merge of #97287 - compiler-errors:type-interner, r=jackh726,oli-obk 2022-05-29 08:20:13 +00:00
rustc_resolve Rollup merge of #97264 - TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use-crate, r=estebank 2022-06-01 17:11:05 +02:00
rustc_save_analysis [save-analysis] Reference the variant not enum at struct-literal construction. 2022-05-12 16:34:02 -07:00
rustc_serialize Cache more queries on disk. 2022-05-13 08:06:48 +02:00
rustc_session Finish bumping stage0 2022-05-27 07:36:17 -04:00
rustc_span Add #[rustc_box] 2022-06-01 02:28:34 +02:00
rustc_symbol_mangling Auto merge of #96883 - jackh726:early-binder-2, r=oli-obk 2022-05-14 23:53:11 +00:00
rustc_target Simplify implementation of -Z gcc-ld 2022-05-25 23:55:22 +03:00
rustc_trait_selection Rollup merge of #97616 - TaKO8Ki:remove-unnecessary-option, r=Dylan-DPC 2022-06-01 23:36:53 +09:00
rustc_traits Remove crate visibility usage in compiler 2022-05-20 20:04:54 -04:00
rustc_ty_utils Auto merge of #96964 - oli-obk:const_trait_mvp, r=compiler-errors 2022-05-30 09:19:03 +00:00
rustc_type_ir Make TyCtxt implement Interner, make HashStable generic and move to rustc_type_ir 2022-05-28 12:16:05 -07:00
rustc_typeck Rollup merge of #97023 - cjgillot:uniform-anon, r=estebank 2022-06-02 11:13:22 +02:00