Closed
Description
I tried this code with -Z thir-unsafeck
:
// from src/test/ui/impl-trait/recursive-impl-trait-type-indirect.rs
fn closure_ref_capture() -> impl Sized {
let x = closure_ref_capture();
move || { &x; }
}
fn main() {}
I expected to see this happen: It errors with cannot resolve opaque type
and a warning
Instead, this happened: There is also a query loop:
error[E0391]: cycle detected when computing type of `closure_ref_capture::{opaque#0}`
--> freeze2.rs:2:29
|
2 | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^
|
note: ...which requires borrow-checking `closure_ref_capture`...
--> freeze2.rs:2:1
|
2 | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing `closure_ref_capture`...
--> freeze2.rs:2:1
|
2 | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing MIR for `closure_ref_capture`...
--> freeze2.rs:2:1
|
2 | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `closure_ref_capture`...
--> freeze2.rs:2:1
|
2 | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `closure_ref_capture`...
--> freeze2.rs:2:1
|
2 | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `closure_ref_capture`...
--> freeze2.rs:4:16
|
4 | move || { &x; }
| ^
= note: ...which requires computing whether `impl Sized` is freeze...
= note: ...which requires evaluating trait selection obligation `impl Sized: std::marker::Freeze`...
= note: ...which again requires computing type of `closure_ref_capture::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
--> freeze2.rs:2:1
|
2 | fn closure_ref_capture() -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This also happens when using the new unsafety checker with ui/generator/layout-error.rs
, ui/impl-trait/recursive-impl-trait-type-indirect.rs
, ui/impl-trait/unsafety-checking-cycle.rs
, and ui/type-alias-impl-traiissue-52843-closure-constrain.rs
.
Meta
rustc --version --verbose
:
rustc 1.56.0-dev