Skip to content

ICE assertion failed: self.is_struct() || self.is_union() #75977

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

code from ./src/test/ui/async-await/issues/issue-64433.rs

#[derive(Debug)]
struct A<'a> {
    inner: Vec<&'a str>,
}

struct B {}

impl B {
    async fn something_with_a(&mut self, a: A<'_>) -> Result<(), String> {
        println!("{:?}", a);
        Ok(())
    }
}

async fn can_error(some_string: &str) -> Result<(), String> {
    let a = A { inner: vec![some_string, "foo"] };
    let mut b = B {};
    Ok(b.something_with_a(a).await.map(drop)?)
}

fn main() {
}

Meta

repo @ f7cbb7a

Error output

rustc ./src/test/ui/async-await/issues/issue-64433.rs

error[E0670]: `async fn` is not permitted in the 2015 edition
  --> ./src/test/ui/async-await/issues/issue-64433.rs:17:5
   |
17 |     async fn something_with_a(&mut self, a: A<'_>) -> Result<(), String> {
   |     ^^^^^ to use `async fn`, switch to Rust 2018
   |
   = help: set `edition = "2018"` in `Cargo.toml`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in the 2015 edition
  --> ./src/test/ui/async-await/issues/issue-64433.rs:23:1
   |
23 | async fn can_error(some_string: &str) -> Result<(), String> {
   | ^^^^^ to use `async fn`, switch to Rust 2018
   |
   = help: set `edition = "2018"` in `Cargo.toml`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

thread 'rustc' panicked at 'assertion failed: self.is_struct() || self.is_union()', src/librustc_middle/ty/mod.rs:2462:9
note: run with `RUST_BACKTRACE=1` environment variable to display a 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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu

error: aborting due to 2 previous errors

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

error[E0670]: `async fn` is not permitted in the 2015 edition
  --> ./src/test/ui/async-await/issues/issue-64433.rs:17:5
   |
17 |     async fn something_with_a(&mut self, a: A<'_>) -> Result<(), String> {
   |     ^^^^^ to use `async fn`, switch to Rust 2018
   |
   = help: set `edition = "2018"` in `Cargo.toml`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error[E0670]: `async fn` is not permitted in the 2015 edition
  --> ./src/test/ui/async-await/issues/issue-64433.rs:23:1
   |
23 | async fn can_error(some_string: &str) -> Result<(), String> {
   | ^^^^^ to use `async fn`, switch to Rust 2018
   |
   = help: set `edition = "2018"` in `Cargo.toml`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

thread 'rustc' panicked at 'assertion failed: self.is_struct() || self.is_union()', src/librustc_middle/ty/mod.rs:2462:9
stack backtrace:
   0:     0x7f6876aec9d1 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9a65342185cb7022
   1:     0x7f6876b5bddd - core::fmt::write::hc3de054a6627b208
   2:     0x7f6876ae86d3 - std::io::Write::write_fmt::h64bd8d8dca95fd5c
   3:     0x7f6876ac4f30 - std::panicking::default_hook::{{closure}}::ha9c6947a872dc513
   4:     0x7f6876ac4c5a - std::panicking::default_hook::h3e5e46d076456208
   5:     0x7f6877a5ea39 - rustc_driver::report_ice::h57f0d27cc4a04c23
   6:     0x7f6876ac5566 - std::panicking::rust_panic_with_hook::h30c558028146672c
   7:     0x7f687a1e79c6 - std::panicking::begin_panic::{{closure}}::ha2039aacacabea10
   8:     0x7f687a1e791e - std::sys_common::backtrace::__rust_end_short_backtrace::h55fed0695fca8afd
   9:     0x7f6879eded2c - std::panicking::begin_panic::h4b19ffbdfe6cf88f
  10:     0x7f687a28a01b - rustc_middle::ty::AdtDef::non_enum_variant::h718fab7cd60aa158
  11:     0x7f687859acde - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  12:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  13:     0x7f687858e705 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  14:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  15:     0x7f68785e84f1 - rustc_typeck::check::FnCtxt::check_argument_types::h14872ae1f85eb423
  16:     0x7f68785754e5 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call::h1aa575ced20bb34a
  17:     0x7f6878573674 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h33382c8fd4653d24
  18:     0x7f687858e618 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  19:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  20:     0x7f687856fb6c - rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match::hc64227438a3f51a3
  21:     0x7f687858e4b6 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  22:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  23:     0x7f68785e84f1 - rustc_typeck::check::FnCtxt::check_argument_types::h14872ae1f85eb423
  24:     0x7f68785754e5 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call::h1aa575ced20bb34a
  25:     0x7f6878573674 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h33382c8fd4653d24
  26:     0x7f687858e618 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  27:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  28:     0x7f68785ed73d - rustc_typeck::check::FnCtxt::check_block_with_expected::h0120320be67b2e03
  29:     0x7f687858e40d - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  30:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  31:     0x7f6878591e54 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  32:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  33:     0x7f68785ed73d - rustc_typeck::check::FnCtxt::check_block_with_expected::h0120320be67b2e03
  34:     0x7f687858e40d - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  35:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  36:     0x7f687859e32a - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr::he2854b1e21329dac
  37:     0x7f68785d233f - rustc_typeck::check::check_fn::h9dd34b94a4dc33db
  38:     0x7f687857816e - rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure::he442a7a865fbcaf5
  39:     0x7f6878591d53 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  40:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  41:     0x7f68785e84f1 - rustc_typeck::check::FnCtxt::check_argument_types::h14872ae1f85eb423
  42:     0x7f68785754e5 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call::h1aa575ced20bb34a
  43:     0x7f6878573674 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call::h33382c8fd4653d24
  44:     0x7f687858e618 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind::hea25d5e0a0fe9226
  45:     0x7f687858df92 - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation::he6548213409ca983
  46:     0x7f687859e32a - rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr::he2854b1e21329dac
  47:     0x7f68785d233f - rustc_typeck::check::check_fn::h9dd34b94a4dc33db
  48:     0x7f68785ce566 - rustc_typeck::check::typeck::h5859c4380841a586
  49:     0x7f687a4914c7 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::ha22b1bb86cb84b61
  50:     0x7f6879ed23d6 - rustc_data_structures::stack::ensure_sufficient_stack::h749101b2abd5fb91
  51:     0x7f687a31f74b - rustc_query_system::query::plumbing::get_query_impl::h3839a9e24c25c72d
  52:     0x7f6879fe2ef2 - rustc_middle::ty::context::TyCtxt::typeck_opt_const_arg::hb1b96dc71f356509
  53:     0x7f6878ba1d08 - rustc_mir_build::thir::cx::Cx::new::h90c83c3e63945347
  54:     0x7f6878ada085 - rustc_infer::infer::InferCtxtBuilder::enter::hac9be9830201ea1f
  55:     0x7f6878b74c60 - rustc_mir_build::build::mir_built::h5abff24a21d30eaa
  56:     0x7f6878e21e41 - 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::h5643b00ddb333dc6
  57:     0x7f6878c8bfc3 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hf007c9577a62290a
  58:     0x7f6878c9bede - rustc_data_structures::stack::ensure_sufficient_stack::hbe75214c03accc9c
  59:     0x7f68790d0328 - rustc_query_system::query::plumbing::get_query_impl::hd0c1a7ea5baadb38
  60:     0x7f6878ed40e0 - rustc_mir::transform::check_unsafety::unsafety_check_result::hc669ba4ddf4562d0
  61:     0x7f6878e3e4e2 - core::ops::function::FnOnce::call_once::hecb5ca4063fdd97b
  62:     0x7f6878e2366e - 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::hcc436ff698043792
  63:     0x7f6878c86540 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h8f9a4da01f3951da
  64:     0x7f6878c9b269 - rustc_data_structures::stack::ensure_sufficient_stack::h9bd7d2ce9166420b
  65:     0x7f68790dcae4 - rustc_query_system::query::plumbing::get_query_impl::he20a00125afe0eed
  66:     0x7f68790f6e9d - rustc_query_system::query::plumbing::ensure_query_impl::hbdffa89d2d1dacca
  67:     0x7f6878ee3bc3 - rustc_mir::transform::mir_const::hacf312b07816630c
  68:     0x7f6878e21f21 - 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::hd2e1914962fb6a06
  69:     0x7f6878c8bfc3 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hf007c9577a62290a
  70:     0x7f6878c9bede - rustc_data_structures::stack::ensure_sufficient_stack::hbe75214c03accc9c
  71:     0x7f68790d0328 - rustc_query_system::query::plumbing::get_query_impl::hd0c1a7ea5baadb38
  72:     0x7f6878ee3fb4 - rustc_mir::transform::mir_promoted::h9c08818b4bb69491
  73:     0x7f6878e22411 - 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::h21c2cd3b839f2c93
  74:     0x7f6878c87357 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::ha281f2e67a0f94d0
  75:     0x7f6878c98bd7 - rustc_data_structures::stack::ensure_sufficient_stack::h515e22feec1020fc
  76:     0x7f687909c3b3 - rustc_query_system::query::plumbing::get_query_impl::h4cb2be2abf3f28b2
  77:     0x7f6878e92081 - rustc_mir::borrow_check::mir_borrowck::h9c6fd2f7cc6101e2
  78:     0x7f6878e3e422 - core::ops::function::FnOnce::call_once::hea1c9614c3180aaf
  79:     0x7f687863da1e - 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::h80d53cc8b64d2bd7
  80:     0x7f687845ac00 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::he1ad9a4e382a9882
  81:     0x7f68784609d9 - rustc_data_structures::stack::ensure_sufficient_stack::h0aca12c2381bea1e
  82:     0x7f68786b3a79 - rustc_query_system::query::plumbing::get_query_impl::hc22d375c5e4411df
  83:     0x7f6878781d89 - rustc_typeck::collect::type_of::type_of::h8ea1060223d0b75d
  84:     0x7f687a497abf - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hbe16ef99e8286bc0
  85:     0x7f6879ecd9c8 - rustc_data_structures::stack::ensure_sufficient_stack::h36b08436e738f087
  86:     0x7f687a390966 - rustc_query_system::query::plumbing::get_query_impl::hbb78aaa608913d7c
  87:     0x7f6879fddc8e - rustc_middle::ty::util::OpaqueTypeExpander::expand_opaque_ty::h64921e7e283d33a0
  88:     0x7f6879fdd887 - rustc_middle::ty::util::<impl rustc_middle::ty::context::TyCtxt>::try_expand_impl_trait_type::h7d841ef034d249d8
  89:     0x7f68785d5c12 - rustc_typeck::check::check_item_type::hcbbc2ed700a9ff17
  90:     0x7f6878429aa9 - rustc_middle::hir::map::Map::visit_item_likes_in_module::he01f52ca6f0eeda3
  91:     0x7f68785cb8ad - rustc_typeck::check::check_mod_item_types::h643fd85d0ce28ec4
  92:     0x7f687863e70e - 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::h3eed883eaab65fb9
  93:     0x7f6878459e60 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::hc77c4923073dde05
  94:     0x7f68784621a9 - rustc_data_structures::stack::ensure_sufficient_stack::h2ddab409d2718558
  95:     0x7f687866a4c0 - rustc_query_system::query::plumbing::get_query_impl::h3d7e43820c74c77d
  96:     0x7f68786e11ce - rustc_query_system::query::plumbing::ensure_query_impl::h4e8e20c10057d6fe
  97:     0x7f6878644209 - rustc_session::utils::<impl rustc_session::session::Session>::time::hbdbb6c0368195ab0
  98:     0x7f68784ebefc - rustc_typeck::check_crate::h4b5354c0b30e33ef
  99:     0x7f6877e8c9e5 - rustc_interface::passes::analysis::hfcd283d82bf63033
 100:     0x7f68779f65a2 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute::hb7820b5bff8e5cd6
 101:     0x7f6877a0ae20 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h8ff0a86112af9468
 102:     0x7f68779f73e5 - rustc_middle::ty::query::plumbing::<impl rustc_query_system::query::QueryContext for rustc_middle::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}::{{closure}}::h72b7040b8ecb21fb
 103:     0x7f6877a0f074 - rustc_data_structures::stack::ensure_sufficient_stack::hde2925dd412e7d36
 104:     0x7f6877b83657 - rustc_query_system::query::plumbing::get_query_impl::h08dd3a185b40b43c
 105:     0x7f68779fe994 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h3d6d3a71d6d27568
 106:     0x7f6877b79913 - rustc_span::with_source_map::hdfd15c7680d138eb
 107:     0x7f68779f035e - scoped_tls::ScopedKey<T>::set::h82ba2255333cb76d
 108:     0x7f6877b9091c - std::sys_common::backtrace::__rust_begin_short_backtrace::h8e50cf7ebb5c7a2e
 109:     0x7f6877b92dce - core::ops::function::FnOnce::call_once{{vtable.shim}}::heded94bdd24516ed
 110:     0x7f6876ac7128 - std::sys::unix::thread::Thread::new::thread_start::hdc96d124dc384f80
 111:     0x7f6873642422 - start_thread
 112:     0x7f68768c9bf3 - __clone
 113:                0x0 - <unknown>

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.47.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `can_error`
#1 [mir_built] building MIR for `can_error`
#2 [unsafety_check_result] unsafety-checking `can_error`
#3 [mir_const] processing MIR for `can_error`
#4 [mir_promoted] processing `can_error`
#5 [mir_borrowck] borrow-checking `can_error`
#6 [type_of] computing type of `can_error::{{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 E0670`.

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions