Shallow resolve ty and const vars to their root vars, attempt 2 - #158447
Shallow resolve ty and const vars to their root vars, attempt 2#158447jdonszelmann wants to merge 8 commits into
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
@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.
…try> Shallow resolve ty and const vars to their root vars, attempt 2
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (8ac0915): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking 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. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -0.8%, secondary 0.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.3%, secondary -2.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: 482.935s -> 488.862s (1.23%) |
|
@craterbot check |
|
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
|
🎉 Experiment
Footnotes
|
73928e3 to
f658490
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@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.
…try> Shallow resolve ty and const vars to their root vars, attempt 2
|
(note: with the added changes, both crates now compile :3) |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (aab3d83): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking 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. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 0.0%, secondary 6.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -3.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary 0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 488.694s -> 487.103s (-0.33%) |
| } | ||
| }) | ||
| .collect() | ||
| }); |
There was a problem hiding this comment.
can move this map right after the fudge_inference_if_okay instead of after the unwrap_or_default. The fact that it comes after is slightly confusing to me, even if it doesn't matter too much.
| .zip(formal_input_tys) | ||
| // if the expected input type is structurally equal to the formal input type, | ||
| // i.e. we've only changed some inference variables around, keep the formal | ||
| // input ty as the expected input ty. |
There was a problem hiding this comment.
should mention why we do this :>
|
Let's do it. This PR is a 2nd attempt at making eager resolving the default.
|
|
@jdonszelmann has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
|
A bit more detail about the regressions caused by resolving to root vars during fudging: pub struct Server<T>(*mut T);
impl<T> Server<T> {
fn new(_: T) -> Self
where
// Must be higher-ranked
T: Fn(&mut i32),
{
todo!()
}
}
fn main() {
// Must have a type annotation
let _: Server<_> = Server::new(|_| ());
}here we equate the return type We need the I think fudging is cursed enough for me to not really care too much about any remaining theoretical breakage here. I think the approach by @jdonszelmann in the last commit is good enough and after chatting about this issue for a while, we haven't been able to come up with a more principled solution here. Fudging is definitely something we do in rustc @rfcbot reviewed |
|
🔔 This is now entering its final comment period, as per the review above. 🔔 |
|
☔ The latest upstream changes (presumably #160238) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
View all comments
r? @lcnr
cc: @ShoyuVanilla
This is attempt 2. There is breakage, but how much? It may be worth it. @lcnr and I discovered today that this PR may have major perf impact on the new trait solver (in attempt 1 this wasn't tested in perf runs). In addition, fixing #158441 makes some tests 12x slower on the old solver, and this PR could mitigate that slowdown. The new solver already fixed this bug, hence we expect the new solver to become much faster with this PR.
Hence, we plan to do a crater and perf run to see just how bad it is.