-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 the old AST-based backend from rustc_trans. #35764
Conversation
r? @nrc (rust_highfive has picked a reviewer for you, use r? to override) |
Dat diff. |
Praise be, the world will no longer be blocked on MIR, and development of new features can finally take place! |
Much as I'd love to r+ this, r? @nikomatsakis |
fn dtor_to_init_u8(dtor: bool) -> u8 { | ||
if dtor { 1 } else { 0 } | ||
} | ||
|
||
pub trait GetDtorType<'tcx> { fn dtor_type(self) -> Ty<'tcx>; } |
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.
It looks like this trait can also be deleted?
☔ The latest upstream changes (presumably #35684) made this pull request unmergeable. Please resolve the merge conflicts. |
FWIW, this appears to fix #35408 locally, possibly due to |
|
||
// see comments above for why this check is here | ||
if thin as usize == mem::POST_DROP_USIZE { | ||
return; | ||
#[cfg(stage0)] { |
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.
this is nifty
4b7129b
to
9a9cd63
Compare
@bors r+ |
📌 Commit 9a9cd63 has been approved by |
Remove the old AST-based backend from rustc_trans. Starting with Rust 1.13, `--disable-orbit` , `-Z orbit=off` and `#[rustc_no_mir]` have been removed. Only the new MIR backend is left in the compiler, and only early const_eval uses ASTs from other crates. Filling drop (previously "zeroing drop"), `#[unsafe_no_drop_flag]` and associated unstable APIs are gone. Implementing `Drop` doesn't add a flag anymore to the type, all of the dynamic drop is function local. This is a [breaking-change], please use `Option::None` and/or `mem::forget` if you are unsure about your ability to prevent/control the drop of a value. In the future, `union` will be usable in some such cases. **NOTE**: DO NOT MERGE before we get the new beta as the stage0, there's some cruft to remove. All of this will massively simplify any efforts to implement (and as such it blocks) features such as `union`s, safe use of `#[packed]` or new type layout optimizations, not to mention many other experiments.
💔 Test failed - auto-mac-cross-ios-opt |
@bors retry |
Remove the old AST-based backend from rustc_trans. Starting with Rust 1.13, `--disable-orbit` , `-Z orbit=off` and `#[rustc_no_mir]` have been removed. Only the new MIR backend is left in the compiler, and only early const_eval uses ASTs from other crates. Filling drop (previously "zeroing drop"), `#[unsafe_no_drop_flag]` and associated unstable APIs are gone. Implementing `Drop` doesn't add a flag anymore to the type, all of the dynamic drop is function local. This is a [breaking-change], please use `Option::None` and/or `mem::forget` if you are unsure about your ability to prevent/control the drop of a value. In the future, `union` will be usable in some such cases. **NOTE**: DO NOT MERGE before we get the new beta as the stage0, there's some cruft to remove. All of this will massively simplify any efforts to implement (and as such it blocks) features such as `union`s, safe use of `#[packed]` or new type layout optimizations, not to mention many other experiments.
Implement untagged unions (RFC 1444) cc #32836 Notes: - The RFC doesn't talk about `#[packed]` unions, this implementation supports them, packing changes union's alignment to 1 and removes trailing padding. - The RFC doesn't talk about dynamically sized unions, this implementation doesn't support them and rejects them during wf-checking (similarly, dynamically sized enums are not supported as well). - The lint for drop fields in unions can't work precisely before monomorphization, so it works pessimistically - non-`Copy` generic fields are reported, types not implementing `Drop` directly, but having non-trivial drop code are reported. ``` struct S(String); // Doesn't implement `Drop` union U<T> { a: S, // Reported b: T, // Reported } ``` - #35764 was indeed helpful and landed timely, I didn't have to implement internal drop flags for unions. - Unions are not permitted in constant patterns, because matching on union fields is unsafe, I didn't want unsafety checker to dig into all constants to uncover this possible unsafety. - The RFC doesn't talk about `#[derive]`, generally trait impls cannot be derived for unions, but some of them can. I implemented only `#[derive(Copy)]` so far. In theory shallow `#[derive(Clone)]` can be derived as well if all union fields are `Copy`, I left it for later though, it requires changing how `Clone` impls are generated. - Moving union fields is implemented as per #32836 (comment). - Testing strategy: union specific behavior is tested, sometimes very basically (e.g. debuginfo), behavior common for all ADTs (e.g. something like coherence checks) is not generally tested. r? @eddyb
Starting with Rust 1.13,
--disable-orbit
,-Z orbit=off
and#[rustc_no_mir]
have been removed.Only the new MIR backend is left in the compiler, and only early const_eval uses ASTs from other crates.
Filling drop (previously "zeroing drop"),
#[unsafe_no_drop_flag]
and associated unstable APIs are gone.Implementing
Drop
doesn't add a flag anymore to the type, all of the dynamic drop is function local.This is a [breaking-change], please use
Option::None
and/ormem::forget
if you are unsure about your ability to prevent/control the drop of a value. In the future,union
will be usable in some such cases.NOTE: DO NOT MERGE before we get the new beta as the stage0, there's some cruft to remove.
All of this will massively simplify any efforts to implement (and as such it blocks) features such as
union
s, safe use of#[packed]
or new type layout optimizations, not to mention many other experiments.