diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2020-07-24 10:01:36 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-24 10:01:36 -0700 |
| commit | ceaef731a9eb7156766ffb74f2bd6bec761adfc3 (patch) | |
| tree | c3b835475d3b28c8e4e938e4dbb999508f32a130 /library/std/src/sys/unix/stack_overflow.rs | |
| parent | a4024ba4eb7c064c8cb9510da7f1e9b24109d6d1 (diff) | |
| parent | 8a776ee2390cb99f915cda22393ce4e297208396 (diff) | |
| download | rust-ceaef731a9eb7156766ffb74f2bd6bec761adfc3.tar.gz rust-ceaef731a9eb7156766ffb74f2bd6bec761adfc3.zip | |
Rollup merge of #74661 - SNCPlay42:lifetime-names-refactor, r=estebank
Refactor `region_name`: add `RegionNameHighlight` This PR does not change any diagnostics itself, rather it enables further code changes, but I would like to get approval for the refactoring first before making use of it. In `rustc_mir::borrow_check::diagnostics::region_name`, there is code that allows for, when giving a synthesized name like `'1` to an anonymous lifetime, pointing at e.g. the exact '`&`' that introduces the lifetime. This PR decouples that code from the specific case of arguments, adding a new enum `RegionNameHighlight`, enabling future changes to use it in other places. This allows: * We could change the other `AnonRegionFrom*` variants to use `RegionNameHighlight` to precisely point at where lifetimes are introduced in other locations when they have type annotations, e.g. a closure return `|...| -> &i32`. * Because of how async functions are lowered this affects async functions as well, see #74072 * for #74597, we could add a second, optional `RegionNameHighlight` to the `AnonRegionFromArgument` variant that highlights a lifetime in the return type of a function when, due to elision, this is the same as the argument lifetime. * in https://github.com/rust-lang/rust/issues/74497#issuecomment-6606229707 I noticed that a diagnostic was trying to introduce a lifetime `'2` in the opaque type `impl std::future::Future`. The code for the case of arguments has [code to handle cases like this](https://github.com/rust-lang/rust/blob/bbebe7351fcd29af1eb9a35e315369b15887ea09/src/librustc_mir/borrow_check/diagnostics/region_name.rs#L365) but not the others. This refactoring would allow the same code path to handle this. * It might be appropriate to add another variant of `RegionNameHighlight` to say something like `lifetime '1 appears in the opaque type impl std::future::Future`. These are quite a few changes so I thought I would make sure the refactoring is OK before I start making changes that rely on it. :)
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
