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

internal compiler error: no type for local variable #70594

Closed
dwrensha opened this issue Mar 31, 2020 · 3 comments · Fixed by #70640
Closed

internal compiler error: no type for local variable #70594

dwrensha opened this issue Mar 31, 2020 · 3 comments · Fixed by #70640
Assignees
Labels
A-async-await Area: Async & Await A-diagnostics Area: Messages for errors, warnings, and lints I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

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`.
@dwrensha
Copy link
Contributor Author

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

@dwrensha dwrensha changed the title internal compiler error: no type for local variable local internal compiler error: no type for local variable Mar 31, 2020
@Centril
Copy link
Contributor

Centril commented Mar 31, 2020

Simplified:

#![feature(const_loop)]

async fn fun() {
    [1; ().await];
}

and cc @jonas-schievink (#69033)

@Centril Centril added A-diagnostics Area: Messages for errors, warnings, and lints 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. A-async-await Area: Async & Await I-nominated P-medium Medium priority labels Mar 31, 2020
@jonas-schievink jonas-schievink self-assigned this Mar 31, 2020
@jonas-schievink
Copy link
Contributor

jonas-schievink commented Mar 31, 2020

Fix up at #70640

@jonas-schievink jonas-schievink added the regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. label Mar 31, 2020
Centril added a commit to Centril/rust that referenced this issue Apr 1, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Apr 3, 2020
@bors bors closed this as completed in a928f64 Apr 3, 2020
@tmandry tmandry moved this to Done in wg-async work Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await A-diagnostics Area: Messages for errors, warnings, and lints I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants