-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.P-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
1.57.0 seems to have brought a pretty deep regression in compile times for deeply nested "decorator" types, such as futures' Stream
combinators.
This is a minimized version of kube-rs/kube#746.
Code
I tried this code:
use futures::{stream, StreamExt, TryStreamExt};
fn main() {
stream::empty::<Result<(), ()>>()
.inspect_ok(|_| ())
.inspect_ok(|_| ())
// .boxed()
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
// .boxed()
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
// .boxed()
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ());
}
In Rust 1.56.1, this builds in ~0.7s on my machine (excluding time spent compiling futures
and its dependencies).
In Rust 1.57.0 (and the latest nightly), this takes several minutes.
Curiously, boxing into a trait object (by uncommenting the .boxed()
calls) seems to act as a type checking boundary, and makes rustc 1.57.0 build it in ~0.55s.
Version it worked on
It most recently worked on: Rust 1.56.1
Version with regression
rustc --version --verbose
:
rustc 1.57.0 (f1edd0429 2021-11-29)
Backtrace
There was no crash, so there is no backtrace to report.
lfrancke, xmo-odoo, gemhung, wolverian, Dirbaio and 6 more
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.Issue: Problems and improvements with respect to compile times.P-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.