Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
iduanyingjie opened this issue Jan 23, 2022 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@iduanyingjie
Copy link

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>

@iduanyingjie iduanyingjie added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 23, 2022
@iduanyingjie iduanyingjie changed the title 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>>> error: internal compiler error: compiler/rustc_mir_transform/src/generator.rs:755:13: Broken MIR: generator contains type ... Jan 23, 2022
@lqd
Copy link
Member

lqd commented Jan 23, 2022

Thanks for opening an issue!

This is a duplicate of #93161, is already fixed on master, but not available on nightly yet. It will be fixed in the next nightly which will contain #93165.

The 2 most recent nightlies have this issue:

  • "nightly-2022-01-23" on rustup: rustc 1.60.0-nightly (bfe156467 2022-01-22)
  • "nightly-2022-01-22" on rustup: rustc 1.60.0-nightly (17d29dcdc 2022-01-21).

I've checked that this example builds with the PR, (via rustup-toolchain-master of PR #93165's try artifacts d634ef421795e0140724aa9fddf8137b83e616c9) so I'll close this issue as a duplicate.

While there are other ICEs that are still not fixed, it is thus expected that this one will be. Please reopen this issue if tomorrow's nightly doesn't fix it though.

@lqd lqd closed this as completed Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants