-   Notifications  
You must be signed in to change notification settings  - Fork 13.9k
 
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-cycleIssue: A query cycle occurred while none was expectedIssue: A query cycle occurred while none was expectedS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.
Description
I tried this code:
use std::mem::MaybeUninit; fn main() { let fut = async {}; let cast: [MaybeUninit<u8>; 1] = unsafe { std::mem::transmute(fut) }; }I was playing around and expected this to succeed, instead, it resulted in this:
error[E0391]: cycle detected when type-checking `main` --> src/main.rs:3:1 | 3 | fn main() { | ^^^^^^^^^ | = note: ...which requires computing layout of `{async block@src/main.rs:4:15: 4:23}`... note: ...which requires optimizing MIR for `main::{closure#0}`... --> src/main.rs:4:15 | 4 | let fut = async {}; | ^^^^^^^^ note: ...which requires elaborating drops for `main::{closure#0}`... --> src/main.rs:4:15 | 4 | let fut = async {}; | ^^^^^^^^ note: ...which requires coroutine witness types for `main::{closure#0}`... --> src/main.rs:4:15 | 4 | let fut = async {}; | ^^^^^^^^ note: ...which requires promoting constants in MIR for `main::{closure#0}`... --> src/main.rs:4:15 | 4 | let fut = async {}; | ^^^^^^^^ note: ...which requires checking if `main::{closure#0}` contains FFI-unwind calls... --> src/main.rs:4:15 | 4 | let fut = async {}; | ^^^^^^^^ note: ...which requires building MIR for `main::{closure#0}`... --> src/main.rs:4:15 | 4 | let fut = async {}; | ^^^^^^^^ note: ...which requires match-checking `main::{closure#0}`... --> src/main.rs:4:15 | 4 | let fut = async {}; | ^^^^^^^^ note: ...which requires type-checking `main::{closure#0}`... --> src/main.rs:4:15 | 4 | let fut = async {}; | ^^^^^^^^ = note: ...which again requires type-checking `main`, completing the cycle = note: cycle used when running analysis passes on this crate = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more informationMeta
rustc --version --verbose:
rustc 1.80.0-nightly (87293c958 2024-05-08) binary: rustc commit-hash: 87293c9585a7fb2cc83ca9949ae79661d5d3c31a commit-date: 2024-05-08 host: x86_64-unknown-linux-gnu release: 1.80.0-nightly LLVM version: 18.1.4 
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-cycleIssue: A query cycle occurred while none was expectedIssue: A query cycle occurred while none was expectedS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.