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

ICE with async_await + extern crate + invalid import #54289

Closed
Pauan opened this Issue Sep 17, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@Pauan
Copy link
Member

Pauan commented Sep 17, 2018

Cargo.toml:

[package]
name = "rust-async-ice"
edition = "2018"
version = "0.1.0"
authors = ["Pauan <pcxunlimited@gmail.com>"]

[dependencies]
foo = "0.0.0"

main.rs:

#![feature(async_await, await_macro, futures_api)]

extern crate foo;

// The Bar type doesn't exist in foo
use foo::Bar;

async fn future_main() -> Result<(), Bar> {
    Ok(())
}

fn main() {}

When running cargo build --verbose I get this ICE:

> cargo build --verbose
   Compiling foo v0.0.0
     Running `rustc --crate-name foo C:\Users\Pauan\.cargo\registry\src\github.com-1ecc6299db9ec823\foo-0.0.0\src\lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=b5174b0adc406c09 -C extra-filename=-b5174b0adc406c09 --out-dir "C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\deps" -L "dependency=C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\deps" --cap-lints allow`
   Compiling rust-async-ice v0.1.0 (C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice)
     Running `rustc --edition=2018 --crate-name rust_async_ice src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=48b1954b9da344d9 -C extra-filename=-48b1954b9da344d9 --out-dir "C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\deps" -C "incremental=C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\incremental" -L "dependency=C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\deps" --extern "foo=C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\deps\libfoo-b5174b0adc406c09.rlib"`
error: internal compiler error: cat_expr Errd
  --> src\main.rs:8:43
   |
8  |   async fn future_main() -> Result<(), Bar> {
   |  ___________________________________________^
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: cat_expr Errd
  --> src\main.rs:8:43
   |
8  |   async fn future_main() -> Result<(), Bar> {
   |  ___________________________________________^
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: cat_expr Errd
 --> src\main.rs:9:5
  |
9 |     Ok(())
  |     ^^^^^^

error: internal compiler error: cat_expr Errd
 --> src\main.rs:9:5
  |
9 |     Ok(())
  |     ^^

error: internal compiler error: QualifyAndPromoteConstants: Mir had errors
  --> src\main.rs:8:43
   |
8  |   async fn future_main() -> Result<(), Bar> {
   |  ___________________________________________^
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: broken MIR in DefId(0/1:10 ~ rust_async_ice[6258]::future_main[0]::{{closure}}[0]) ("return type"): bad type std::result::Result<(), [type error]>
  --> src\main.rs:8:43
   |
8  |   async fn future_main() -> Result<(), Bar> {
   |  ___________________________________________^
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: broken MIR in DefId(0/1:10 ~ rust_async_ice[6258]::future_main[0]::{{closure}}[0]) (LocalDecl { mutability: Mut, is_user_variable: None, internal: false, ty: std::result::Result<(), [type error]>, user_ty: None, name: None, source_info: SourceInfo { span: src\main.rs:8:43: 10:2, scope: scope[0] }, visibility_scope: scope[0] }): bad type std::result::Result<(), [type error]>
  --> src\main.rs:8:43
   |
8  |   async fn future_main() -> Result<(), Bar> {
   |  ___________________________________________^
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: broken MIR in DefId(0/1:10 ~ rust_async_ice[6258]::future_main[0]::{{closure}}[0]) (LocalDecl { mutability: Mut, is_user_variable: None, internal: false, ty: [static generator@src\main.rs:8:43: 10:2 {}], user_ty: None, name: None, source_info: SourceInfo { span: src\main.rs:8:43: 10:2, scope: scope[0] }, visibility_scope: scope[0] }): bad type [static generator@src\main.rs:8:43: 10:2 {}]
  --> src\main.rs:8:43
   |
8  |   async fn future_main() -> Result<(), Bar> {
   |  ___________________________________________^
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: QualifyAndPromoteConstants: Mir had errors
  --> src\main.rs:8:1
   |
8  | / async fn future_main() -> Result<(), Bar> {
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: broken MIR in DefId(0/0:5 ~ rust_async_ice[6258]::future_main[0]) ("return type"): bad type impl std::future::Future
  --> src\main.rs:8:1
   |
8  | / async fn future_main() -> Result<(), Bar> {
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: broken MIR in DefId(0/0:5 ~ rust_async_ice[6258]::future_main[0]) (LocalDecl { mutability: Mut, is_user_variable: None, internal: false, ty: impl std::future::Future, user_ty: None, name: None, source_info: SourceInfo { span: src\main.rs:8:1: 10:2, scope: scope[0] }, visibility_scope: scope[0] }): bad type impl std::future::Future
  --> src\main.rs:8:1
   |
8  | / async fn future_main() -> Result<(), Bar> {
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: broken MIR in DefId(0/0:5 ~ rust_async_ice[6258]::future_main[0]) (LocalDecl { mutability: Mut, is_user_variable: None, internal: false, ty: [static generator@src\main.rs:8:43: 10:2 {}], user_ty: None, name: None, source_info: SourceInfo { span: src\main.rs:8:43: 10:2, scope: scope[0] }, visibility_scope: scope[0] }): bad type [static generator@src\main.rs:8:43: 10:2 {}]
  --> src\main.rs:8:1
   |
8  | / async fn future_main() -> Result<(), Bar> {
9  | |     Ok(())
10 | | }
   | |_^

error: internal compiler error: errors selecting obligation during MIR typeck: [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<impl std::future::Future as std::marker::Sized>)),depth=0),Ambiguity), FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<impl std::future::Future as std::future::Future>)),depth=0),Ambiguity)]

thread 'main' panicked at 'no errors encountered even though `delay_span_bug` issued', librustc_errors\lib.rs:321:17
stack backtrace:
   0:     0x7ffa7b0e0a92 - <std::sys::windows::args::Args as core::ops::drop::Drop>::drop::h69dc4a396c83fbea
   1:     0x7ffa7b0c9f2f - std::io::error::Error::get_ref::h3b34149d3fcc474b
   2:     0x7ffa7b0c8348 - std::panicking::take_hook::h45b4c991720c128b
   3:     0x7ffa7b0c8001 - std::panicking::take_hook::h45b4c991720c128b
   4:     0x7ffa5b885175 - <rustc::ty::sty::Binder<rustc::ty::ProjectionPredicate<'tcx>> as rustc::ty::ToPredicate<'tcx>>::to_predicate::h2e6434fb2079e88c
   5:     0x7ffa7b0c8b71 - std::panicking::rust_panic_with_hook::h1ea4d5bad9b899f1
   6:     0x7ffa78e69067 - <rustc_errors::diagnostic::SubDiagnostic as core::fmt::Debug>::fmt::hbf1fd867e36c5c5b
   7:     0x7ffa78e62ae1 - <rustc_errors::Handler as core::ops::drop::Drop>::drop::ha7e5ef5f688ed509
   8:     0x7ffa881adc0c - rustc_driver::target_features::add_configuration::h7dfe8e915c1650c9
   9:     0x7ffa881b424f - rustc_driver::target_features::add_configuration::h7dfe8e915c1650c9
  10:     0x7ffa881b9acf - rustc_driver::target_features::add_configuration::h7dfe8e915c1650c9
  11:     0x7ffa881bc426 - rustc_driver::target_features::add_configuration::h7dfe8e915c1650c9
  12:     0x7ffa7b0fa471 - _rust_maybe_catch_panic
  13:     0x7ffa882542b2 - rustc_driver::profile::dump::had22fd3d322ef3c6
  14:     0x7ffa88266a7d - rustc_driver::main::h5823241893b36e24
  15:     0x7ff6834d1055 - <unknown>
  16:     0x7ffa7b0c8516 - std::panicking::update_panic_count::h2bc483fd32260cb4
  17:     0x7ffa7b0fa471 - _rust_maybe_catch_panic
  18:     0x7ffa7b0da342 - std::rt::lang_start_internal::hf2484ca2ac9591b0
  19:     0x7ff6834d1049 - <unknown>
  20:     0x7ff6834d1298 - <unknown>
  21:     0x7ffac2fd3033 - BaseThreadInitThunk
  22:     0x7ffac3431460 - RtlUserThreadStart
query stack during panic:
end of query stack

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/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.30.0-nightly (2ab3eba30 2018-09-14) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

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

error: Could not compile `rust-async-ice`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name rust_async_ice src\main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=48b1954b9da344d9 -C extra-filename=-48b1954b9da344d9 --out-dir "C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\deps" -C "incremental=C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\incremental" -L "dependency=C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\deps" --extern "foo=C:\Users\Pauan\Shared Folders\NixOS\rust-async-ice\target\debug\deps\libfoo-b5174b0adc406c09.rlib"` (exit code: 101)

Meta

rustc --version --verbose:

rustc 1.30.0-nightly (2ab3eba30 2018-09-14)
binary: rustc
commit-hash: 2ab3eba30741652ba538bc2fc2bba9d81a5c84c6
commit-date: 2018-09-14
host: x86_64-pc-windows-msvc
release: 1.30.0-nightly
LLVM version: 8.0
@eddyb

This comment has been minimized.

Copy link
Member

eddyb commented Sep 17, 2018

Try updating, this looks like #54253, which was fixed in yesterday's nightly.

@Pauan

This comment has been minimized.

Copy link
Member Author

Pauan commented Sep 17, 2018

@eddyb Yup! Nice work, with rustc 1.30.0-nightly (cb6d2dfa8 2018-09-16) I get this (correct) error:

error[E0432]: unresolved import `foo::Bar`
 --> src\main.rs:6:5
  |
6 | use foo::Bar;
  |     ^^^^^^^^ no `Bar` in the root

@Pauan Pauan closed this Sep 17, 2018

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