Closed
Description
Playground: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=95b25b789dd17b93633a44127d4bd7d4
Code
#![feature(return_position_impl_trait_in_trait)]
#![allow(incomplete_features)]
use core::fmt::Debug;
trait Foo {
async fn baz()-> impl Debug{}
}
fn main(){}
Backtrace
Compiling playground v0.0.1 (/playground)
error[[E0308]](https://doc.rust-lang.org/nightly/error-index.html#E0308): mismatched types
--> src/main.rs:7:34
|
7 | async fn baz() -> impl Debug {}
| ^^ expected associated type, found `()`
|
= note: expected associated type `impl Debug`
found unit type `()`
error: internal compiler error: compiler/rustc_ty_utils/src/assoc.rs:70:5: unexpected parent of trait or impl item or item not found: OpaqueTy(OpaqueTy { generics: Generics { params: [], predicates: [], has_where_clause_predicates: false, where_clause_span: src/main.rs:7:23: 7:33 (#0), span: src/main.rs:7:23: 7:33 (#0) }, bounds: [LangItemTrait(Future, src/main.rs:7:23: 7:33 (#0), HirId { owner: DefId(0:8 ~ playground[77cf]::Foo::baz::{opaque#0}), local_id: 3 }, GenericArgs { args: [], bindings: [TypeBinding { hir_id: HirId { owner: DefId(0:8 ~ playground[77cf]::Foo::baz::{opaque#0}), local_id: 2 }, ident: Output#0, gen_args: GenericArgs { args: [], bindings: [], parenthesized: false, span_ext: no-location (#0) }, kind: Equality { term: Ty(Ty { hir_id: HirId { owner: DefId(0:8 ~ playground[77cf]::Foo::baz::{opaque#0}), local_id: 1 }, kind: OpaqueDef(ItemId { def_id: DefId(0:9 ~ playground[77cf]::Foo::baz::{opaque#0}::{opaque#0}) }, [], true), span: src/main.rs:7:23: 7:33 (#0) }) }, span: src/main.rs:7:23: 7:33 (#0) }], parenthesized: false, span_ext: no-location (#0) })], origin: AsyncFn(DefId(0:7 ~ playground[77cf]::Foo::baz)), in_trait: true })
--> src/main.rs:7:23
|
7 | async fn baz() -> impl Debug {}
| ^^^^^^^^^^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/compiler/rustc_errors/src/lib.rs:1398:9
stack backtrace:
0: 0x7f74ced7beb0 - std::backtrace_rs::backtrace::libunwind::trace::h134b013ea56868ec
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
1: 0x7f74ced7beb0 - std::backtrace_rs::backtrace::trace_unsynchronized::h85519da7927ab55d
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f74ced7beb0 - std::sys_common::backtrace::_print_fmt::hd53e324e4c5c4797
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:66:5
3: 0x7f74ced7beb0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he7ebdae3b4539151
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:45:22
4: 0x7f74cedd6efe - core::fmt::write::h533f83a763826dcd
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/core/src/fmt/mod.rs:1202:17
5: 0x7f74ced6c795 - std::io::Write::write_fmt::hdf475e0edabf6618
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/io/mod.rs:1679:15
6: 0x7f74ced7eb63 - std::sys_common::backtrace::_print::h18929d2d3a122c2e
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:48:5
7: 0x7f74ced7eb63 - std::sys_common::backtrace::print::heeac666312b0f106
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys_common/backtrace.rs:35:9
8: 0x7f74ced7eb63 - std::panicking::default_hook::{{closure}}::h691c919edee7ee4f
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:295:22
9: 0x7f74ced7e84f - std::panicking::default_hook::h4d42a88885d5436b
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:314:9
10: 0x7f74d15ef8c1 - <rustc_driver[d98f0e6bb6d3ec36]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[7554d75f727e5dc5]::ops::function::FnOnce<(&core[7554d75f727e5dc5]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
11: 0x7f74ced7f39d - std::panicking::rust_panic_with_hook::h047e9ae9d3b70dff
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/panicking.rs:702:17
12: 0x7f74d1a91111 - std[d1a185ff54d98716]::panicking::begin_panic::<rustc_errors[623939cad04cb150]::ExplicitBug>::{closure#0}
13: 0x7f74d1a90f56 - std[d1a185ff54d98716]::sys_common::backtrace::__rust_end_short_backtrace::<std[d1a185ff54d98716]::panicking::begin_panic<rustc_errors[623939cad04cb150]::ExplicitBug>::{closure#0}, !>
14: 0x7f74d1a8c376 - std[d1a185ff54d98716]::panicking::begin_panic::<rustc_errors[623939cad04cb150]::ExplicitBug>
15: 0x7f74d1a90666 - std[d1a185ff54d98716]::panic::panic_any::<rustc_errors[623939cad04cb150]::ExplicitBug>
16: 0x7f74d1a90351 - <rustc_errors[623939cad04cb150]::HandlerInner>::span_bug::<rustc_span[3ca79a2f950a640c]::span_encoding::Span, &alloc[b78997af7b72d6fd]::string::String>
17: 0x7f74d1a90210 - <rustc_errors[623939cad04cb150]::Handler>::span_bug::<rustc_span[3ca79a2f950a640c]::span_encoding::Span, &alloc[b78997af7b72d6fd]::string::String>
18: 0x7f74d1aa33a0 - rustc_middle[5ec0a2377659145d]::ty::context::tls::with_context_opt::<rustc_middle[5ec0a2377659145d]::ty::context::tls::with_opt<rustc_middle[5ec0a2377659145d]::util::bug::opt_span_bug_fmt<rustc_span[3ca79a2f950a640c]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
19: 0x7f74d1aa3256 - rustc_middle[5ec0a2377659145d]::util::bug::opt_span_bug_fmt::<rustc_span[3ca79a2f950a640c]::span_encoding::Span>
20: 0x7f74d1aa3214 - rustc_middle[5ec0a2377659145d]::util::bug::span_bug_fmt::<rustc_span[3ca79a2f950a640c]::span_encoding::Span>
21: 0x7f74d036f567 - rustc_ty_utils[1e2717a5d9ed5011]::assoc::associated_item
22: 0x7f74d0df51a8 - rustc_query_system[bca4d9faa69393e7]::query::plumbing::get_query::<rustc_query_impl[856212b54321fa84]::queries::associated_item, rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt>
23: 0x7f74d25a8293 - <rustc_middle[5ec0a2377659145d]::ty::print::pretty::FmtPrinter as rustc_middle[5ec0a2377659145d]::ty::print::pretty::PrettyPrinter>::pretty_print_opaque_impl_type
24: 0x7f74cffd965c - <rustc_middle[5ec0a2377659145d]::ty::Ty as core[7554d75f727e5dc5]::fmt::Display>::fmt
25: 0x7f74d2509a10 - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxt>::cmp
26: 0x7f74d250d7c6 - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxt>::values_str
27: 0x7f74d2514885 - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxt>::note_type_err
28: 0x7f74d250c1df - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxt>::report_and_explain_type_error
29: 0x7f74d035bef5 - <rustc_infer[28b58e7125d8d26c]::infer::InferCtxt>::report_mismatched_types
30: 0x7f74d0227943 - <rustc_typeck[5407d422550b7e3e]::check::coercion::CoerceMany<&rustc_hir[4d2bdebed2f47bbb]::hir::Expr>>::report_return_mismatched_types
31: 0x7f74d035e62e - <rustc_typeck[5407d422550b7e3e]::check::fn_ctxt::FnCtxt>::check_return_expr
32: 0x7f74d0354fc1 - rustc_typeck[5407d422550b7e3e]::check::check::check_fn
33: 0x7f74d034630e - <rustc_typeck[5407d422550b7e3e]::check::inherited::InheritedBuilder>::enter::<rustc_typeck[5407d422550b7e3e]::check::typeck_with_fallback<rustc_typeck[5407d422550b7e3e]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[5ec0a2377659145d]::ty::context::TypeckResults>
34: 0x7f74d03443ff - rustc_typeck[5407d422550b7e3e]::check::typeck
35: 0x7f74d0e97763 - rustc_query_system[bca4d9faa69393e7]::query::plumbing::try_execute_query::<rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt, rustc_query_system[bca4d9faa69393e7]::query::caches::DefaultCache<rustc_span[3ca79a2f950a640c]::def_id::LocalDefId, &rustc_middle[5ec0a2377659145d]::ty::context::TypeckResults>>
36: 0x7f74d1529a53 - <rustc_query_impl[856212b54321fa84]::Queries as rustc_middle[5ec0a2377659145d]::ty::query::QueryEngine>::typeck
37: 0x7f74d1379bb7 - rustc_data_structures[a88d71faf1e0b01c]::sync::par_for_each_in::<&[rustc_span[3ca79a2f950a640c]::def_id::LocalDefId], <rustc_middle[5ec0a2377659145d]::hir::map::Map>::par_body_owners<rustc_typeck[5407d422550b7e3e]::check::typeck_item_bodies::{closure#0}>::{closure#0}>
38: 0x7f74d1379973 - rustc_typeck[5407d422550b7e3e]::check::typeck_item_bodies
39: 0x7f74d127ae09 - rustc_query_system[bca4d9faa69393e7]::query::plumbing::try_execute_query::<rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt, rustc_query_system[bca4d9faa69393e7]::query::caches::DefaultCache<(), ()>>
40: 0x7f74d127ab3c - rustc_query_system[bca4d9faa69393e7]::query::plumbing::get_query::<rustc_query_impl[856212b54321fa84]::queries::typeck_item_bodies, rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt>
41: 0x7f74d093987f - <rustc_session[79f725fc979de867]::session::Session>::time::<(), rustc_typeck[5407d422550b7e3e]::check_crate::{closure#7}>
42: 0x7f74d093943f - rustc_typeck[5407d422550b7e3e]::check_crate
43: 0x7f74d0938a07 - rustc_interface[b8431be2dc9777a]::passes::analysis
44: 0x7f74d13ca8dd - rustc_query_system[bca4d9faa69393e7]::query::plumbing::try_execute_query::<rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt, rustc_query_system[bca4d9faa69393e7]::query::caches::DefaultCache<(), core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>>
45: 0x7f74d13ca5fc - rustc_query_system[bca4d9faa69393e7]::query::plumbing::get_query::<rustc_query_impl[856212b54321fa84]::queries::analysis, rustc_query_impl[856212b54321fa84]::plumbing::QueryCtxt>
46: 0x7f74d03bc2b7 - <rustc_interface[b8431be2dc9777a]::passes::QueryContext>::enter::<rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
47: 0x7f74d03afcec - rustc_interface[b8431be2dc9777a]::interface::create_compiler_and_run::<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>
48: 0x7f74d03ae631 - <scoped_tls[a530c759821a22c4]::ScopedKey<rustc_span[3ca79a2f950a640c]::SessionGlobals>>::set::<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
49: 0x7f74d03ae31f - std[d1a185ff54d98716]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b8431be2dc9777a]::util::run_in_thread_pool_with_globals<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>
50: 0x7f74d14585c0 - <<std[d1a185ff54d98716]::thread::Builder>::spawn_unchecked_<rustc_interface[b8431be2dc9777a]::util::run_in_thread_pool_with_globals<rustc_interface[b8431be2dc9777a]::interface::run_compiler<core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>, rustc_driver[d98f0e6bb6d3ec36]::run_compiler::{closure#1}>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#0}, core[7554d75f727e5dc5]::result::Result<(), rustc_errors[623939cad04cb150]::ErrorGuaranteed>>::{closure#1} as core[7554d75f727e5dc5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
51: 0x7f74ced89173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hddcbc9655423aa50
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/alloc/src/boxed.rs:1940:9
52: 0x7f74ced89173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h074e83f188f31ba5
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/alloc/src/boxed.rs:1940:9
53: 0x7f74ced89173 - std::sys::unix::thread::Thread::new::thread_start::h7d9ec4c6a6f5322e
at /rustc/1d37ed661a6922e7a167609b8cd7eb31e972b19b/library/std/src/sys/unix/thread.rs:108:17
54: 0x7f74cec5c609 - start_thread
55: 0x7f74ceb7f133 - clone
56: 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.65.0-nightly (1d37ed661 2022-09-09) running on x86_64-unknown-linux-gnu
note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [associated_item] computing associated item data for `Foo::baz::{opaque#0}::{opaque#0}`
#1 [typeck] type-checking `Foo::baz`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try `rustc --explain E0308`.
error: could not compile `playground` due to previous error