Remove redundancy from the implementation of C variadics.#63492
Remove redundancy from the implementation of C variadics.#63492bors merged 4 commits intorust-lang:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
dlrobertson
left a comment
There was a problem hiding this comment.
👍 Great stuff! This is much cleaner.
src/librustc/hir/lowering.rs
Outdated
There was a problem hiding this comment.
Good idea to skip this here.
8b9d92c to
f6d4b3b
Compare
|
☔ The latest upstream changes (presumably #63655) made this pull request unmergeable. Please resolve the merge conflicts. |
|
cc @matthewjasper @nikomatsakis for the MIR changes |
|
Ping from triage, can someone from @rust-lang/compiler review this PR. Thanks |
|
Ping from triage |
|
Ping from Triage: Closing due to inactivity. If or when there are updates, please re-open. @eddyb Thanks for the PR. |
|
@eddyb overall r=me, with the two nits fixed. |
src/librustc_codegen_ssa/mir/mod.rs
Outdated
There was a problem hiding this comment.
isn't this one too far? arg_index is already one beyond the list of normal arguments
There was a problem hiding this comment.
+ 1 is pre-existing, I'm not sure what the deal is (see my comment on this in some of the prereq commits in #56231).
src/librustc_typeck/check/mod.rs
Outdated
There was a problem hiding this comment.
almost the same code snippet appears in src/librustc_mir/build/mod.rs
factor out into a function?
There was a problem hiding this comment.
Feel free to open an issue but I think there is a more general problem here and it also involves the whole liberated_fn_sigs.
That is, there should be a common way to get the "function signature as viewed from inside the body" - possibly including reading the types associated with the hir::Body arguments as opposed to computing them from tcx.fn_sig(def_id).
There was a problem hiding this comment.
Point is, I don't want a shared function for just the c_variadic part of this.
|
Failed in #64860 (comment), @bors r- |
|
@bors retry |
|
@bors r- r? @matthewjasper for the MIR/NLL borrowck (I had to redo it, first attempt was flawed) |
|
@bors r=nagisa,matthewjasper |
|
📌 Commit 057f23d has been approved by |
Remove redundancy from the implementation of C variadics. This cleanup was first described in rust-lang#44930 (comment): * AST doesn't track `c_variadic: bool` anymore, relying solely on a trailing `CVarArgs` type in fn signatures * HIR doesn't have a `CVarArgs` anymore, relying solely on `c_variadic: bool` * same for `ty::FnSig` (see tests for diagnostics improvements from that) * `{hir,mir}::Body` have one extra argument than the signature when `c_variadic == true` * `rustc_typeck` and `rustc_mir::{build,borrowck}` need to give that argument the right type (which no longer uses a lifetime parameter, but a function-internal scope) * `rustc_target::abi::call` doesn't need special hacks anymore (since it never sees the `VaListImpl` now, it's all inside the body) r? @nagisa / @rkruppe cc @dlrobertson @oli-obk
Rollup of 5 pull requests Successful merges: - #63492 (Remove redundancy from the implementation of C variadics.) - #64589 (Differentiate AArch64 bare-metal targets between hf and non-hf.) - #64799 (Fix double panic when printing query stack during an ICE) - #64824 (No StableHasherResult everywhere) - #64884 (Add pkg-config to dependency list if building for Linux on Linux) Failed merges: r? @ghost
Rustup rust-lang/rust#63492 changelog: none
This cleanup was first described in #44930 (comment):
c_variadic: boolanymore, relying solely on a trailingCVarArgstype in fn signaturesCVarArgsanymore, relying solely onc_variadic: boolty::FnSig(see tests for diagnostics improvements from that){hir,mir}::Bodyhave one extra argument than the signature whenc_variadic == truerustc_typeckandrustc_mir::{build,borrowck}need to give that argument the right type (which no longer uses a lifetime parameter, but a function-internal scope)rustc_target::abi::calldoesn't need special hacks anymore (since it never sees theVaListImplnow, it's all inside the body)r? @nagisa / @rkruppe cc @dlrobertson @oli-obk