Rust: ICE: tuple_fields called on non-tuple: async fn with unknown macro

Created on 15 Oct 2020  ·  15Comments  ·  Source: rust-lang/rust

Code

edit: I reduced some code of a different occurrence and came up with

async fn ice() -> Box<dyn std::error::Error> {
    macro!()
}

Meta

I bisected the regression to 93deabc / #77873

Error output

    Checking b v0.1.0 (/tmp/b)
error: expected identifier, found `!`
 --> src/main.rs:2:10
  |
2 |     macro!()
  |          ^ expected identifier

error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:2124:18: tuple_fields called on non-tuple

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (dd7fc54eb 2020-10-15) running on x86_64-unknown-linux-gnu

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

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

error: aborting due to 2 previous errors

error: could not compile `b`


Backtrace

    Checking b v0.1.0 (/tmp/b)
error: expected identifier, found `!`
 --> src/main.rs:2:10
  |
2 |     macro!()
  |          ^ expected identifier

error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:2124:18: tuple_fields called on non-tuple

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
stack backtrace:
   0:     0x7f49f1175410 - std::backtrace_rs::backtrace::libunwind::trace::h622bab51c72c4e69
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
   1:     0x7f49f1175410 - std::backtrace_rs::backtrace::trace_unsynchronized::h7e820b882ebd41ee
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f49f1175410 - std::sys_common::backtrace::_print_fmt::h64d46258114db92f
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/sys_common/backtrace.rs:79:5
   3:     0x7f49f1175410 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h47111d0c1b5f0da5
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/sys_common/backtrace.rs:58:22
   4:     0x7f49f11e3dfc - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/core/src/fmt/mod.rs:1076:17
   5:     0x7f49f1167222 - std::io::Write::write_fmt::h4604516fed3e5731
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/io/mod.rs:1516:15
   6:     0x7f49f117a20d - std::sys_common::backtrace::_print::h785e7a78d5ef272c
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/sys_common/backtrace.rs:61:5
   7:     0x7f49f117a20d - std::sys_common::backtrace::print::h108047ac5c4555d5
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/sys_common/backtrace.rs:48:9
   8:     0x7f49f117a20d - std::panicking::default_hook::{{closure}}::h1d0c271f0d087ebf
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/panicking.rs:208:50
   9:     0x7f49f1179eb8 - std::panicking::default_hook::h692753e26f11b7b7
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/panicking.rs:227:9
  10:     0x7f49f1a35988 - rustc_driver::report_ice::h94e1b9f0f92bafae
  11:     0x7f49f117aa56 - std::panicking::rust_panic_with_hook::h74ddc20305301cd9
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/panicking.rs:581:17
  12:     0x7f49f4a95f1d - std::panicking::begin_panic::{{closure}}::h85e1045241b297e6
  13:     0x7f49f4a95de6 - std::sys_common::backtrace::__rust_end_short_backtrace::hc1e06fcbf256e2bc
  14:     0x7f49f4a95ebf - std::panicking::begin_panic::hbf55614acdd54cc1
  15:     0x7f49f4ad3cd0 - rustc_errors::HandlerInner::bug::h94cdcb0a3cb4ed51
  16:     0x7f49f4ad27b0 - rustc_errors::Handler::bug::h5a35a89fdbe858b5
  17:     0x7f49f455c764 - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::hfd7f04857d4b343a
  18:     0x7f49f455ae1b - rustc_middle::ty::context::tls::with_opt::{{closure}}::h6b81e40ab1abbfe1
  19:     0x7f49f455a792 - rustc_middle::ty::context::tls::with_opt::ha250bfbbf5e53d29
  20:     0x7f49f455c689 - rustc_middle::util::bug::opt_span_bug_fmt::hd6110b1943f63aa9
  21:     0x7f49f455c5fe - rustc_middle::util::bug::bug_fmt::ha3b1755cbfb7beb5
  22:     0x7f49f480f226 - rustc_middle::ty::sty::<impl rustc_middle::ty::TyS>::tuple_fields::h3bc2e8f3395e2c47
  23:     0x7f49f269ab52 - <rustc_trait_selection::opaque_types::ConstrainOpaqueTypeRegionVisitor<OP> as rustc_middle::ty::fold::TypeVisitor>::visit_ty::h53bfa3ff6dffd709
  24:     0x7f49f2692822 - rustc_middle::ty::fold::TypeFoldable::visit_with::h6b95d821ec46d32c
  25:     0x7f49f277827d - rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with::haf6a9f0cb5ca13c2
  26:     0x7f49f269ac9b - <rustc_trait_selection::opaque_types::ConstrainOpaqueTypeRegionVisitor<OP> as rustc_middle::ty::fold::TypeVisitor>::visit_ty::h53bfa3ff6dffd709
  27:     0x7f49f276579c - <rustc_infer::infer::InferCtxt as rustc_trait_selection::opaque_types::InferCtxtExt>::constrain_opaque_types::h084e425ed6bba58b
  28:     0x7f49f26f777e - rustc_typeck::check::regionck::RegionCtxt::visit_fn_body::h1137626c7d585e3c
  29:     0x7f49f267f9d0 - rustc_hir::intravisit::walk_expr::h9dd97655837af726
  30:     0x7f49f26f8c8d - <rustc_typeck::check::regionck::RegionCtxt as rustc_hir::intravisit::Visitor>::visit_expr::h9b4f78baf6746cc0
  31:     0x7f49f267f77d - rustc_hir::intravisit::walk_expr::h9dd97655837af726
  32:     0x7f49f26f8c8d - <rustc_typeck::check::regionck::RegionCtxt as rustc_hir::intravisit::Visitor>::visit_expr::h9b4f78baf6746cc0
  33:     0x7f49f26f772d - rustc_typeck::check::regionck::RegionCtxt::visit_fn_body::h1137626c7d585e3c
  34:     0x7f49f24e6454 - rustc_typeck::check::regionck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::regionck_fn::h28860b4ddfe15a40
  35:     0x7f49f2743013 - rustc_infer::infer::InferCtxtBuilder::enter::h478370153a5628ca
  36:     0x7f49f27f576d - rustc_typeck::check::typeck::hfc75fba7d10c080a
  37:     0x7f49f4859568 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h625c205064841b32
  38:     0x7f49f4999922 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hd5d7e4be807854ff
  39:     0x7f49f457d5a4 - rustc_data_structures::stack::ensure_sufficient_stack::hf0717cfa324b58a6
  40:     0x7f49f4381e32 - rustc_query_system::query::plumbing::get_query_impl::hda910c4b131c45f9
  41:     0x7f49f4650c27 - rustc_middle::ty::context::TyCtxt::typeck_opt_const_arg::h4499a05eb9ea36c5
  42:     0x7f49f2cc6378 - rustc_mir_build::thir::cx::Cx::new::h74b89b479cffd7fd
  43:     0x7f49f2c8a238 - rustc_infer::infer::InferCtxtBuilder::enter::hfe01275367c35f94
  44:     0x7f49f2bc7053 - rustc_mir_build::build::mir_built::h614ae3973841342e
  45:     0x7f49f3292c11 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_built>::compute::hffb2094c003bb703
  46:     0x7f49f304cb65 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h9c20e3f215a95c0b
  47:     0x7f49f30e1f03 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h48d83b53377cf2a4
  48:     0x7f49f2d6a9b1 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h7c679e4ccd6303cb
  49:     0x7f49f2f171d4 - rustc_query_system::query::plumbing::get_query_impl::h6e6e1ee3c4581973
  50:     0x7f49f32d842f - rustc_mir::transform::check_unsafety::unsafety_check_result::hcfe9711888c89ead
  51:     0x7f49f3298cf5 - core::ops::function::FnOnce::call_once::hd09548458b941eee
  52:     0x7f49f323d0de - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::unsafety_check_result>::compute::h78ac1dfa46e35df8
  53:     0x7f49f304e2c8 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hb896adda9b6da41d
  54:     0x7f49f30dd71a - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h25d1ae9814596de3
  55:     0x7f49f2d7b5a1 - rustc_data_structures::stack::ensure_sufficient_stack::hd7bf926590dab0d9
  56:     0x7f49f2f29ea2 - rustc_query_system::query::plumbing::get_query_impl::h853be6621a53bed1
  57:     0x7f49f2f697dd - rustc_query_system::query::plumbing::ensure_query_impl::h4f7ad11f1945d0eb
  58:     0x7f49f328436b - rustc_mir::transform::mir_const::h6c08547191de2aa8
  59:     0x7f49f323c4c1 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_const>::compute::h73d5e54d168e9c7b
  60:     0x7f49f304cb65 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h9c20e3f215a95c0b
  61:     0x7f49f30e1f03 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h48d83b53377cf2a4
  62:     0x7f49f2d6a9b1 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h7c679e4ccd6303cb
  63:     0x7f49f2f171d4 - rustc_query_system::query::plumbing::get_query_impl::h6e6e1ee3c4581973
  64:     0x7f49f328488e - rustc_mir::transform::mir_promoted::h0cc79eee2baede78
  65:     0x7f49f3293031 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_promoted>::compute::hf07dfd62fa1bd93f
  66:     0x7f49f304e9f5 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hc0db1d632bfd9822
  67:     0x7f49f30dcacb - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h15a7ad4cc0a88ac4
  68:     0x7f49f2d6f3c7 - rustc_data_structures::stack::ensure_sufficient_stack::h0d2458483a76bfbe
  69:     0x7f49f2f30aa7 - rustc_query_system::query::plumbing::get_query_impl::h8833547dbc0131af
  70:     0x7f49f32c56e4 - rustc_mir::borrow_check::mir_borrowck::h6bb2526a5224ac7b
  71:     0x7f49f3298c25 - core::ops::function::FnOnce::call_once::ha0fc52f24667e21d
  72:     0x7f49f27cee3e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute::heea38576bc2d13e0
  73:     0x7f49f25c6778 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::he5acd848f9358a3c
  74:     0x7f49f26a7c7a - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h2abd60179f78c7f2
  75:     0x7f49f2619721 - rustc_data_structures::stack::ensure_sufficient_stack::h2de0022b5b01d4a4
  76:     0x7f49f2557712 - rustc_query_system::query::plumbing::get_query_impl::hba937082ff871197
  77:     0x7f49f27fd564 - rustc_typeck::collect::type_of::type_of::h74383c484653622d
  78:     0x7f49f25bb94f - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::type_of>::compute::hfd79d1381924d3f3
  79:     0x7f49f25c31d1 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::h623ab536fd446e13
  80:     0x7f49f26a6fff - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h26a5d8549648a6c6
  81:     0x7f49f261c641 - rustc_data_structures::stack::ensure_sufficient_stack::h61e1796ea93702d9
  82:     0x7f49f251cb5c - rustc_query_system::query::plumbing::get_query_impl::h558e4dad03e07b80
  83:     0x7f49f25dd0de - rustc_typeck::check::check::check_item_type::h98773239642c80eb
  84:     0x7f49f2698ab9 - rustc_middle::hir::map::Map::visit_item_likes_in_module::h3b0059be633bc701
  85:     0x7f49f25e13cd - rustc_typeck::check::check::check_mod_item_types::h05209c564fff9b9f
  86:     0x7f49f2694a0e - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_mod_item_types>::compute::h688ec518ca5b3446
  87:     0x7f49f25c2ae6 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::ha6b22497f3a60f4b
  88:     0x7f49f26ae3a7 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h763820e87aeb42a6
  89:     0x7f49f2623464 - rustc_data_structures::stack::ensure_sufficient_stack::hd02e3960b4765973
  90:     0x7f49f25700ba - rustc_query_system::query::plumbing::get_query_impl::hd692e841feec859b
  91:     0x7f49f25808ae - rustc_query_system::query::plumbing::ensure_query_impl::hfd8292610205e5d4
  92:     0x7f49f269b122 - rustc_session::utils::<impl rustc_session::session::Session>::time::hf8479066877269ae
  93:     0x7f49f26fd5c0 - rustc_typeck::check_crate::hfa26513dd6ccd57c
  94:     0x7f49f1c9215f - rustc_interface::passes::analysis::h0de92c2792188299
  95:     0x7f49f1a83332 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::h00d2ec9ff8460c2c
  96:     0x7f49f19c4d28 - rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps::hb4079a860e34ece0
  97:     0x7f49f1a43177 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hc5cfe7a3bcd09e8e
  98:     0x7f49f1a59b60 - rustc_data_structures::stack::ensure_sufficient_stack::h1e73fd3769ac2d2b
  99:     0x7f49f19f4221 - rustc_query_system::query::plumbing::get_query_impl::h7845c9072f9f47fa
 100:     0x7f49f1a85f3f - rustc_interface::passes::QueryContext::enter::hf289a5ab7388ed19
 101:     0x7f49f1a56d72 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h76a5049d62ad1f3e
 102:     0x7f49f1a39e67 - rustc_span::with_source_map::h62a26cc1f538b576
 103:     0x7f49f1a52331 - scoped_tls::ScopedKey<T>::set::h851e47b28a99a947
 104:     0x7f49f1a5b105 - std::sys_common::backtrace::__rust_begin_short_backtrace::hcc10758615a842a8
 105:     0x7f49f19e2e2e - core::ops::function::FnOnce::call_once{{vtable.shim}}::hdee37546948bd4b7
 106:     0x7f49f118986a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h588ce842808b3fd0
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/alloc/src/boxed.rs:1042:9
 107:     0x7f49f118986a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h46bc655f05471a92
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/alloc/src/boxed.rs:1042:9
 108:     0x7f49f118986a - std::sys::unix::thread::Thread::new::thread_start::hb4b79d379b730058
                               at /rustc/dd7fc54ebdca419ad9d3ab1e9f5ed14e770768ea/library/std/src/sys/unix/thread.rs:87:17
 109:     0x7f49f10853e9 - start_thread
 110:     0x7f49f0fa2293 - __GI___clone
 111:                0x0 - <unknown>

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (dd7fc54eb 2020-10-15) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [typeck] type-checking `ice`
#1 [mir_built] building MIR for `ice`
#2 [unsafety_check_result] unsafety-checking `ice`
#3 [mir_const] processing MIR for `ice`
#4 [mir_promoted] processing `ice`
#5 [mir_borrowck] borrow-checking `ice`
#6 [type_of] computing type of `ice::{opaque#0}`
#7 [check_mod_item_types] checking item types in top-level module
#8 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

error: could not compile `b`

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

A-traits C-bug I-ICE P-high T-compiler glacier regression-from-stable-to-nightly

All 15 comments

Reduced code from another project that also triggers this ICE:
rust async fn test() -> Result<(), Box<dyn std::error::Error>> { macro!(); Ok(()) }

Cargo-bisetc-rustc points to 93deabce03dc10a80244f5da3e3819452744da2a / https://github.com/rust-lang/rust/pull/77873

cc @nikomatsakis and @roxelo

The error on stable is

error: expected identifier, found `!`
 --> <source>:2:10
  |
2 |     macro!()
  |          ^ expected identifier

error: aborting due to previous error

Compiler returned: 1

So it's a case of error->ICE.

After some trying I found out that this will panic for every keyword, that is followed by an unexpected token, in an async function, that returns Box<dyn SomeTrait>

Assigning P-high and removing I-prioritize as discussed in the prioritization working group.

I can also reproduce the ICE with the following code:

async fn ice() -> &'static () {
    .
}

After investigation, I think I have found the cause of the bug. When we get to https://github.com/rust-lang/rust/blob/9832374f6e378971e1a933362cf9781b121bb845/compiler/rustc_trait_selection/src/opaque_types.rs#L735 the tupled_upvars_ty contained in substs is a TyKind::Error, because of the invalid macro!() or . or any wrong syntax. Then we call upvar_tys which expects a TyKind::Tuple so it panics.

Unless someone gets to it before, but I can get a fix in by if not over the weekend.

Though from what I understand about that code it shouldn't be TyKind::Error, it should be Infer/Tuple. interesting...

A possible duplicate.

#[derive(Clone)]
struct InGroup<F> {
    it: It,
    f: F,
}
fn dates_in_year() -> impl Clone {
    InGroup { f: |d| d }
}

Fix in #78392 (in progress)

The third time's the charm. More future proof solution: https://github.com/rust-lang/rust/pull/78432

I was just about to open a new issue when I saw this and it looks like it has been fixed—but since I already typed it out and it might provide further info, here it is:

Code

use std::error::Error;

use sqlx::PgConnection;
use ssh2::Sftp;

async fn minimal_example(
    mut _db_connection: PgConnection,
    _sftp_connection: Sftp,
) -> Result<(), Box<dyn Error>> {
    todo!()
}

or

async fn minimal_example(
    mut _db_connection: PgConnection,
    _sftp_connection: Sftp,
) -> Result<(), Box<dyn Error>> {
    println!("hello world");
    Ok(())
}

_No_ ICE when:

  • just the return value is omitted
  • just the args are omitted
  • both the return value and args are omitted
  • todo!() is replaced with loop {}
[dependencies]
# using the actual dependency compiles fine:
# sqlx = { version = "0.4.0-beta.1", default-features = false, features = ["postgres", "runtime-tokio", "macros", "chrono"] }
# but using this or leaving it out causes the ICE
sqlx = "0.3.5" # also ICE on "0.4.0-beta.1" 
ssh2 = "0.8"

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24)
binary: rustc
commit-hash: ffa2e7ae8fbf9badc035740db949b9dae271c29f
commit-date: 2020-10-24
host: x86_64-apple-darwin
release: 1.49.0-nightly
LLVM version: 11.0

_No_ ICE on rustc 1.47.0 (18bf6b4f0 2020-10-07)

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:2150:18: tuple_fields called on non-tuple

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9


Backtrace

``` ❯ RUST_BACKTRACE=1 cargo +nightly c Checking rustc-ice-example v0.1.0 (/Users/wm/Developer/rustc-ice-example) error[E0432]: unresolved import `sqlx::PgConnection` --> src/lib.rs:3:5 | 3 | use sqlx::PgConnection; | ^^^^^^------------ | | | | | help: a similar name exists in the module: `Connection` | no `PgConnection` in the root error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:2150:18: tuple_fields called on non-tuple thread 'rustc' panicked at 'Box', compiler/rustc_errors/src/lib.rs:945:9 stack backtrace: 0: std::panicking::begin_panic 1: rustc_errors::HandlerInner::bug 2: rustc_errors::Handler::bug 3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}} 4: rustc_middle::ty::context::tls::with_opt::{{closure}} 5: rustc_middle::ty::context::tls::with_opt 6: rustc_middle::util::bug::opt_span_bug_fmt 7: rustc_middle::util::bug::bug_fmt 8: rustc_middle::ty::sty::::tuple_fields 9: as rustc_middle::ty::fold::TypeVisitor>::visit_ty 10: rustc_middle::ty::fold::TypeFoldable::visit_with 11: rustc_middle::ty::structural_impls::::super_visit_with 12: as rustc_middle::ty::fold::TypeVisitor>::visit_ty 13: ::constrain_opaque_types 14: rustc_typeck::check::regionck::RegionCtxt::visit_fn_body 15: rustc_hir::intravisit::walk_expr 16: ::visit_expr 17: rustc_hir::intravisit::walk_expr 18: ::visit_expr 19: rustc_typeck::check::regionck::RegionCtxt::visit_fn_body 20: rustc_typeck::check::regionck::::regionck_fn 21: rustc_infer::infer::InferCtxtBuilder::enter 22: rustc_typeck::check::typeck 23: rustc_middle::dep_graph::::with_deps 24: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 25: rustc_data_structures::stack::ensure_sufficient_stack 26: rustc_query_system::query::plumbing::get_query_impl 27: rustc_middle::ty::context::TyCtxt::typeck_opt_const_arg 28: rustc_mir_build::thir::cx::Cx::new 29: rustc_infer::infer::InferCtxtBuilder::enter 30: rustc_mir_build::build::mir_built 31: rustc_middle::ty::query:: for rustc_middle::ty::query::queries::mir_built>::compute 32: rustc_middle::dep_graph::::with_deps 33: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 34: rustc_data_structures::stack::ensure_sufficient_stack 35: rustc_query_system::query::plumbing::get_query_impl 36: rustc_mir::transform::check_unsafety::unsafety_check_result 37: core::ops::function::FnOnce::call_once 38: rustc_middle::ty::query:: for rustc_middle::ty::query::queries::unsafety_check_result>::compute 39: rustc_middle::dep_graph::::with_deps 40: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 41: rustc_data_structures::stack::ensure_sufficient_stack 42: rustc_query_system::query::plumbing::get_query_impl 43: rustc_query_system::query::plumbing::ensure_query_impl 44: rustc_mir::transform::mir_const 45: rustc_middle::ty::query:: for rustc_middle::ty::query::queries::mir_const>::compute 46: rustc_middle::dep_graph::::with_deps 47: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 48: rustc_data_structures::stack::ensure_sufficient_stack 49: rustc_query_system::query::plumbing::get_query_impl 50: rustc_mir::transform::mir_promoted 51: rustc_middle::ty::query:: for rustc_middle::ty::query::queries::mir_promoted>::compute 52: rustc_middle::dep_graph::::with_deps 53: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 54: rustc_data_structures::stack::ensure_sufficient_stack 55: rustc_query_system::query::plumbing::get_query_impl 56: rustc_mir::borrow_check::mir_borrowck 57: core::ops::function::FnOnce::call_once 58: rustc_middle::ty::query:: for rustc_middle::ty::query::queries::mir_borrowck>::compute 59: rustc_middle::dep_graph::::with_deps 60: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 61: rustc_data_structures::stack::ensure_sufficient_stack 62: rustc_query_system::query::plumbing::get_query_impl 63: rustc_typeck::collect::type_of::type_of 64: rustc_middle::ty::query:: for rustc_middle::ty::query::queries::type_of>::compute 65: rustc_middle::dep_graph::::with_deps 66: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 67: rustc_data_structures::stack::ensure_sufficient_stack 68: rustc_query_system::query::plumbing::get_query_impl 69: rustc_typeck::check::check::check_item_type 70: rustc_middle::hir::map::Map::visit_item_likes_in_module 71: rustc_typeck::check::check::check_mod_item_types 72: rustc_middle::ty::query:: for rustc_middle::ty::query::queries::check_mod_item_types>::compute 73: rustc_middle::dep_graph::::with_deps 74: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 75: rustc_data_structures::stack::ensure_sufficient_stack 76: rustc_query_system::query::plumbing::get_query_impl 77: rustc_query_system::query::plumbing::ensure_query_impl 78: rustc_session::utils::::time 79: rustc_typeck::check_crate 80: rustc_interface::passes::analysis 81: rustc_middle::ty::query:: for rustc_middle::ty::query::queries::analysis>::compute 82: rustc_middle::dep_graph::::with_deps 83: rustc_query_system::dep_graph::graph::DepGraph::with_task_impl 84: rustc_middle::ty::query::plumbing::::start_query::{{closure}}::{{closure}}::{{closure}} 85: rustc_query_system::query::plumbing::get_query_impl 86: rustc_interface::passes::QueryContext::enter 87: rustc_interface::queries::::enter 88: rustc_span::with_source_map 89: rustc_interface::interface::create_compiler_and_run 90: scoped_tls::ScopedKey::set note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md note: rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24) running on x86_64-apple-darwin note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C link-arg=-fuse-ld=/usr/local/bin/zld --crate-type lib note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [typeck] type-checking `minimal_example` #1 [mir_built] building MIR for `minimal_example` #2 [unsafety_check_result] unsafety-checking `minimal_example` #3 [mir_const] processing MIR for `minimal_example` #4 [mir_promoted] processing `minimal_example` #5 [mir_borrowck] borrow-checking `minimal_example` #6 [type_of] computing type of `minimal_example::{opaque#0}` #7 [check_mod_item_types] checking item types in top-level module #8 [analysis] running analysis passes on this crate end of query stack error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0432`. error: could not compile `rustc-ice-example` To learn more, run the command again with --verbose.```

I hit a similiar bug... As it is already known and fixed, I won't post a new bug report, but as I already have it, here is my data point:


Code

I don't have a minimal example, I just know that I got an error on the following git checkout:
https://github.com/YZITE/yxd-auth/tree/rice-20201030

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24)
binary: rustc
commit-hash: ffa2e7ae8fbf9badc035740db949b9dae271c29f
commit-date: 2020-10-24
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0

The following command triggered the ICE:
cargo check -p yxd-auth-core

Error output

error[E0425]: cannot find value `signal` in this scope
  --> crates/core/src/lib.rs:36:55
   |
36 |         .each(0..num_cpus::get(), |_| block_on(ex.run(signal.listen())))
   |                                                       ^^^^^^ not found in this scope
   |
help: consider importing this function
   |
4  | use crate::chrono::month_serde::ser::net::io::sys::signal;
   |

error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:2150:18: tuple_fields called on non-tuple

thread 'rustc' panicked at 'Box<Any>', compiler/rustc_errors/src/lib.rs:945:9
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: rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 --crate-type lib

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

query stack during panic:
 #0 [typeck] type-checking `block_on`
 #1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0425`.
error: could not compile `yxd-auth-core`

Backtrace

stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_errors::HandlerInner::bug
   2: rustc_errors::Handler::bug
   3: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}
   4: rustc_middle::ty::context::tls::with_opt::{{closure}}
   5: rustc_middle::ty::context::tls::with_opt
   6: rustc_middle::util::bug::opt_span_bug_fmt
   7: rustc_middle::util::bug::bug_fmt
   8: rustc_middle::ty::sty::<impl rustc_middle::ty::TyS>::tuple_fields
   9: rustc_trait_selection::traits::select::SelectionContext::copy_clone_conditions
  10: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates
  11: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache
  12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task
  13: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation
  14: rustc_trait_selection::traits::select::SelectionContext::select
  15: rustc_trait_selection::traits::fulfill::FulfillProcessor::process_trait_obligation
  16: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
  17: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
  18: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  19: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::select_obligations_where_possible
  20: rustc_infer::infer::InferCtxtBuilder::enter
  21: rustc_typeck::check::typeck
  22: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck>::compute
  23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  24: rustc_data_structures::stack::ensure_sufficient_stack
  25: rustc_query_system::query::plumbing::get_query_impl
  26: rustc_query_system::query::plumbing::ensure_query_impl
  27: rustc_typeck::check::typeck_item_bodies
  28: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::typeck_item_bodies>::compute
  29: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  30: rustc_data_structures::stack::ensure_sufficient_stack
  31: rustc_query_system::query::plumbing::get_query_impl
  32: rustc_typeck::check_crate
  33: rustc_interface::passes::analysis
  34: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  35: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  36: rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}
  37: rustc_query_system::query::plumbing::get_query_impl
  38: rustc_interface::passes::QueryContext::enter
  39: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  40: rustc_span::with_source_map
  41: rustc_interface::interface::create_compiler_and_run
  42: scoped_tls::ScopedKey<T>::set

Was this page helpful?
0 / 5 - 0 ratings