Skip to content

internal compiler error: no type for local variable #70594

Closed
@dwrensha

Description

I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

async fn nothing() -> usize { 2 }
async fn f() {
    [1; nothing().await];
}
fn main(){}
$ rustc --edition=2018 main.rs
error[E0728]: `await` is only allowed inside `async` functions and blocks
 --> main.rs:3:9
  |
2 | async fn f() {
  |          - this is not `async`
3 |     [1; nothing().await];
  |         ^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks

error[E0744]: `.await` is not allowed in a `const`
 --> main.rs:3:9
  |
3 |     [1; nothing().await];
  |         ^^^^^^^^^^^^^^^

error[E0658]: `loop` is not allowed in a `const`
 --> main.rs:3:9
  |
3 |     [1; nothing().await];
  |         ^^^^^^^^^^^^^^^
  |
  = note: see issue #52000 <https://github.com/rust-lang/rust/issues/52000> for more information
  = help: add `#![feature(const_loop)]` to the crate attributes to enable

error[E0744]: `.await` is not allowed in a `const`
 --> main.rs:3:9
  |
3 |     [1; nothing().await];
  |         ^^^^^^^^^^^^^^^

error: internal compiler error: src/librustc_typeck/check/mod.rs:2982: no type for local variable local {
    [1; nothing().await];
} (hir_id=HirId { owner: DefId(0:6 ~ main[317d]::f[0]), local_id: 2 })
 --> main.rs:3:9
  |
3 |     [1; nothing().await];
  |         ^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<Any>', /rustc/2113659479a82ea69633b23ef710b58ab127755e/src/libstd/macros.rs:13:23
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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (211365947 2020-03-30) running on x86_64-unknown-linux-gnu

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0658, E0728, E0744.
For more information about an error, try `rustc --explain E0658`.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

A-async-awaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

  • Status

    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions