Stream: wg-async-foundations

Topic: #66312


csmoe (Nov 13 2019 at 08:16, on Zulip):
trait Test<T> {
    fn is_some(self: T);
}

async fn f() {
    let x = Some(2);
    if x.is_some() {
        println!("Some");
    }
}

RUSTC_LOG=rustc_typeck=debug rustc +dev issue-66312.rs --edtion 2018 triggers another earlier cycle error, prevents me get more debug info:

error[E0391]: cycle detected when processing `f::{{opaque}}#0`
 --> ../v.rs:6:14
  |
6 | async fn f() {
  |              ^
  |
note: ...which requires processing `f::{{opaque}}#0`...
 --> ../v.rs:6:14
  |
6 | async fn f() {
  |              ^
note: ...which requires processing `f::{{opaque}}#0`...
 --> ../v.rs:6:14
  |
6 | async fn f() {
  |              ^
  = note: ...which again requires processing `f::{{opaque}}#0`, completing the cycle
note: cycle used when processing `f`
 --> ../v.rs:6:1
  |
6 | async fn f() {
  | ^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0391`.

but a narrowed path RUSTC_LOG=rustc_typeck::check=debug works as expected.

csmoe (Nov 13 2019 at 08:19, on Zulip):

oh, seems same as this issue https://github.com/rust-lang/rust/issues/61577

nikomatsakis (Nov 19 2019 at 18:49, on Zulip):

@csmoe can you say a bit more about what's going wrong?

csmoe (Nov 19 2019 at 18:54, on Zulip):

csmoe can you say a bit more about what's going wrong?

trait Test<T> {
   fn is_some(self: T)
}

is malformed, should be rejected with invalid self parameter type: T by wf_check as the non-async case.
but nothing about wfcheck was dumped for async case inside the debug log

csmoe (Dec 14 2019 at 17:45, on Zulip):

@tmandry I noticed that rustc branched out to construct the typeck_tables_of generator while querying its type_of, then the unexpected method lookup(befor Test trait was wf_checked) happened inside check_fn

csmoe (Dec 14 2019 at 18:14, on Zulip):

sorry for this abstract updating. I know nothing about typecking of generator, so could not debug on a more detailed level, like what was wrong inside fn check_fn or somewhere else.

tmandry (Dec 14 2019 at 20:12, on Zulip):

@csmoe can you collect a backtrace of the error using -Z treat-err-as-bug? I think it might be helpful for us to stare at that for a bit.

tmandry (Dec 14 2019 at 20:13, on Zulip):

it should contain the full query stack at that point too

csmoe (Dec 16 2019 at 03:13, on Zulip):

@tmandry here it is:

error[E0308]: mismatched types
 --> v.rs:8:8
  |
8 |     if x.is_some() {
  |        ^^^^^^^^^^^ expected `bool`, found `()`

thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', src/librustc_errors/lib.rs:921:13
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:84
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1025
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:193
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:475
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::emit_diagnostic
  14: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit_unless
  15: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
  16: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  17: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  18: rustc_typeck::check::FnCtxt::check_block_with_expected
  19: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  20: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  21: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  22: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  23: rustc_typeck::check::FnCtxt::check_block_with_expected
  24: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  25: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  26: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  27: rustc_typeck::check::check_fn
  28: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure
  29: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  30: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  31: rustc_typeck::check::FnCtxt::check_argument_types
  32: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  33: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  34: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
  35: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
  36: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
  37: rustc_typeck::check::check_fn
  38: rustc::ty::context::tls::with_context::{{closure}}
  39: rustc_typeck::check::typeck_tables_of
  40: rustc::ty::query::__query_compute::typeck_tables_of
  41: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  42: rustc::dep_graph::graph::DepGraph::with_task_impl
  43: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  44: rustc::ty::query::__query_compute::typeck_tables_of
  45: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  46: rustc::dep_graph::graph::DepGraph::with_task_impl
  47: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  48: rustc_typeck::collect::type_of
  49: rustc::ty::query::__query_compute::type_of
  50: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
  51: rustc::dep_graph::graph::DepGraph::with_task_impl
  52: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  53: rustc::hir::intravisit::walk_expr
  54: rustc::hir::intravisit::Visitor::visit_fn
  55: rustc::hir::intravisit::walk_item
  56: <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item
  57: rustc::hir::map::Map::visit_item_likes_in_module
  58: rustc_typeck::collect::collect_mod_item_types
  59: rustc::ty::query::__query_compute::collect_mod_item_types
  60: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
  61: rustc::dep_graph::graph::DepGraph::with_task_impl
  62: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  63: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  64: rustc_typeck::check_crate::{{closure}}::{{closure}}
  65: rustc::util::common::time
  66: rustc_typeck::check_crate
  67: rustc_interface::passes::analysis
  68: rustc::ty::query::__query_compute::analysis
  69: rustc::dep_graph::graph::DepGraph::with_task_impl
  70: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  71: rustc::ty::context::tls::enter_global
  72: rustc_interface::interface::run_compiler_in_existing_thread_pool
  73: std::thread::local::LocalKey<T>::with
  74: scoped_tls::ScopedKey<T>::set
  75: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.41.0-nightly (3eeb8d4f2 2019-12-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z treat-err-as-bug

query stack during panic:
#0 [typeck_tables_of] processing `async_f`
#1 [typeck_tables_of] processing `async_f::{{closure}}#0`
#2 [type_of] processing `async_f::{{closure}}#0`
#3 [collect_mod_item_types] collecting item types in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
Last update: Jan 28 2020 at 08:05UTC