forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#131802 - compiler-errors:fnonce-coverage, r=Zalathar Dont ICE when computing coverage of synthetic async closure body I'm not totally certain if this is *right*, but at least it doesn't ICE. The issue is that we end up generating two MIR bodies for each async closure, since the `FnOnce` and `Fn`/`FnMut` implementations have different borrowing behavior of their captured variables. They should ideally both contribute to the coverage, since those MIR bodies are (*to the user*) the same code and should have no behavioral differences. This PR at least suppresses the ICEs, and then I guess worst case we can fix this the right way later. r? Zalathar or re-roll Fixes rust-lang#131190
- Loading branch information
Showing
7 changed files
with
102 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
Function name: async_closure::call_once::<async_closure::main::{closure#0}> | ||
Raw bytes (9): 0x[01, 01, 00, 01, 01, 07, 01, 00, 2c] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Counter(0)) at (prev + 7, 1) to (start + 0, 44) | ||
Highest counter ID seen: c0 | ||
|
||
Function name: async_closure::call_once::<async_closure::main::{closure#0}>::{closure#0} | ||
Raw bytes (14): 0x[01, 01, 00, 02, 01, 07, 2c, 01, 0e, 05, 02, 01, 00, 02] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 2 | ||
- Code(Counter(0)) at (prev + 7, 44) to (start + 1, 14) | ||
- Code(Counter(1)) at (prev + 2, 1) to (start + 0, 2) | ||
Highest counter ID seen: c1 | ||
|
||
Function name: async_closure::main | ||
Raw bytes (14): 0x[01, 01, 00, 02, 01, 0b, 01, 01, 16, 01, 02, 05, 02, 02] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 2 | ||
- Code(Counter(0)) at (prev + 11, 1) to (start + 1, 22) | ||
- Code(Counter(0)) at (prev + 2, 5) to (start + 2, 2) | ||
Highest counter ID seen: c0 | ||
|
||
Function name: async_closure::main::{closure#0} | ||
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 23, 00, 24] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Counter(0)) at (prev + 12, 35) to (start + 0, 36) | ||
Highest counter ID seen: c0 | ||
|
||
Function name: async_closure::main::{closure#0}::{closure#0}::<i16> | ||
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 22, 00, 24] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Counter(0)) at (prev + 12, 34) to (start + 0, 36) | ||
Highest counter ID seen: c0 | ||
|
||
Function name: async_closure::main::{closure#0}::{closure#1}::<i32> | ||
Raw bytes (9): 0x[01, 01, 00, 01, 01, 0c, 23, 00, 24] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Counter(0)) at (prev + 12, 35) to (start + 0, 36) | ||
Highest counter ID seen: c0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
LL| |#![feature(async_closure)] | ||
LL| |//@ edition: 2021 | ||
LL| | | ||
LL| |//@ aux-build: executor.rs | ||
LL| |extern crate executor; | ||
LL| | | ||
LL| 1|async fn call_once(f: impl async FnOnce()) { | ||
LL| 1| f().await; | ||
LL| 1|} | ||
LL| | | ||
LL| 1|pub fn main() { | ||
LL| 2| let async_closure = async || {}; | ||
^1 | ||
------------------ | ||
| async_closure::main::{closure#0}: | ||
| LL| 1| let async_closure = async || {}; | ||
------------------ | ||
| async_closure::main::{closure#0}::{closure#1}::<i32>: | ||
| LL| 1| let async_closure = async || {}; | ||
------------------ | ||
LL| 1| executor::block_on(async_closure()); | ||
LL| 1| executor::block_on(call_once(async_closure)); | ||
LL| 1|} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#![feature(async_closure)] | ||
//@ edition: 2021 | ||
|
||
//@ aux-build: executor.rs | ||
extern crate executor; | ||
|
||
async fn call_once(f: impl async FnOnce()) { | ||
f().await; | ||
} | ||
|
||
pub fn main() { | ||
let async_closure = async || {}; | ||
executor::block_on(async_closure()); | ||
executor::block_on(call_once(async_closure)); | ||
} |
This file was deleted.
Oops, something went wrong.