Skip to content

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

Closed as duplicate of#138596
@yotamofek

Description

@yotamofek

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions