-
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
move super_relate_consts
hack to normalize_param_env_or_error
#111623
Conversation
@bors try |
⌛ Trying commit 2badab9fab1aa42e42da93c8867b6dd3b939db43 with merge 5544613b027fde133f28359e75dec57e222e7ee4... |
@rust-timer queue |
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
Finished benchmarking commit (5544613b027fde133f28359e75dec57e222e7ee4): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 644.092s -> 644.08s (-0.00%) |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
This comment has been minimized.
This comment has been minimized.
Interestingly I thought this PR was a breaking change and would need a t-types FCP because you could hide a const arg behind an alias so this syntactic "evaluate anon consts" folder would miss it, but actually I think that's not possible because type aliases are broken in normalize_param_env_or_error and aren't normalized. I was thinking a repro like: trait Trait<T> {
type Assoc;
}
trait Other {
type Bar;
}
impl<T> Other for T {
type Bar = [T; 1 + 2];
}
fn foo<T, U>()
where
<U as Trait<[T; 1 + 2]>>::Assoc: Sized,
U: Trait<<T as Other>::Bar>,
{
} but this doesn't compile on stable so it's fine for it to not compile. I think this should be fine to land. No idea why the new solver test is failing though 🙃 |
fn main() { | ||
let mut xs = <[Foo; 1]>::default(); |
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.
attemtping to prove [Foo; 1]: Default
breaks under the new solver with this PR because the impl in std is [Foo; AnonConst]: Default
which we equate with [Foo; 1]: Default
. New solver does not normalize constants so AnonConst
does not unify with 1
even though evaluating the anon const would result in 1
. This test was accidentally relying on the super_relate_consts
hack which is a great example of why we need this PR lol
This PR is fine to land even with this, new solver is completely experimental and needs to have const normalization implemented at some point anyway.
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.
r=me nit preferably
@bors rollup=never (i want this to be easy to bisect to if it causes regressions) |
@bors r=compiler-errors |
☀️ Test successful - checks-actions |
Finished benchmarking commit (e29821f): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 642.897s -> 643.422s (0.08%) |
super_relate_consts
has as hack in it to work around the fact thatnormalize_param_env_or_error
is broken. When relating two constants we attempt to evaluate them (aka normalize them). This is not an issue in any way specific to const generics, type aliases also have the same issue as demonstrated in this code.Since the hack in
super_relate_consts
only exists to makenormalize_param_env_or_error
emit less errors move it tonormalize_param_env_or_error
. This makessuper_relate_consts
act more like the normal plain structural equality its supposed to and should help ensure that the hack doesnt accidentally affect other situations.r? @compiler-errors