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

Const promotion regression: "temporary value dropped while borrowed" #138600

Closed
yotamofek opened this issue Mar 17, 2025 · 2 comments
Closed

Const promotion regression: "temporary value dropped while borrowed" #138600

yotamofek opened this issue Mar 17, 2025 · 2 comments
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.

Comments

@yotamofek
Copy link
Contributor

Code

I tried to compile the tests for tokio-stream with the latest nightly (cargo build --tests -p tokio-stream), and got a "temporary value dropped while borrowed" error in two instances, e.g.:

#[tokio::test]
async fn next_many_zero() {
    let mut stream_map: StreamMap<usize, UsizeStream> = StreamMap::new();

    stream_map.insert(0, Box::pin(pending()) as UsizeStream);

    let n = poll_fn(|cx| pin!(stream_map.next_many(&mut vec![], 0)).poll(cx)).await;

    assert_eq!(n, 0);
}

Version it worked on

Regression in rust-lang-ci@6d75903
The PR introducing the regression in this rollup is #138162: Update the standard library to Rust 2024
cc @ehuss

searched nightlies: from nightly-2025-03-12 to nightly-2025-03-14
regressed nightly: nightly-2025-03-14
searched commit range: 249cb84...cbfdf0b
regressed commit: a2aba05

bisected with cargo-bisect-rustc v0.6.9

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

cargo bisect-rustc -- build --tests -p tokio-stream 

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

@yotamofek yotamofek added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Mar 17, 2025
@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. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-untriaged Untriaged performance or correctness regression. labels Mar 17, 2025
@theemathas
Copy link
Contributor

&mut references are not eligible for const promotion. This issue is a duplicate of #138596

@yotamofek
Copy link
Contributor Author

yotamofek commented Mar 17, 2025

Oh, at least I was a closed second haha.
BTW, other tests that have &mut vec![] compile successfully, seems to only happen inside a closure inside the pin! macro.

@apiraino apiraino removed 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 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly.
Projects
None yet
Development

No branches or pull requests

4 participants