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

rustc_mir_build: reorder bindings #90925

Merged
merged 1 commit into from
Nov 16, 2021

Commits on Nov 15, 2021

  1. rustc_mir_build: reorder bindings

    No functional changes intended.
    
    I'm playing around with building compiler components using nightly rust
    (2021-11-02) in a non-standard way. I encountered the following error while
    trying to build rustc_mir_build:
    
    ```
    error[E0597]: `wildcard` does not live long enough
        --> rust/src/nightly/compiler/rustc_mir_build/src/build/matches/mod.rs:1767:82
         |
    1767 |         let mut otherwise_candidate = Candidate::new(expr_place_builder.clone(), &wildcard, false);
         |                                                                                  ^^^^^^^^^ borrowed value does not live long enough
    ...
    1799 |     }
         |     -
         |     |
         |     `wildcard` dropped here while still borrowed
         |     borrow might be used here, when `guard_candidate` is dropped and runs the destructor for type `Candidate<'_, '_>`
         |
         = note: values in a scope are dropped in the opposite order they are defined
    ```
    
    I believe this flags an issue that may become an error in the future.
    Swapping the order of `wildcard` and `guard_candidate` resolves it.
    krasimirgg committed Nov 15, 2021
    Configuration menu
    Copy the full SHA
    c1c2013 View commit details
    Browse the repository at this point in the history