-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Slow coherence checking and type checking. #138828
Comments
Bisection: While this code has always been slow, it took an extra ~30% comptime hit in nightly-2024-02-15.
Unfortunately that nightly has several type-level PRs landing, making it hard to pinpoint regression precisely, but #118882 sounds most likely cargo-bisect-rustc outputRegression in nightly-2024-02-15 converted 2024-02-14 to a84bb95
Edit: and also another ~20% hit several weeks prior in
cargo-bisect-rustc out
@rustbot label: +T-compiler +T-types +A-coherence +I-compiletime -needs-triage +A-trait-system |
Smaller: use core::{marker::PhantomData, ops::Deref};
struct DerefOnly<T: ?Sized>(PhantomData<T>);
impl<T: Deref> Deref for DerefOnly<T> {
type Target = DerefOnly<T::Target>;
fn deref(&self) -> &Self::Target {
&DerefOnly(PhantomData)
}
}
struct Empty;
impl DerefOnly<Empty> {
fn whatever(&self) {}
}
// copy-paste the function a couple of times if your pc is too fast to notice
fn foo_1() {
DerefOnly(PhantomData::<
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Empty,
>).whatever();
}
fn foo_2() {
DerefOnly(PhantomData::<
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Empty,
>).whatever();
}
fn main() {} What's happening is we create a |
I was working on creating a crate and encountered some
unexpectedlylong compile times.I don't have a minimal reproduction, but I have expanded my macros, and copied the code into a playground.
It occurs on all channels. It is still pretty bad even with the parallel front-end enabled. According to time-passes, the biggest culprits were coherence checking and type checking.
My use case is clearly atypical, so I will understand if you consider this frivolous and close it. (Although, when I searched to see if my issue had already been reported, I did notice submitted situations that were arguably even less likely to be encountered by anyone.)
The text was updated successfully, but these errors were encountered: