diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-08-30 07:18:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-30 07:18:11 +0200 |
| commit | 2128efd87fcbd165e0885512c0f5d830092bb1a4 (patch) | |
| tree | 45c8040f91e41c687a6be35256ae7fb3539625f5 /compiler/rustc_const_eval/src | |
| parent | 23f86255ef7cf044c50348d7fa937ca63f94896b (diff) | |
| parent | 136f0579d8a6cfacbdbfbac4c6a10b8447fcdf9e (diff) | |
| download | rust-2128efd87fcbd165e0885512c0f5d830092bb1a4.tar.gz rust-2128efd87fcbd165e0885512c0f5d830092bb1a4.zip | |
Rollup merge of #115313 - gurry:issue-114918-cycle-detected, r=compiler-errors
Make `get_return_block()` return `Some` only for HIR nodes in body
Fixes #114918
The issue occurred while compiling the following input:
```rust
fn uwu() -> [(); { () }] {
loop {}
}
```
It was caused by the code below trying to suggest a missing return type which resulted in a const eval cycle: https://github.com/rust-lang/rust/blob/1bd043098e05839afb557bd7a2858cb09a4054ca/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs#L68-L75
The root cause was `get_return_block()` returning an `Fn` node for a node in the return type (i.e. the second `()` in the return type `[(); { () }]` of the input) although it is supposed to do so only for nodes that lie in the body of the function and return `None` otherwise (at least as per my understanding).
The PR fixes the issue by fixing this behaviour of `get_return_block()`.
Diffstat (limited to 'compiler/rustc_const_eval/src')
0 files changed, 0 insertions, 0 deletions
