Skip to content
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

Suspiciously long compile time when using traits #161

Closed
PolyMeilex opened this issue Aug 28, 2023 · 5 comments
Closed

Suspiciously long compile time when using traits #161

PolyMeilex opened this issue Aug 28, 2023 · 5 comments

Comments

@PolyMeilex
Copy link
Contributor

PolyMeilex commented Aug 28, 2023

I have code like this:

use ashpd::desktop::file_chooser::SaveFileRequest;
use std::future::Future;

struct SomeStruct;

pub trait SomeTrait {
    fn some_method(self) -> Box<dyn Future<Output = ()>>;
}

impl SomeTrait for SomeStruct {
    fn some_method(self) -> Box<dyn Future<Output = ()>> {
        Box::new(async move {
            SaveFileRequest::default().send().await.ok();
        })
    }
}

For no apparent reason, it takes 96s to compile in release mode.
This is the case only when trait is used, and .await is actually called.

This bug report would most likely be better fitted in rustc, but perhaps you have some ideas, so I'm reporting here.

rustc 1.72.0
cargo_timings.zip

related: PolyMeilex/rfd#126

@bilelmoussaoui
Copy link
Owner

Heh. I have no idea at all what is causing this, the library is also used in various GTK apps and haven't heard of any complaints about this very long compile time until now. I don't think we do anything suspicious in ashpd that would make compile time this slow. I would say a rustc bug report would be more actionable

@bilelmoussaoui
Copy link
Owner

If you end up opening a bug against rustc, please share the link here so i can ask people around and see if someone familiar with rustc could have a look at it

@bilelmoussaoui
Copy link
Owner

Apparently, this is rust-lang/rust#115297. Do you mind testing with 1.71?

@PolyMeilex
Copy link
Contributor Author

Yep, it seems plausible, it works in 1.71

@bilelmoussaoui
Copy link
Owner

Let us close this one then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants