Skip to content

internal compiler error: no type for local variable #70594

Closed

Description

@dwrensha

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

  1. dwrensha commented on Mar 31, 2020

    @dwrensha
    ContributorAuthor

    Report from cargo bisect-rustc:

    searched nightlies: from nightly-2020-03-09 to nightly-2020-03-31
    regressed nightly: nightly-2020-03-22
    searched commits: from 1057dc9 to 38114ff
    regressed commit: 5f13820

  2. changed the title [-]internal compiler error: no type for local variable local[/-] [+]internal compiler error: no type for local variable[/+] on Mar 31, 2020
  3. Centril commented on Mar 31, 2020

    @Centril
    Contributor

    Simplified:

    #![feature(const_loop)]
    
    async fn fun() {
        [1; ().await];
    }

    and cc @jonas-schievink (#69033)

  4. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    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.
    on Mar 31, 2020
  5. jonas-schievink commented on Mar 31, 2020

    @jonas-schievink
    Contributor

    Fix up at #70640

  6. added a commit that references this issue on Apr 1, 2020
  7. added a commit that references this issue on Apr 3, 2020
  8. added a commit that references this issue on Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions