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 in nightly when reversing a vector inside a async fn #61187

Closed
sindreij opened this issue May 25, 2019 · 2 comments · Fixed by #61413
Closed

Internal compiler error in nightly when reversing a vector inside a async fn #61187

sindreij opened this issue May 25, 2019 · 2 comments · Fixed by #61413
Assignees
Labels
A-async-await Area: Async & Await A-borrow-checker Area: The borrow checker 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.

Comments

@sindreij
Copy link
Contributor

Got an internal compiler error when reversing a vector inside a async fn

I tried this code:

#![feature(async_await)]

fn main() {
}

async fn response(data: Vec<u8>) {
    data.reverse();
}

(Playground)

This happened:

$ RUST_BACKTRACE=1 cargo check
    Checking rust-error-testing-unfold-option-unwrap v0.1.0 (/home/sindre/src/rust/rust-error-testing-unfold-option-unwrap)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   6: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:381
   7: rust_begin_unwind
             at src/libstd/panicking.rs:308
   8: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
   9: core::panicking::panic
             at src/libcore/panicking.rs:49
  10: rustc_mir::borrow_check::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::report_mutability_error
  11: rustc_mir::borrow_check::MirBorrowckCtxt::access_place
  12: <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::DataflowResultsConsumer>::visit_statement_entry
  13: rustc_mir::borrow_check::do_mir_borrowck
  14: rustc::ty::context::GlobalCtxt::enter_local
  15: rustc_mir::borrow_check::mir_borrowck
  16: rustc::ty::query::__query_compute::mir_borrowck
  17: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
  18: rustc::dep_graph::graph::DepGraph::with_task_impl
  19: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  20: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
  21: rustc::util::common::time
  22: rustc_interface::passes::analysis
  23: rustc::ty::query::__query_compute::analysis
  24: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::analysis>::compute
  25: rustc::dep_graph::graph::DepGraph::with_task_impl
  26: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  27: rustc::ty::context::tls::enter_global
  28: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  29: rustc_interface::passes::create_global_ctxt::{{closure}}
  30: rustc_interface::interface::run_compiler_in_existing_thread_pool
  31: std::thread::local::LocalKey<T>::with
  32: scoped_tls::ScopedKey<T>::set
  33: syntax::with_globals
query stack during panic:
#0 [mir_borrowck] processing `response::{{closure}}#0`
#1 [analysis] running analysis passes on this crate
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.36.0-nightly (dec4c5201 2019-05-24) running on x86_64-unknown-linux-gnu

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-error-testing-unfold-option-unwrap`.

To learn more, run the command again with --verbose.

Meta

$ rustc --version --verbose
rustc 1.36.0-nightly (dec4c5201 2019-05-24)
binary: rustc
commit-hash: dec4c5201f88efbc3020b04ba96a5ee2c3b6cfcd
commit-date: 2019-05-24
host: x86_64-unknown-linux-gnu
release: 1.36.0-nightly
LLVM version: 8.0
@jonas-schievink jonas-schievink added A-async-await Area: Async & Await A-borrow-checker Area: The borrow checker 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 May 25, 2019
@estebank
Copy link
Contributor

estebank commented May 25, 2019

Caused by access_place_desc being None and later unwraping it:

let access_place_desc = self.describe_place(access_place);
debug!("report_mutability_error: access_place_desc={:?}", access_place_desc);

Log output:

DEBUG 2019-05-25T19:33:10Z: rustc_mir::borrow_check::mutability_errors: report_mutability_error(access_place=_2, span=file6.rs:7:5: 7:9, the_place_err=_2, error_access=MutableBorrow, location=bb0[6],)
DEBUG 2019-05-25T19:33:10Z: rustc_mir::borrow_check::mutability_errors: report_mutability_error: access_place_desc=None

@estebank estebank self-assigned this May 25, 2019
Centril added a commit to Centril/rust that referenced this issue May 29, 2019
Do not ICE on missing access place description during mutability error reporting

Fix rust-lang#61187.
Centril added a commit to Centril/rust that referenced this issue May 29, 2019
Do not ICE on missing access place description during mutability error reporting

Fix rust-lang#61187.
Centril added a commit to Centril/rust that referenced this issue May 29, 2019
Do not ICE on missing access place description during mutability error reporting

Fix rust-lang#61187.
Centril added a commit to Centril/rust that referenced this issue May 29, 2019
Do not ICE on missing access place description during mutability error reporting

Fix rust-lang#61187.
Centril added a commit to Centril/rust that referenced this issue May 29, 2019
Do not ICE on missing access place description during mutability error reporting

Fix rust-lang#61187.
@bddap
Copy link

bddap commented May 31, 2019

Another minimal example of the issue.

#![feature(async_await)]

struct Session;

impl Session {
    fn do_thing(&mut self) {
        unimplemented!()
    }
}

async fn frob(session: Session) {
    session.do_thing()
}

fn main() {}

(Playground)

   Compiling playground v0.0.1 (/playground)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.25/src/backtrace/libunwind.rs:97
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.25/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:197
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   8: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:381
   9: rust_begin_unwind
             at src/libstd/panicking.rs:308
  10: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  11: core::panicking::panic
             at src/libcore/panicking.rs:49
  12: rustc_mir::borrow_check::mutability_errors::<impl rustc_mir::borrow_check::MirBorrowckCtxt>::report_mutability_error
  13: rustc_mir::borrow_check::MirBorrowckCtxt::access_place
  14: <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::DataflowResultsConsumer>::visit_statement_entry
  15: rustc_mir::borrow_check::do_mir_borrowck
  16: rustc::ty::context::GlobalCtxt::enter_local
  17: rustc_mir::borrow_check::mir_borrowck
  18: rustc::ty::query::__query_compute::mir_borrowck
  19: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
  20: rustc::dep_graph::graph::DepGraph::with_task_impl
  21: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  22: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
  23: rustc::util::common::time
  24: rustc_interface::passes::analysis
  25: rustc::ty::query::__query_compute::analysis
  26: rustc::dep_graph::graph::DepGraph::with_task_impl
  27: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  28: rustc::ty::context::tls::enter_global
  29: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  30: rustc_interface::passes::create_global_ctxt::{{closure}}
  31: rustc_interface::interface::run_compiler_in_existing_thread_pool
  32: std::thread::local::LocalKey<T>::with
  33: scoped_tls::ScopedKey<T>::set
  34: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [mir_borrowck] processing `frob::{{closure}}#0`
#1 [analysis] running analysis passes on this crate
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.37.0-nightly (3ade426ed 2019-05-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

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

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

Centril added a commit to Centril/rust that referenced this issue Jun 4, 2019
…-sane-way, r=eddyb

Re-implement async fn drop order lowering

This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.

Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from rust-lang#61276 (though 447e336 might end up staying in this PR).

As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192).

r? @eddyb
cc @cramertj
Centril added a commit to Centril/rust that referenced this issue Jun 4, 2019
…-sane-way, r=eddyb

Re-implement async fn drop order lowering

This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.

Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from rust-lang#61276 (though 447e336 might end up staying in this PR).

As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192).

r? @eddyb
cc @cramertj
Centril added a commit to Centril/rust that referenced this issue Jun 4, 2019
…-sane-way, r=eddyb

Re-implement async fn drop order lowering

This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.

Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from rust-lang#61276 (though 447e336 might end up staying in this PR).

As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192).

r? @eddyb
cc @cramertj
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-borrow-checker Area: The borrow checker 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.
Projects
None yet
4 participants