Skip to content

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

Closed
@matthiaskrgr

Description

@matthiaskrgr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions