Skip to content

error: internal compiler error: compiler/rustc_mir_transform/src/generator.rs:755:13: Broken MIR: generator contains type ... #93238

Closed
@iduanyingjie

Description

@iduanyingjie

Code

https://github.com/tyrchen/geektime-rust/tree/master/05_thumbor

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (17d29dcdc 2022-01-21)
binary: rustc
commit-hash: 17d29dcdce9b9e838635eb0adefd9b8b1588410b
commit-date: 2022-01-21
host: aarch64-apple-darwin
release: 1.60.0-nightly
LLVM version: 13.0.0

Error output

error: internal compiler error: compiler/rustc_mir_transform/src/generator.rs:755:13: Broken MIR: generator contains type &mut tokio::sync::MutexGuard<LruCache<u64, bytes::Bytes>> in MIR, but typeck only knows about {ResumeTy, DefaultHasher, u64, &tokio::sync::Mutex<LruCache<u64, bytes::Bytes>>, Arc<tokio::sync::Mutex<LruCache<u64, bytes::Bytes>>>, impl Future<Output = tokio::sync::MutexGuard<LruCache<u64, bytes::Bytes>>>, (), tokio::sync::MutexGuard<LruCache<u64, bytes::Bytes>>, &u64, std::option::Option<&bytes::Bytes>, &str, impl Future<Output = Result<reqwest::Response, reqwest::Error>>, reqwest::Response, impl Future<Output = Result<bytes::Bytes, reqwest::Error>>} and [&str, std::sync::Arc<tokio::sync::Mutex<lru::LruCache<u64, bytes::Bytes>>>]
   --> 05_thumbor/src/server2.rs:83:67
    |
83  |   async fn retrieve_image(url: &str, cache: Cache) -> Result<Bytes> {
    |  ___________________________________________________________________^
84  | |     let mut hasher = DefaultHasher::new();
85  | |     url.hash(&mut hasher);
86  | |     let key = hasher.finish();
...   |
103 | |     Ok(data)
104 | | }
    | |_^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/17d29dcdce9b9e838635eb0adefd9b8b1588410b/compiler/rustc_errors/src/lib.rs:1115:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.60.0-nightly (17d29dcdc 2022-01-21) running on aarch64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] optimizing MIR for `retrieve_image::{closure#0}::{closure#0}`
#1 [mir_shims] generating MIR shim for `core::ptr::drop_in_place`
end of query stack
error: could not compile `thumbor`
warning: build failed, waiting for other jobs to finish...
error: internal compiler error: compiler/rustc_mir_transform/src/generator.rs:755:13: Broken MIR: generator contains type &mut tokio::sync::MutexGuard<LruCache<u64, bytes::Bytes>> in MIR, but typeck only knows about {ResumeTy, DefaultHasher, u64, &tokio::sync::Mutex<LruCache<u64, bytes::Bytes>>, Arc<tokio::sync::Mutex<LruCache<u64, bytes::Bytes>>>, impl Future<Output = tokio::sync::MutexGuard<LruCache<u64, bytes::Bytes>>>, (), tokio::sync::MutexGuard<LruCache<u64, bytes::Bytes>>, &u64, std::option::Option<&bytes::Bytes>, &str, impl Future<Output = Result<reqwest::Response, reqwest::Error>>, reqwest::Response, impl Future<Output = Result<bytes::Bytes, reqwest::Error>>} and [&str, std::sync::Arc<tokio::sync::Mutex<lru::LruCache<u64, bytes::Bytes>>>]
   --> 05_thumbor/src/main.rs:104:67
    |
104 |   async fn retrieve_image(url: &str, cache: Cache) -> Result<Bytes> {
    |  ___________________________________________________________________^
105 | |     let mut hasher = DefaultHasher::new();
106 | |     url.hash(&mut hasher);
107 | |     let key = hasher.finish();
...   |
124 | |     Ok(data)
125 | | }
    | |_^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/17d29dcdce9b9e838635eb0adefd9b8b1588410b/compiler/rustc_errors/src/lib.rs:1115:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.60.0-nightly (17d29dcdc 2022-01-21) running on aarch64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] optimizing MIR for `retrieve_image::{closure#0}::{closure#0}`
#1 [mir_shims] generating MIR shim for `core::ptr::drop_in_place`
end of query stack
error: build failed
Backtrace

<backtrace>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions