-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove box_syntax
#108471
Remove box_syntax
#108471
Conversation
df3f335
to
e33ed64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also adjust rustc_hir_pretty
to use #[rustc_box]
instead?
e33ed64
to
910eea2
Compare
Deleting it sounds great (totally not me talking about removing it being the reason for you doing it) but I'd like to get some visibility for this anyways, cc @rust-lang/lang @rust-lang/compiler |
910eea2
to
3341e00
Compare
Updated |
This comment has been minimized.
This comment has been minimized.
oops, misclick |
This comment has been minimized.
This comment has been minimized.
3341e00
to
a73352f
Compare
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in src/tools/rustfmt cc @rust-lang/rustfmt |
The eventual removal of box syntax has been my long term goal (#87781, #88316, #97293, #97494, #99066, #99577, #100194, etc all worked in that direction), but I've been avoiding doing the last step. It's great to see this being proposed. I think the presence of box syntax causes confusion among people in the sense that they think it is going to be stabilized, which it won't. The last triage comment from the lang team has said that the lang team waits for stabilization-track features (from my reading those are features that are more likely going to be stabilized than I think given boxing is sort-of available on stable, this is mostly resolved. Yes, there is no guarantee for Also note that the functionality itself is not deleted, just the |
This comment has been minimized.
This comment has been minimized.
a73352f
to
30b9511
Compare
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in src/tools/rust-analyzer cc @rust-lang/wg-rls-2 |
30b9511
to
575494a
Compare
This comment has been minimized.
This comment has been minimized.
Not sure about the mir-opt test failures, I blessed them locally but CI has different results. I might try |
575494a
to
198aee7
Compare
This comment has been minimized.
This comment has been minimized.
Some comments on the PR itself:
|
198aee7
to
76aef16
Compare
@est31 thank you, sorry for bothering you people, you're doing good work... I will try the alternatives. |
@leonardo-m I have a fair bit of experience with this stuff. I and the comments elsewhere in this PR are suggesting you use |
I always wondered why |
…ieb,est31 Remove `box_syntax` r? `@Nilstrieb` This removes the feature `box_syntax`, which allows the use of `box <expr>` to create a Box, and finalises removing use of the feature from the compiler. `box_patterns` (allowing the use of `box <pat>` in a pattern) is unaffected. It also removes `ast::ExprKind::Box` - the only way to create a 'box' expression now is with the rustc-internal `#[rustc_box]` attribute. As a temporary measure to help users move away, `box <expr>` now parses the inner expression, and emits a `MachineApplicable` lint to replace it with `Box::new` Closes rust-lang#49733
…r-errors Remove box expressions from HIR After rust-lang#108516, `#[rustc_box]` is used at HIR->THIR lowering and this is no longer emitted, so it can be removed. This is based on top of rust-lang#108471 to help with conflicts, so 43490488ccacd1a822e9c621f5ed6fca99959a0b is the only relevant commit (sorry for all the duplicated pings!) ````@rustbot```` label +S-blocked
Box syntax removed in rust-lang/rust#108471 Removed all `#![features(box_syntax)]` and ran `cargo fix --broken-code` to replace all previous box_patterns uses of `box` with `Box::new()`.
### Description Box syntax removed in rust-lang/rust#108471 Removed all `#![features(box_syntax)]` and ran `cargo fix --broken-code` to replace all previous box_patterns uses of `box` with `Box::new()`. ### Testing Instructions No testing needed.
Update the toolchain to use nightly-2023-04-16. Changes were related to the following changes to the toolchain: - rust-lang/rust#108944 - rust-lang/rust#108148 - rust-lang/rust#108471 - rust-lang/rust#109358 - rust-lang/rust#109849 - rust-lang/rust#109819 - rust-lang/rust#109718 - rust-lang/rust#109092 - rust-lang/rust#108856 - rust-lang/rust#105613 - rust-lang/rust#103042 - rust-lang/rust#109716 - rust-lang/rust#108340 - rust-lang/rust#102906 - rust-lang/rust#98112 - rust-lang/rust#108080
`box_syntax` has been removed from rust: rust-lang/rust#108471. Use `Box::new` instead.
…ilstrieb Remove special handling of `box` expressions from parser rust-lang#108471 added a temporary hack to parse `box expr`. It's been almost a year since then, so I think it's safe to remove the special handling. As a drive-by cleanup, move `parser/removed-syntax*` tests to their own directory.
…ilstrieb Remove special handling of `box` expressions from parser rust-lang#108471 added a temporary hack to parse `box expr`. It's been almost a year since then, so I think it's safe to remove the special handling. As a drive-by cleanup, move `parser/removed-syntax*` tests to their own directory.
Rollup merge of rust-lang#120063 - clubby789:remove-box-handling, r=Nilstrieb Remove special handling of `box` expressions from parser rust-lang#108471 added a temporary hack to parse `box expr`. It's been almost a year since then, so I think it's safe to remove the special handling. As a drive-by cleanup, move `parser/removed-syntax*` tests to their own directory.
### Description Box syntax removed in rust-lang/rust#108471 Removed all `#![features(box_syntax)]` and ran `cargo fix --broken-code` to replace all previous box_patterns uses of `box` with `Box::new()`. ### Testing Instructions No testing needed.
### Description Box syntax removed in rust-lang/rust#108471 Removed all `#![features(box_syntax)]` and ran `cargo fix --broken-code` to replace all previous box_patterns uses of `box` with `Box::new()`. ### Testing Instructions No testing needed.
### Description Box syntax removed in rust-lang/rust#108471 Removed all `#![features(box_syntax)]` and ran `cargo fix --broken-code` to replace all previous box_patterns uses of `box` with `Box::new()`. ### Testing Instructions No testing needed.
@saethlin Having the size information in the Box can help eliminate bounds checking, which is why I intentionally used a boxed array in my specific use case (An emulator, performing lots of unpredictable accesses on a u8 array). Here's a godbolt example of what I mean, notice how the second function has no bounds checking: https://godbolt.org/z/xsE89de5M I haven't found an adequate replacement for this usecase of box_syntax yet, I might end up using unsafe ( |
@nico-abram If you you start by building a vector, you can convert it into a boxed array with https://doc.rust-lang.org/std/vec/struct.Vec.html#impl-TryFrom%3CVec%3CT%3E%3E-for-Box%3C%5BT;+N%5D%3E -- and then you still get all the improved bounds checking elimination you were talking about. |
r? @Nilstrieb
This removes the feature
box_syntax
, which allows the use ofbox <expr>
to create a Box, and finalises removing use of the feature from the compiler.box_patterns
(allowing the use ofbox <pat>
in a pattern) is unaffected.It also removes
ast::ExprKind::Box
- the only way to create a 'box' expression now is with the rustc-internal#[rustc_box]
attribute.As a temporary measure to help users move away,
box <expr>
now parses the inner expression, and emits aMachineApplicable
lint to replace it withBox::new
Closes #49733