Skip to content

thread 'rustc' panicked at 'no errors encountered even though delay_span_bug issued #93968

New issue

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

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

Already on GitHub? # to your account

Closed
drager opened this issue Feb 13, 2022 · 4 comments
Labels
C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@drager
Copy link

drager commented Feb 13, 2022

Code

use futures::lock::Mutex;
use std::sync::Arc;
use tokio::sync::mpsc::channel;

async fn _increase_id(increament_id: Arc<Mutex<u64>>) -> anyhow::Result<()> {
    let (_tx, mut rx) = channel(32);

    let read_increament_id = increament_id.clone();

    tokio::spawn(async move {
        while let Some(i) = rx.recv().await {
            read_increament_id.lock().await = i;
        }
    });

    Ok(())
}

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=e94948546902a54e2ba4e1fab9ec5eee

The compiler doesn't seem to crash on Beta nor on Nightly. However, I was thinking I should report it anyways, wasn't sure if you "accidentally" fixed it or was aware of the issue from another bug report and fixed it. I suppose the suggestion could also be improved. To make the code work I need to do the following: *read_increament_id.lock().await = i; which I suppose could have been suggested by the compiler?

Meta

rustc --version --verbose:

rustc 1.58.1 (db9d1b20b 2022-01-20)
binary: rustc
commit-hash: db9d1b20bba1968c1ec1fc49616d4742c1725b4b
commit-date: 2022-01-20
host: x86_64-unknown-linux-gnu
release: 1.58.1
LLVM version: 13.0.0

Error output

error: internal compiler error[[E0070]](https://doc.rust-lang.org/stable/error-index.html#E0070): invalid left-hand side of assignment
  [--> src/lib.rs:13:45
](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021#)   |
13 |             read_increament_id.lock().await = i;
   |             ------------------------------- ^
   |             |
   |             cannot assign to this expression
   |
help: you might have meant to use pattern destructuring
   |
12 |         while let let Some(i) = rx.recv().await {
   |               +++

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1188:13
note: [run with `RUST_BACKTRACE=1` environment variable to display a backtrace](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021#)

error: internal compiler error: unexpected panic

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.58.1 (db9d1b20b 2022-01-20) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib

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

query stack during panic:
end of query stack
@drager drager 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 Feb 13, 2022
@compiler-errors
Copy link
Member

This should be fixed on nightly.

@ehuss
Copy link
Contributor

ehuss commented Feb 13, 2022

Thanks for the report! This was fixed via #90521. I'm not sure if this particular situation was entirely intentional (the PR mentioned some ICE, but not this one). I'm not sure if it would make sense to add a test for this.

@compiler-errors
Copy link
Member

@ehuss, I actually fixed the weird diagnostic part of this in #93574, and added a similar test that covers this ICE too.

@drager, sorry, didn't see that you already tested on nightly. I had meant to investigate why the suggestion of adding a * to the LHS was being suppressed. I'll file an issue for that one.

@drager
Copy link
Author

drager commented Feb 14, 2022

@ehuss, I actually fixed the weird diagnostic part of this in #93574, and added a similar test that covers this ICE too.

@drager, sorry, didn't see that you already tested on nightly. I had meant to investigate why the suggestion of adding a * to the LHS was being suppressed. I'll file an issue for that one.

No worries! Awesome, thanks!

@JohnTitor JohnTitor removed the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Mar 3, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. 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

4 participants