-
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
compiler: Move rustc_target::spec::abi::Abi
to rustc_abi::ExternAbi
#132385
Conversation
Some changes occurred in match checking cc @Nadrieril Some changes occurred in match lowering cc @Nadrieril These commits modify the If this was unintentional then you should revert the changes before this PR is merged. These commits modify compiler targets. |
Completely abandon usage of rustc_target in these crates, as they need no special knowledge of rustc's target tuples.
7d62e93
to
8a0e640
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.
Looks certainly saner to me. Will wait a bit in case anyone has some naming/terminology concerns, but otherwise LGTM.
@@ -7,9 +7,11 @@ use rustc_span::{Span, Symbol}; | |||
#[cfg(test)] | |||
mod tests; | |||
|
|||
use ExternAbi as Abi; |
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.
are we gonna get rid of this too
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.
👍 👍. No naming concerns from me.
pub mod crt_objects; | ||
|
||
pub mod abi { | ||
pub use rustc_abi::{ |
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.
and this reexport as Abi would be nice to get rid of
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.
I can make this PR my entry in the most-files-in-tree-diffed-in-2024 competition, sure.
Let's not do any more cleanups in this PR. I'm happy to review anything re: those comments I left above, possibly piecewise. @bors r=jieyouxu,compiler-errors |
…bi, r=jieyouxu,compiler-errors compiler: Move `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi` Lift `enum Abi` from its rather odd place in the middle of rustc_target, and make it available again from rustc_abi. You know, the crate where you would expect the enum that describes all the ABIs to be? The platform-neutral ones, at least. This will help further refactoring of how we handle ABIs in the near future[^0]. Rename `Abi` to `ExternAbi` because quite a lot of the compiler overloads the concept of "ABI" enough that the existing name is imprecise and it is often renamed _anyway_. Often this was to avoid conflicts with the *other* type formerly known as `Abi` (now named BackendRepr[^1]), but sometimes it is just for clarity, and this name seems more self-explanatory. It does get reexported, though, using its old name, to reduce the odds of merge-conflicting over the entire tree. All of `ExternAbi`'s friends come along for the ride, which costs adding some optional dependencies to the rustc_abi crate. However, all of this also allows simply moving three crates entirely off rustc_target: - rustc_hir_pretty - rustc_lint_defs - rustc_mir_build This odd selection is mostly to demonstrate a secondary motivation: The majority of the front-end of the compiler should be as target-agnostic as possible, and it is easier to assure this if they simply don't depend on the crate that describes targets. Note that I didn't migrate crates that don't benefit from it in this way yet, and I didn't survey every last crate. [^0]: This is being undertaken as part of rust-lang#119183 [^1]: rust-lang#132246
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#131168 (Fix `target_os` for `mipsel-sony-psx`) - rust-lang#132209 (Fix validation when lowering `?` trait bounds) - rust-lang#132357 (Improve missing_abi lint) - rust-lang#132385 (compiler: Move `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi`) - rust-lang#132417 (macOS: Document the difference between Clang's `-darwin` and `-macosx` targets) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 9 pull requests Successful merges: - rust-lang#131168 (Fix `target_os` for `mipsel-sony-psx`) - rust-lang#132209 (Fix validation when lowering `?` trait bounds) - rust-lang#132294 (Bump Fuchsia) - rust-lang#132357 (Improve missing_abi lint) - rust-lang#132385 (compiler: Move `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi`) - rust-lang#132403 (continue `TypingMode` refactor) - rust-lang#132417 (macOS: Document the difference between Clang's `-darwin` and `-macosx` targets) - rust-lang#132421 (Remove `""` case from RISC-V `llvm_abiname` match statement) - rust-lang#132422 (llvm: Match new LLVM 128-bit integer alignment on sparc) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132385 - workingjubilee:move-abi-to-rustc-abi, r=jieyouxu,compiler-errors compiler: Move `rustc_target::spec::abi::Abi` to `rustc_abi::ExternAbi` Lift `enum Abi` from its rather odd place in the middle of rustc_target, and make it available again from rustc_abi. You know, the crate where you would expect the enum that describes all the ABIs to be? The platform-neutral ones, at least. This will help further refactoring of how we handle ABIs in the near future[^0]. Rename `Abi` to `ExternAbi` because quite a lot of the compiler overloads the concept of "ABI" enough that the existing name is imprecise and it is often renamed _anyway_. Often this was to avoid conflicts with the *other* type formerly known as `Abi` (now named BackendRepr[^1]), but sometimes it is just for clarity, and this name seems more self-explanatory. It does get reexported, though, using its old name, to reduce the odds of merge-conflicting over the entire tree. All of `ExternAbi`'s friends come along for the ride, which costs adding some optional dependencies to the rustc_abi crate. However, all of this also allows simply moving three crates entirely off rustc_target: - rustc_hir_pretty - rustc_lint_defs - rustc_mir_build This odd selection is mostly to demonstrate a secondary motivation: The majority of the front-end of the compiler should be as target-agnostic as possible, and it is easier to assure this if they simply don't depend on the crate that describes targets. Note that I didn't migrate crates that don't benefit from it in this way yet, and I didn't survey every last crate. [^0]: This is being undertaken as part of rust-lang#119183 [^1]: rust-lang#132246
Lift
enum Abi
from its rather odd place in the middle of rustc_target, and make it available again from rustc_abi. You know, the crate where you would expect the enum that describes all the ABIs to be? The platform-neutral ones, at least. This will help further refactoring of how we handle ABIs in the near future1.Rename
Abi
toExternAbi
because quite a lot of the compiler overloads the concept of "ABI" enough that the existing name is imprecise and it is often renamed anyway. Often this was to avoid conflicts with the other type formerly known asAbi
(now named BackendRepr2), but sometimes it is just for clarity, and this name seems more self-explanatory. It does get reexported, though, using its old name, to reduce the odds of merge-conflicting over the entire tree.All of
ExternAbi
's friends come along for the ride, which costs adding some optional dependencies to the rustc_abi crate. However, all of this also allows simply moving three crates entirely off rustc_target:This odd selection is mostly to demonstrate a secondary motivation: The majority of the front-end of the compiler should be as target-agnostic as possible, and it is easier to assure this if they simply don't depend on the crate that describes targets. Note that I didn't migrate crates that don't benefit from it in this way yet, and I didn't survey every last crate.
Footnotes
This is being undertaken as part of https://github.com/rust-lang/rust/issues/119183 ↩
https://github.com/rust-lang/rust/pull/132246 ↩