-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustc_intrinsic: support functions without body #135031
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
Conversation
HIR ty lowering was modified cc @fmease |
This comment has been minimized.
This comment has been minimized.
500a2b1
to
2356f2e
Compare
Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred to the CTFE machinery cc @rust-lang/wg-const-eval Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
This comment has been minimized.
This comment has been minimized.
2356f2e
to
3411cd8
Compare
The Miri subtree was changed cc @rust-lang/miri Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
ddd771e
to
71572b6
Compare
7863029
to
958a710
Compare
I think you mean turning the tuple variant into a struct variant. Also, annoying work, but I would prefer this change to be in a previous commit and then just adding the new field in a later commit. |
Ugh, disentangling this now will be painful :(
|
I can review as is. The effort for me to review as is is likely less than reviewing after splitting and you doing the splitting. Just keep it in mind for future stuff. |
I can try I had no idea what I would have to do for this PR. I had to do a bunch of experimentation until something worked -- even for the future I wouldn't know how to have a nice git history for that without a lot of extra effort. |
958a710
to
3cd3649
Compare
Yeah that strategy wasn't too bad, took around 20 minutes. |
Whenever I encounter a situation where I want to change a tuple struct/variant to a struct/struct-variant or vice versa, I stash (well nowadays I |
Thanks, that made it reviewable on my phone xD @bors r+ |
☀️ Test successful - checks-actions |
Finished benchmarking commit (fd127a3): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 2.2%, secondary 1.8%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 764.045s -> 763.089s (-0.13%) |
…ust_be_overridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In rust-lang#135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
…ust_be_overridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In rust-lang#135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
Rollup merge of rust-lang#137489 - RalfJung:no-more-rustc_intrinsic_must_be_overridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In rust-lang#135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
…erridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In rust-lang/rust#135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
…ust_be_overridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In rust-lang#135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
…ust_be_overridden, r=oli-obk remove `#[rustc_intrinsic_must_be_overridde]` In rust-lang#135031, we gained support for just leaving away the body. Now that the bootstrap compiler got bumped, stop using the old style and remove support for it. r? `@oli-obk` There are a few more mentions of this attribute in RA code that I didn't touch; Cc `@rust-lang/rust-analyzer`
We synthesize a HIR body
loop {}
but such bodyless intrinsics.Most of the diff is due to turning
ItemKind::Fn
into a brace (named-field) enum variant, because it carries abool
-typed field now. This is to remember whether the function has a body. MIR building panics to avoid ever translating the fakeloop {}
body, and the intrinsic logic uses the lack of a body to implicitly mark that intrinsic as must-be-overridden.I first tried actually having no body rather than generating the fake body, but there's a lot of code that assumes that all function items have HIR and MIR, so this didn't work very well. Then I noticed that even
rustc_intrinsic_must_be_overridden
intrinsics have MIR generated (they are filled with anUnreachable
terminator) so I guess I am not the first to discover this. ;)r? @oli-obk