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

[ICE] async fn vs lint order #61452

Closed
james-darkfox opened this issue Jun 2, 2019 · 3 comments

Comments

Projects
None yet
6 participants
@james-darkfox
Copy link
Contributor

commented Jun 2, 2019

playground
ICE when some lints fail on an async-fn. Make the xs mutable and no ICE.

#![feature(async_await)]

// x should be mutable
pub async fn f(x: Option<usize>) {
    x.take();
}

// without the above failure, this fails as expected
pub async fn g(x: usize) {
    x += 1;
}
   Compiling playground v0.0.1 (/playground)
warning: variable `a` is assigned to, but never used
 --> src/lib.rs:8:16
  |
8 | pub async fn g(a: usize) {
  |                ^
  |
  = note: #[warn(unused_variables)] on by default
  = note: consider using `_a` instead

warning: value assigned to `a` is never read
 --> src/lib.rs:9:5
  |
9 |     a += 1;
  |     ^
  |
  = note: #[warn(unused_assignments)] on by default
  = help: maybe it is overwritten before being read?

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 `f::{{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 (03ee55bb1 2019-06-01) running on x86_64-unknown-linux-gnu

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

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.
@lzutao

This comment was marked as resolved.

Copy link
Contributor

commented Jun 2, 2019

@rustbot modify labels: A-async-await C-bug I-ICE

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

commented Jun 4, 2019

Discussed in async-await meeting. Marking as blocking as this looks pretty bad for the user experience. Hopefully an easy fix. Presumably in the desugared form we are somehow failing because the mut keyword is missing or something like that.

@davidtwco

This comment has been minimized.

Copy link
Member

commented Jun 4, 2019

@rustbot claim

davidtwco added a commit to davidtwco/rust that referenced this issue Jun 7, 2019

Centril added a commit to Centril/rust that referenced this issue Jun 7, 2019

Rollup merge of rust-lang#61627 - davidtwco:ice-async-fn-lint, r=alex…
…crichton

Add regression test for rust-lang#61452.

Fixes rust-lang#61452.

Turns out this ICE had already been fixed, so this PR only adds a regression test.

bors added a commit that referenced this issue Jun 7, 2019

Auto merge of #61630 - Centril:rollup-2u0y4h9, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #61130 (Add std::mem::take as suggested in #61129)
 - #61597 (Bump dirs, rand and redox_users)
 - #61615 (syntax: Treat error literals in more principled way)
 - #61616 (parser: Remove `Deref` impl from `Parser`)
 - #61621 (Clarify when we run steps with ONLY_HOSTS)
 - #61625 (Rename remaining "Eval" to "Interp")
 - #61627 (Add regression test for #61452.)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this issue Jun 7, 2019

Rollup merge of rust-lang#61627 - davidtwco:ice-async-fn-lint, r=alex…
…crichton

Add regression test for rust-lang#61452.

Fixes rust-lang#61452.

Turns out this ICE had already been fixed, so this PR only adds a regression test.

bors added a commit that referenced this issue Jun 7, 2019

Auto merge of #61637 - Centril:rollup-41hiuip, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #61597 (Bump dirs, rand and redox_users)
 - #61615 (syntax: Treat error literals in more principled way)
 - #61616 (parser: Remove `Deref` impl from `Parser`)
 - #61621 (Clarify when we run steps with ONLY_HOSTS)
 - #61625 (Rename remaining "Eval" to "Interp")
 - #61627 (Add regression test for #61452.)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this issue Jun 7, 2019

Rollup merge of rust-lang#61627 - davidtwco:ice-async-fn-lint, r=alex…
…crichton

Add regression test for rust-lang#61452.

Fixes rust-lang#61452.

Turns out this ICE had already been fixed, so this PR only adds a regression test.

bors added a commit that referenced this issue Jun 8, 2019

Auto merge of #61644 - Centril:rollup-tjx5kx9, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #61223 (Document tuple's Ord behavior as sequential)
 - #61597 (Bump dirs, rand and redox_users)
 - #61615 (syntax: Treat error literals in more principled way)
 - #61616 (parser: Remove `Deref` impl from `Parser`)
 - #61621 (Clarify when we run steps with ONLY_HOSTS)
 - #61627 (Add regression test for #61452.)
 - #61641 (Revert "Make LocalAnalizer visitor iterate instead of recurse")

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this issue Jun 8, 2019

Rollup merge of rust-lang#61627 - davidtwco:ice-async-fn-lint, r=alex…
…crichton

Add regression test for rust-lang#61452.

Fixes rust-lang#61452.

Turns out this ICE had already been fixed, so this PR only adds a regression test.

bors added a commit that referenced this issue Jun 8, 2019

Auto merge of #61649 - Centril:rollup-b4nx9k9, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #61223 (Document tuple's Ord behavior as sequential)
 - #61615 (syntax: Treat error literals in more principled way)
 - #61616 (parser: Remove `Deref` impl from `Parser`)
 - #61621 (Clarify when we run steps with ONLY_HOSTS)
 - #61627 (Add regression test for #61452.)
 - #61641 (Revert "Make LocalAnalizer visitor iterate instead of recurse")
 - #61647 (Use stable wrappers in f32/f64::signum)

Failed merges:

r? @ghost

@bors bors closed this in #61627 Jun 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.