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

regression: parameter type may not live long enough #123280

Closed
Mark-Simulacrum opened this issue Mar 31, 2024 · 8 comments
Closed

regression: parameter type may not live long enough #123280

Mark-Simulacrum opened this issue Mar 31, 2024 · 8 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

[INFO] [stdout] error[E0310]: the parameter type `EWA` may not live long enough
[INFO] [stdout]    --> src/worker_pool.rs:109:1
[INFO] [stdout]     |
[INFO] [stdout] 109 | / {
[INFO] [stdout] 110 | |     let mut handle_vec = Vec::with_capacity(default_worker);
[INFO] [stdout] 111 | |
[INFO] [stdout] 112 | |     let mut worker_sender_vec = Vec::with_capacity(default_worker);
[INFO] [stdout] ...   |
[INFO] [stdout] 128 | |     }
[INFO] [stdout] 129 | | }
[INFO] [stdout]     | | ^
[INFO] [stdout]     | | |
[INFO] [stdout]     | |_the parameter type `EWA` must be valid for the static lifetime...
[INFO] [stdout]     |   ...so that the type `EWA` will meet its required lifetime bounds
[INFO] [stdout]     |
[INFO] [stdout] help: consider adding an explicit lifetime bound
[INFO] [stdout]     |
[INFO] [stdout] 108 |     EWA: Clone + 'static,
[INFO] [stdout]     |                +++++++++

Smells similar to #123279, but maybe not.

@Mark-Simulacrum Mark-Simulacrum added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Mar 31, 2024
@Mark-Simulacrum Mark-Simulacrum added this to the 1.78.0 milestone Mar 31, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 31, 2024
@compiler-errors
Copy link
Member

searched toolchains b6d2d84 through 7d3702e


Regression in 09bc67b


Attempting to search unrolled perf builds
ERROR: couldn't find perf build comment

searched nightlies: from nightly-2024-02-01 to nightly-2024-04-01
regressed nightly: nightly-2024-03-07
searched commit range: b6d2d84...7d3702e
regressed commit: 09bc67b

bisected with cargo-bisect-rustc v0.6.8

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2024-02-01 

@compiler-errors
Copy link
Member

I can't tell upon a quick search whether this was an expected regression from #121679/#115008. cc @lcnr @aliemjay

@aliemjay
Copy link
Member

aliemjay commented Apr 1, 2024

This is expected. This is the culprit bound:
https://github.com/shishanyue/RW-RJR-Server/blob/0343d1021fbbd3282e29377491b531d5a7bc98eb/src/worker_pool.rs#L23

Minimized:

struct WorkerPool<D: 'static>(Option<D>);

fn new_worker_pool<D>() -> impl Sized {
    async {
        WorkerPool(None::<D>)
    }
}

What is annoying though is the error span which points to the entire async block because, when inside the async block, we draw implied bounds from its output type, allowing us to assume D: 'static, which then fails to be proven in the parent fn. See #115173 for a partial fix.

@aliemjay
Copy link
Member

aliemjay commented Apr 1, 2024

Ironically, this is accepted now and since forever because the rvalue never get the chance to be checked for well-formedness:

struct WorkerPool<D: 'static>(Option<D>);

fn new_worker_pool<D>() {
    let _ = async {
        WorkerPool(None::<D>)
    };
}

@riking
Copy link

riking commented Apr 1, 2024

Upstream fix is shishanyue/RW-RJR-Server#13

@lcnr
Copy link
Contributor

lcnr commented Apr 2, 2024

closing as expected and we have provided a PR to fix the issue

@lcnr lcnr closed this as completed Apr 2, 2024
@apiraino
Copy link
Contributor

apiraino commented Apr 2, 2024

@aliemjay @lcnr anything here that should be noted in the release notes?

@lcnr
Copy link
Contributor

lcnr commented Apr 2, 2024

added a comment to #121679 (comment)

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 3, 2024
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants