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: tcx.impl_defaultness(owner).has_value(): async_fn_in_trait + edition 2018 #108738

Closed
matthiaskrgr opened this issue Mar 4, 2023 · 1 comment · Fixed by #108746
Closed
Assignees
Labels
C-bug Category: This is a bug. F-async_fn_in_trait Static async fn in traits I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![feature(async_fn_in_trait)]
#![allow(incomplete_features)]

trait MyTrait {
    async fn foo(&self) -> i32;
    async fn bar(&self) -> i32;
}

impl MyTrait for i32 {
    async fn MyTrait(&self) -> i32 {
        *self
    }

    async fn bar(&self) -> i32 {
        self.foo().await
    }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (01b7a6a9e 2023-03-04)
binary: rustc
commit-hash: 01b7a6a9eac151f82831c402f91894552f5ca36d
commit-date: 2023-03-04
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

rustc file.rs --edition=2018

error[E0407]: method `MyTrait` is not a member of trait `MyTrait`
  --> 37b51aa64d02aa93e235707c812d00fb55d9e6aa.rs:10:5
   |
10 | /     async fn MyTrait(&self) -> i32 {
11 | |         *self
12 | |     }
   | |_____^ not a member of trait `MyTrait`

error[E0046]: not all trait items implemented, missing: `foo`
 --> 37b51aa64d02aa93e235707c812d00fb55d9e6aa.rs:9:1
  |
5 |     async fn foo(&self) -> i32;
  |     --------------------------- `foo` from trait
...
9 | impl MyTrait for i32 {
  | ^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
Backtrace


thread 'rustc' panicked at 'assertion failed: tcx.impl_defaultness(owner).has_value()', compiler/rustc_hir_analysis/src/collect/type_of.rs:348:25
stack backtrace:
   0:     0x7f3b2f03b31a - std::backtrace_rs::backtrace::libunwind::trace::h52636c4d9c9717bd
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f3b2f03b31a - std::backtrace_rs::backtrace::trace_unsynchronized::h0c9293a5a7ee6340
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3b2f03b31a - std::sys_common::backtrace::_print_fmt::h3fb44919aa13b5cf
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f3b2f03b31a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3562293febed6b19
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f3b2f09eb6e - core::fmt::write::h12118b6f3c7d6b90
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f3b2f02e1c5 - std::io::Write::write_fmt::h28efec1b4660b932
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/io/mod.rs:1684:15
   6:     0x7f3b2f03b0e5 - std::sys_common::backtrace::_print::h5d889ef4ebb9a8ec
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f3b2f03b0e5 - std::sys_common::backtrace::print::hbf11bbbbeb490fd5
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f3b2f03de5f - std::panicking::default_hook::{{closure}}::hcc41717939974e11
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/panicking.rs:271:22
   9:     0x7f3b2f03db9b - std::panicking::default_hook::h4ecb5f08729b0e24
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/panicking.rs:290:9
  10:     0x7f3b2ddc8195 - rustc_driver_impl[7158e881f718e2d3]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f3b2f03e69d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hdc6e44f7d2d41bd2
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/alloc/src/boxed.rs:2001:9
  12:     0x7f3b2f03e69d - std::panicking::rust_panic_with_hook::h0d378bbed8eb51b5
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/panicking.rs:696:13
  13:     0x7f3b2f03e3d2 - std::panicking::begin_panic_handler::{{closure}}::hea4ab4df23767250
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/panicking.rs:581:13
  14:     0x7f3b2f03b786 - std::sys_common::backtrace::__rust_end_short_backtrace::hccdf8f718a4a058e
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f3b2f03e122 - rust_begin_unwind
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/panicking.rs:579:5
  16:     0x7f3b2f09aec3 - core::panicking::panic_fmt::h83261bf20a650427
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/core/src/panicking.rs:64:14
  17:     0x7f3b2f09af5d - core::panicking::panic::hdff1c0e7b0c7538b
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/core/src/panicking.rs:114:5
  18:     0x7f3b2d3365ea - rustc_hir_analysis[6e726a01f7b04994]::collect::type_of::type_of
  19:     0x7f3b2c7a7320 - rustc_query_system[78587c5ed3869d71]::query::plumbing::try_execute_query::<rustc_query_impl[f5966daa0ba4a556]::queries::type_of, rustc_query_impl[f5966daa0ba4a556]::plumbing::QueryCtxt>
  20:     0x7f3b2c7a5f20 - <rustc_query_impl[f5966daa0ba4a556]::Queries as rustc_middle[a17d16f63e31a3a9]::ty::query::QueryEngine>::type_of
  21:     0x7f3b2ca810a5 - <rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander>::expand_opaque_ty
  22:     0x7f3b2ca92f30 - <rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander as rustc_type_ir[c0b06841bed6f118]::fold::TypeFolder<rustc_middle[a17d16f63e31a3a9]::ty::context::TyCtxt>>::fold_ty
  23:     0x7f3b2e33bfca - rustc_middle[a17d16f63e31a3a9]::ty::util::fold_list::<rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander, rustc_middle[a17d16f63e31a3a9]::ty::Ty, <&rustc_middle[a17d16f63e31a3a9]::ty::list::List<rustc_middle[a17d16f63e31a3a9]::ty::Ty> as rustc_type_ir[c0b06841bed6f118]::fold::TypeFoldable<rustc_middle[a17d16f63e31a3a9]::ty::context::TyCtxt>>::try_fold_with<rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander>::{closure#0}>
  24:     0x7f3b2ca93a7b - <rustc_middle[a17d16f63e31a3a9]::ty::Ty as rustc_type_ir[c0b06841bed6f118]::fold::TypeSuperFoldable<rustc_middle[a17d16f63e31a3a9]::ty::context::TyCtxt>>::super_fold_with::<rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander>
  25:     0x7f3b2ca92f19 - <rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander as rustc_type_ir[c0b06841bed6f118]::fold::TypeFolder<rustc_middle[a17d16f63e31a3a9]::ty::context::TyCtxt>>::fold_ty
  26:     0x7f3b2ca93211 - rustc_middle[a17d16f63e31a3a9]::ty::util::fold_list::<rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander, rustc_middle[a17d16f63e31a3a9]::ty::subst::GenericArg, <&rustc_middle[a17d16f63e31a3a9]::ty::list::List<rustc_middle[a17d16f63e31a3a9]::ty::subst::GenericArg> as rustc_type_ir[c0b06841bed6f118]::fold::TypeFoldable<rustc_middle[a17d16f63e31a3a9]::ty::context::TyCtxt>>::try_fold_with<rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander>::{closure#0}>
  27:     0x7f3b2ca93a50 - <rustc_middle[a17d16f63e31a3a9]::ty::Ty as rustc_type_ir[c0b06841bed6f118]::fold::TypeSuperFoldable<rustc_middle[a17d16f63e31a3a9]::ty::context::TyCtxt>>::super_fold_with::<rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander>
  28:     0x7f3b2ca92f19 - <rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander as rustc_type_ir[c0b06841bed6f118]::fold::TypeFolder<rustc_middle[a17d16f63e31a3a9]::ty::context::TyCtxt>>::fold_ty
  29:     0x7f3b2ca80f20 - <rustc_middle[a17d16f63e31a3a9]::ty::util::OpaqueTypeExpander>::expand_opaque_ty
  30:     0x7f3b2ca7e236 - <rustc_middle[a17d16f63e31a3a9]::ty::context::TyCtxt>::try_expand_impl_trait_type
  31:     0x7f3b2ca5beb9 - rustc_hir_analysis[6e726a01f7b04994]::check::check::check_mod_item_types
  32:     0x7f3b2d450991 - rustc_query_system[78587c5ed3869d71]::query::plumbing::try_execute_query::<rustc_query_impl[f5966daa0ba4a556]::queries::check_mod_item_types, rustc_query_impl[f5966daa0ba4a556]::plumbing::QueryCtxt>
  33:     0x7f3b2d45053a - <rustc_query_impl[f5966daa0ba4a556]::Queries as rustc_middle[a17d16f63e31a3a9]::ty::query::QueryEngine>::check_mod_item_types
  34:     0x7f3b2d4c526f - <rustc_middle[a17d16f63e31a3a9]::hir::map::Map>::for_each_module::<rustc_hir_analysis[6e726a01f7b04994]::check_crate::{closure#6}::{closure#0}>
  35:     0x7f3b2c121188 - rustc_hir_analysis[6e726a01f7b04994]::check_crate
  36:     0x7f3b2c115482 - rustc_interface[ed318880194992bd]::passes::analysis
  37:     0x7f3b2d627c0d - rustc_query_system[78587c5ed3869d71]::query::plumbing::try_execute_query::<rustc_query_impl[f5966daa0ba4a556]::queries::analysis, rustc_query_impl[f5966daa0ba4a556]::plumbing::QueryCtxt>
  38:     0x7f3b2d62790f - <rustc_query_impl[f5966daa0ba4a556]::Queries as rustc_middle[a17d16f63e31a3a9]::ty::query::QueryEngine>::analysis
  39:     0x7f3b2d453d26 - <rustc_middle[a17d16f63e31a3a9]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[7158e881f718e2d3]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>>
  40:     0x7f3b2d02a278 - rustc_span[6a5da090a89da2d0]::with_source_map::<core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>, rustc_interface[ed318880194992bd]::interface::run_compiler<core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>, rustc_driver_impl[7158e881f718e2d3]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  41:     0x7f3b2d0218fc - std[2e139e52b4ab0542]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ed318880194992bd]::util::run_in_thread_pool_with_globals<rustc_interface[ed318880194992bd]::interface::run_compiler<core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>, rustc_driver_impl[7158e881f718e2d3]::run_compiler::{closure#1}>::{closure#0}, core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>>
  42:     0x7f3b2d02132a - <<std[2e139e52b4ab0542]::thread::Builder>::spawn_unchecked_<rustc_interface[ed318880194992bd]::util::run_in_thread_pool_with_globals<rustc_interface[ed318880194992bd]::interface::run_compiler<core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>, rustc_driver_impl[7158e881f718e2d3]::run_compiler::{closure#1}>::{closure#0}, core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[389485506588c7bd]::result::Result<(), rustc_span[6a5da090a89da2d0]::ErrorGuaranteed>>::{closure#1} as core[389485506588c7bd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  43:     0x7f3b2f048593 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4c862f2350015116
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/alloc/src/boxed.rs:1987:9
  44:     0x7f3b2f048593 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h72ad187333787d1e
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/alloc/src/boxed.rs:1987:9
  45:     0x7f3b2f048593 - std::sys::unix::thread::Thread::new::thread_start::hf092d8eb46236b01
                               at /rustc/01b7a6a9eac151f82831c402f91894552f5ca36d/library/std/src/sys/unix/thread.rs:108:17
  46:     0x7f3b2aa94bb5 - <unknown>
  47:     0x7f3b2ab16d90 - <unknown>
  48:                0x0 - <unknown>

error: 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.69.0-nightly (01b7a6a9e 2023-03-04) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [type_of] computing type of `MyTrait::foo::{opaque#0}`
#1 [check_mod_item_types] checking item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0046, E0407.
For more information about an error, try `rustc --explain E0046`.

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 4, 2023
@matthiaskrgr
Copy link
Member Author

cc @compiler-errors as the author of the assert in 21047f1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-async_fn_in_trait Static async fn in traits I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants