Skip to content

1.95 beta regression: "temporary value dropped while borrowed" #153850

Closed

Description

@theemathas

Regression found by the 1.95 beta crater run.

[INFO] [stdout] error[E0716]: temporary value dropped while borrowed
[INFO] [stdout]    --> src/lib.rs:229:34
[INFO] [stdout]     |
[INFO] [stdout] 227 | // ...                   dbg!(
[INFO] [stdout] 228 | || ...                       x.value().score / x.value().playouts as f32,
[INFO] [stdout] 229 | || ...                       &x.id(),
[INFO] [stdout]     | ||                            ^^^^^^ creates a temporary value which is freed while still in use
[INFO] [stdout] 230 | || ...                       x.value().playouts,
[INFO] [stdout] 231 | || ...                   )
[INFO] [stdout]     | ||_______________________- temporary value is freed at the end of this statement
[INFO] [stdout] 232 | |  ...                   .0,
[INFO] [stdout]     | |_________________________- borrow later used here
[INFO] [stdout]     |
[INFO] [stdout]     = note: consider using a `let` binding to create a longer lived value
[INFO] [stdout] 
[INFO] [stdout] 
[INFO] [stderr] error: could not compile `monte_carlo` (lib) due to 1 previous error; 2 warnings emitted
[INFO] [stdout] For more information about this error, try `rustc --explain E0716`.

https://crater-reports.s3.amazonaws.com/beta-1.95-3/1.95.0-beta.3/reg/monte_carlo-0.1.1/log.txt

Activity

  1. added
    C-bugCategory: This is a bug.
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Mar 14, 2026
  2. added
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 14, 2026
  3. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 14, 2026
  4. theemathas commented on Mar 14, 2026

    @theemathas
    ContributorAuthor

    Minimal reproducer:

    fn one() -> i32 { 1 }
    
    fn main() {
        dbg!(0, &one()).0;
    }
    Error output on beta
    error[E0716]: temporary value dropped while borrowed
     --> src/main.rs:4:14
      |
    4 |     dbg!(0, &one()).0;
      |     ---------^^^^^---
      |     |        |
      |     |        creates a temporary value which is freed while still in use
      |     temporary value is freed at the end of this statement
      |     borrow later used here
      |
    help: consider using a `let` binding to create a longer lived value
      |
    4 ~     let binding = one();
    5 ~     dbg!(0, &binding).0;
      |
    
    For more information about this error, try `rustc --explain E0716`.
    
  5. added
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Mar 14, 2026
  6. theemathas commented on Mar 14, 2026

    @theemathas
    ContributorAuthor

    Bisection result:

    ********************************************************************************
    Regression in 4d38622e8bec00a9001264c4e9f4723fceca23cb
    ********************************************************************************
    
    Attempting to search unrolled perf builds
    Found commits ["a35802ec", "5d0accfe", "339ebba7", "cf4dd004", "51885a1e", "008d732c", "39ee306a", "299c6ea3", "87aa422a", "280da588"]
    installing a35802ecf86de711020db33066f7968a9b1fd2c5
    uninstalling a35802ecf86de711020db33066f7968a9b1fd2c5
    installing 5d0accfebb901c0dc047ae0601dd31537af58908
    uninstalling 5d0accfebb901c0dc047ae0601dd31537af58908
    installing 339ebba77c0b673e31199d9792986008df623218
    uninstalling 339ebba77c0b673e31199d9792986008df623218
    installing cf4dd004bd807b783e6aeb2280dd40377935e04c
    uninstalling cf4dd004bd807b783e6aeb2280dd40377935e04c
    installing 51885a1eb22206f02abc1d457f338d943ccfc31d
    uninstalling 51885a1eb22206f02abc1d457f338d943ccfc31d
    installing 008d732cc606bd816317791b6bb258e2a7351471
    uninstalling 008d732cc606bd816317791b6bb258e2a7351471
    installing 39ee306a949b0f8eb7233e874f5cade6a399ed3c
    uninstalling 39ee306a949b0f8eb7233e874f5cade6a399ed3c
    installing 299c6ea372b0a1716cc5faab39c5530183cb2b15
    uninstalling 299c6ea372b0a1716cc5faab39c5530183cb2b15
    installing 87aa422a4eefb11c97a8cb99a49bdf0375e833a3
    uninstalling 87aa422a4eefb11c97a8cb99a49bdf0375e833a3
    installing 280da5887cb785378f7377d39726abc804049c9d
    uninstalling 280da5887cb785378f7377d39726abc804049c9d
    ERROR: none of the toolchains satisfied the predicate
    

    Presumably regressed in #149869. cc @joboet @Mark-Simulacrum

  7. added
    S-has-bisectionStatus: A bisection has been found for this issue
    and removed
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 14, 2026
  8. 21 remaining items

  9. added a commit that references this issue on Mar 30, 2026
    f806c33
  10. added a commit that references this issue on Apr 2, 2026
    4efda7a
  11. cuviper commented on Apr 4, 2026

    @cuviper
    Member

    Should be all set with #154725, 1.95.0-beta.7. The minimal reproducer passes with this beta on the playground.

  12. added 2 commits that reference this issue on Apr 9, 2026
  13. added a commit that references this issue on May 19, 2026
  14. added 2 commits that reference this issue on Aug 17, 2026
    8f3c650
    1f738b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-destructorsArea: Destructors (`Drop`, …)A-fmtArea: `core::fmt`A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-temporary-lifetime-extensionArea: temporary lifetime extensionC-bugCategory: This is a bug.P-highHigh priorityS-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-libsRelevant to the library team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions