Repository navigation
Move hir::Params from Body of functions to FnDecl - #163758
JonathanBrouwer wants to merge 16 commits into
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
💔 Test for be17f02 failed: CI. Failed jobs:
|
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (b0e36da): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary 0.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 3.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 490.122s -> 491.234s (0.23%) |
This comment has been minimized.
This comment has been minimized.
10e9505 to
67a82db
Compare
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This was blocked on the MCP being accepted, it now is :) |
|
@nnethercote would you like to take a look at this PR? |
There was a problem hiding this comment.
Diagnostics for this code will change, and not in a better way
struct NeedsCopy<T: Copy>(T);
extern "C" {
fn f(x: i32, ...) -> NeedsCopy<String>;
}Previously it gave this:
error[E0277]: the trait bound `String: Copy` is not satisfied
--> test.rs:3:26
|
3 | fn f(x: i32, ...) -> NeedsCopy<String>;
| ^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
now it gives this:
error[E0277]: the trait bound `String: Copy` is not satisfied
--> test.rs:3:18
|
3 | fn f(x: i32, ...) -> NeedsCopy<String>;
| ^^^ the trait `Copy` is not implemented for `String`
|
Fixed it + added a regression test. |
This commit is by far the biggest one, and achieves the goal of this PR but leaves the code ugly in a lot of places. The next commits will be a lot of cleanup.
The field is now a duplicate of `Param::ty`'s span
This makes the span of parameters point to the entire parameter, for functions without bodies. This matches the behaviour of functions with bodies.
|
I believe I've addressed all feedback, thanks! |
|
I will need few more days to click green button, thanks for working on it and fixing everything so fast! |
|
Take your time, a few days is already pretty fast for such a big PR :) |
|
|
||
| let mut ty = self.lower_ty(¶m.ty, itctx); | ||
| // So code using the HIR can assume `CVarArgs` are always the last parameter | ||
| if matches!(ty.kind, hir::TyKind::CVarArgs) && param_idx != decl.inputs.len() - 1 { |
There was a problem hiding this comment.
I think this is already checked in the AST validation pass?
Or is there a reason to check it again?
There was a problem hiding this comment.
This is indeed already checked in de AST pass, note that this only emits a delayed bug.
There are quite a few places in the HIR that assume that if there is a CVarArgs argument, it is at the end. The easiest way to make these places work as expected, is to change any CVarArgs that is not at the end, into a Err variant
View all comments
This PR implements MCP rust-lang/compiler-team#1044.
It is split up into commits, each commit passes tests, and reviewing commit by commit is therefore heavily recommended. Each commit contains a description. The first commit makes the big change, and the other commits are cleanup.
This PR causes a minor performance regression, specifically on the
libcandexternsbenchmark:#163758 (comment)
This is caused by that parameters on foreign functions are now assigned HIR IDs and
Params are allocated for them, so slightly more work is needed.Both of these crates are basically only foreign functions, so not very representative of an average rust program.
r? @Kivooeo