-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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: gate extern "{abi}"
in ast_lowering
#136603
compiler: gate extern "{abi}"
in ast_lowering
#136603
Conversation
55bc9eb
to
4e4fa2a
Compare
c66f564
to
8ebebd3
Compare
This comment has been minimized.
This comment has been minimized.
8ebebd3
to
901945e
Compare
☔ The latest upstream changes (presumably #136613) made this pull request unmergeable. Please resolve the merge conflicts. |
901945e
to
2bd2dea
Compare
Some changes occurred in compiler/rustc_passes/src/check_attr.rs Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in compiler/rustc_codegen_ssa/src/codegen_attrs.rs These commits modify compiler targets. These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in compiler/rustc_codegen_gcc |
extern "{abi}"
in ast_loweringextern "{abi}"
in ast_lowering
r? @compiler-errors or reroll |
I split out the first four commits again into #136706 but that's as far as things can be cut. |
79d0646
to
f5512f4
Compare
☔ The latest upstream changes (presumably #136762) made this pull request unmergeable. Please resolve the merge conflicts. |
f5512f4
to
5d7c093
Compare
@@ -1,4 +1,4 @@ | |||
error[E0658]: intrinsics are subject to change | |||
error[E0658]: rust-intrinsic ABI is an implementation detail and perma-unstable |
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.
nit, what about:
the "rust-intrinsic" ABI is [...]
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 similarly for above
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.
Sure! should it be extern "abi"
so it looks like what people actually write in syntax?
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.
pushed a diff for consideration~
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.
oops yep sounds good i was busy watching sportsball
1fcf247
to
6b8fab8
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.
LGTM, i have a few questions but r=me regardless
@@ -8,10 +8,9 @@ LL | extern "riscv-interrupt" fn isr() {} | |||
| help: did you mean: `"riscv-interrupt-m"` | |||
| | |||
= note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions | |||
= note: please use one of riscv-interrupt-m or riscv-interrupt-s for machine- or supervisor-level interrupts, respectively |
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.
where'd this message go? 🤔
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's functionally redundant with this one:
| help: did you mean:
"riscv-interrupt-m"
If there are two suggestions of equal distance and we want to suggest "try either of these", then we should just do that in a generalized way instead.
@@ -1,4 +1,4 @@ | |||
error[E0658]: intrinsics are subject to change | |||
error[E0658]: rust-intrinsic ABI is an implementation detail and perma-unstable |
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.
oops yep sounds good i was busy watching sportsball
@@ -1,4 +0,0 @@ | |||
extern "wasm" fn test() {} |
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.
why remove this test?
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's a suggestion that was for migrating off a nightly feature, starting from last July.
The only users of the feature that I'm aware of are people implementing next-generation wasm toolchain components. So, the people working with us on the migration of wasm's extern "C"
to match clang's. They... have known about this for some time, so it seems unlikely they will still benefit from a continued reminder into the future.
So, I removed the suggestion, as we don't usually keep around migration stuff for nightly things for more than a couple of releases, and it's been some. Thus, this test winds up testing nothing.
By moving this stability check into AST lowering, we effectively make it impossible to accidentally miss, as it must happen to generate HIR. Also, we put the ABI-stability code next to code that actually uses it! This allows code that wants to reason about backend ABI implementations to stop worrying about high-level concerns like syntax stability, while still leaving it as the authority on what ABIs actually exist. It also makes it easy to refactor things to have more consistent errors. For now, we only apply this to generalize the existing messages a bit.
These are either residue of a long-term migration away from something, or are simply trying too hard to be specifically useful: nearest-match suggestions for ABI strings should handle this.
6b8fab8
to
cd9d39e
Compare
@bors r=compiler-errors |
…-into-ast, r=compiler-errors compiler: gate `extern "{abi}"` in ast_lowering I don't believe low-level crates like `rustc_abi` should have to know or care about higher-level concerns like whether the ABI string is stable for users. These implementation details can be made less open to public inspection. This way the code that governs stability is near the code that enforces stability, and compiled together. It also abstracts away certain error messages instead of constantly repeating them. A few error messages are simply deleted outright, instead of made uniform, because they are either too dated to be useful or redundant with other diagnostic improvements we could make. These can be pursued in followups: my first concern was making sure there wasn't unnecessary diagnostics-related code in `rustc_abi`, which is not well-positioned to understand what kind of errors are going to be generated based on how it is used. r? `@ghost`
…kingjubilee Rollup of 9 pull requests Successful merges: - rust-lang#134626 (Add Four Codegen Tests) - rust-lang#135408 (x86: make SSE2 required for i686 hardfloat targets and use it to pass SIMD types) - rust-lang#136155 (Enable sanitizers on MSVC CI jobs) - rust-lang#136419 (adding autodiff tests) - rust-lang#136603 (compiler: gate `extern "{abi}"` in ast_lowering) - rust-lang#136628 (ci: upgrade to crosstool-ng 1.27.0) - rust-lang#136714 (Update `compiler-builtins` to 0.1.146) - rust-lang#136731 (rustc_middle: parallel: TyCtxt: remove "unsafe impl DynSend/DynSync") - rust-lang#136761 (tests: `-Copt-level=3` instead of `-O` in codegen tests) r? `@ghost` `@rustbot` modify labels: rollup
…-into-ast, r=compiler-errors compiler: gate `extern "{abi}"` in ast_lowering I don't believe low-level crates like `rustc_abi` should have to know or care about higher-level concerns like whether the ABI string is stable for users. These implementation details can be made less open to public inspection. This way the code that governs stability is near the code that enforces stability, and compiled together. It also abstracts away certain error messages instead of constantly repeating them. A few error messages are simply deleted outright, instead of made uniform, because they are either too dated to be useful or redundant with other diagnostic improvements we could make. These can be pursued in followups: my first concern was making sure there wasn't unnecessary diagnostics-related code in `rustc_abi`, which is not well-positioned to understand what kind of errors are going to be generated based on how it is used. r? ``@ghost``
…-into-ast, r=compiler-errors compiler: gate `extern "{abi}"` in ast_lowering I don't believe low-level crates like `rustc_abi` should have to know or care about higher-level concerns like whether the ABI string is stable for users. These implementation details can be made less open to public inspection. This way the code that governs stability is near the code that enforces stability, and compiled together. It also abstracts away certain error messages instead of constantly repeating them. A few error messages are simply deleted outright, instead of made uniform, because they are either too dated to be useful or redundant with other diagnostic improvements we could make. These can be pursued in followups: my first concern was making sure there wasn't unnecessary diagnostics-related code in `rustc_abi`, which is not well-positioned to understand what kind of errors are going to be generated based on how it is used. r? `@ghost`
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#136107 (Introduce CoercePointeeWellformed for coherence checks at typeck stage) - rust-lang#136155 (Enable sanitizers on MSVC CI jobs) - rust-lang#136524 (Delay bug when method confirmation cannot upcast object pick of self) - rust-lang#136584 (Prevent generic pattern types from being used in libstd) - rust-lang#136603 (compiler: gate `extern "{abi}"` in ast_lowering) - rust-lang#136821 (assign marcoieni and jdno to infra-ci PRs) - rust-lang#136825 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136603 - workingjubilee:move-abi-versioning-into-ast, r=compiler-errors compiler: gate `extern "{abi}"` in ast_lowering I don't believe low-level crates like `rustc_abi` should have to know or care about higher-level concerns like whether the ABI string is stable for users. These implementation details can be made less open to public inspection. This way the code that governs stability is near the code that enforces stability, and compiled together. It also abstracts away certain error messages instead of constantly repeating them. A few error messages are simply deleted outright, instead of made uniform, because they are either too dated to be useful or redundant with other diagnostic improvements we could make. These can be pursued in followups: my first concern was making sure there wasn't unnecessary diagnostics-related code in `rustc_abi`, which is not well-positioned to understand what kind of errors are going to be generated based on how it is used. r? ``@ghost``
I don't believe low-level crates like
rustc_abi
should have to know or care about higher-level concerns like whether the ABI string is stable for users. These implementation details can be made less open to public inspection. This way the code that governs stability is near the code that enforces stability, and compiled together.It also abstracts away certain error messages instead of constantly repeating them.
A few error messages are simply deleted outright, instead of made uniform, because they are either too dated to be useful or redundant with other diagnostic improvements we could make. These can be pursued in followups: my first concern was making sure there wasn't unnecessary diagnostics-related code in
rustc_abi
, which is not well-positioned to understand what kind of errors are going to be generated based on how it is used.r? @ghost