-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
-Zthir-unsafeckUnstable option: THIR unsafeckUnstable option: THIR unsafeckC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
I tried this code with -Z thir-unsafeck=on
:
fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
fn main() {}
I expected to see this happen: It compiles, as it does under the MIR checker
Instead, this happened:
error[E0391]: cycle detected when simplifying constant for the type system `bad::{constant#0}`
--> y.rs:1:45
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires simplifying constant for the type system `bad::{constant#0}`...
--> y.rs:1:45
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `bad::{constant#0}`...
--> y.rs:1:45
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const checking `bad::{constant#0}`...
--> y.rs:1:45
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing MIR for `bad::{constant#0}`...
--> y.rs:1:45
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `bad::{constant#0}`...
--> y.rs:1:45
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `bad::{constant#0}::{closure#0}`...
--> y.rs:1:47
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^
note: ...which requires building MIR for `bad::{constant#0}::{closure#0}`...
--> y.rs:1:47
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^
note: ...which requires unsafety-checking `bad::{constant#0}::{closure#0}`...
--> y.rs:1:47
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^
note: ...which requires unsafety-checking `bad`...
--> y.rs:1:1
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building THIR for `bad`...
--> y.rs:1:1
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `bad`...
--> y.rs:1:1
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires simplifying constant for the type system `bad::{constant#0}`, completing the cycle
note: cycle used when checking that `bad` is well-formed
--> y.rs:1:1
|
1 | fn bad<T>() -> Box<dyn Iterator<Item = [(); { |x: u32| { x }; 4 }]>> { todo!() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Meta
rustc --version --verbose
:
$ rustc +local --version --verbose
rustc 1.55.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.55.0-dev
LLVM version: 12.0.1
Metadata
Metadata
Assignees
Labels
-Zthir-unsafeckUnstable option: THIR unsafeckUnstable option: THIR unsafeckC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.