rust/src
Dylan DPC 8499a8ba88
Rollup merge of - eholk:issue-57017, r=tmandry
[generator_interior] Be more precise with scopes of borrowed places

Previously the generator interior type checking analysis would use the nearest temporary scope as the scope of a borrowed value. This ends up being overly broad for cases such as:

```rust
fn status(_client_status: &Client) -> i16 {
    200
}

fn main() {
    let client = Client;
    let g = move || match status(&client) {
        _status => yield,
    };
    assert_send(g);
}
```

In this case, the borrow `&client` could be considered in scope for the entirety of the `match` expression, meaning it would be viewed as live across the `yield`, therefore making the generator not `Send`.

In most cases, we want to use the enclosing expression as the scope for a borrowed value which will be less than or equal to the nearest temporary scope. This PR changes the analysis to use the enclosing expression as the scope for most borrows, with the exception of borrowed RValues which are true temporary values that should have the temporary scope. There's one further exception where borrows of a copy such as happens in autoref cases also should be ignored despite being RValues.

Joint work with `@nikomatsakis`

Fixes 

r? `@tmandry`
2022-03-17 22:55:02 +01:00
..
bootstrap fix typos 2022-03-15 02:00:08 +01:00
ci Fix cmake build. 2022-03-17 11:43:38 -07:00
doc Update books 2022-03-15 20:42:35 -07:00
etc rustdoc-json-types: implementors -> implementations 2022-03-14 00:05:11 +00:00
librustdoc rustc_error: make ErrorReported impossible to construct 2022-03-16 10:35:24 -05:00
llvm-project@c8eccf626f Update LLVM submodule 2022-03-09 09:51:12 +01:00
rustdoc-json-types rustdoc-json-types: implementors -> implementations 2022-03-14 00:05:11 +00:00
test Rollup merge of - eholk:issue-57017, r=tmandry 2022-03-17 22:55:02 +01:00
tools rustc_error: make ErrorReported impossible to construct 2022-03-16 10:35:24 -05:00
README.md
stage0.json Bump bootstrap to 1.60 2022-02-25 08:00:24 -05:00
version Bump version to 1.61 2022-02-19 13:40:33 -05:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.