Closed
Description
Code
trait a{async fn e(){Ok(())}}
Meta
rustc --version --verbose
:
rustc 1.67.0-nightly (203c8765e 2022-12-05)
binary: rustc
commit-hash: 203c8765ea33c65d888febe0e8219c4bb11b0d89
commit-date: 2022-12-05
host: x86_64-unknown-linux-gnu
release: 1.67.0-nightly
Error output
error[E0670]: `async fn` is not permitted in Rust 2015
--> ./g.rs:1:9
|
1 | trait a{async fn e(){Ok(())}}
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
= help: pass `--edition 2021` to `rustc`
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
warning: trait `a` should have an upper camel case name
--> ./g.rs:1:7
|
1 | trait a{async fn e(){Ok(())}}
| ^ help: convert the identifier to upper camel case: `A`
|
= note: `#[warn(non_camel_case_types)]` on by default
error[E0706]: functions in traits cannot be declared `async`
--> ./g.rs:1:9
|
1 | trait a{async fn e(){Ok(())}}
| -----^^^^^^^
| |
| `async` because of this
|
= note: `async` trait functions are not currently supported
= note: consider using the `async-trait` crate: https://crates.io/crates/async-trait
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
= help: add `#![feature(async_fn_in_trait)]` to the crate attributes to enable
error[E0601]: `main` function not found in crate `g`
--> ./g.rs:1:30
|
1 | trait a{async fn e(){Ok(())}}
| ^ consider adding a `main` function to `./g.rs`
error: internal compiler error: compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs:926:21: failed to get output type of async function
--> ./g.rs:1:21
|
1 | trait a{async fn e(){Ok(())}}
| ^
Backtrace
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/compiler/rustc_errors/src/lib.rs:973:33
stack backtrace:
0: 0x7f17c6ca47ea - std::backtrace_rs::backtrace::libunwind::trace::haf4f6555eab7ead4
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x7f17c6ca47ea - std::backtrace_rs::backtrace::trace_unsynchronized::hfc714f6da02b5969
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f17c6ca47ea - std::sys_common::backtrace::_print_fmt::h9875468f46730eb5
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/sys_common/backtrace.rs:65:5
3: 0x7f17c6ca47ea - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he7dd937ee37d2511
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f17c2bc8ece - core::fmt::write::h72e881999dc917c1
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/core/src/fmt/mod.rs:1208:17
5: 0x7f17c6c98965 - std::io::Write::write_fmt::h60eee6572a50d5d4
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/io/mod.rs:1682:15
6: 0x7f17c6ca45b5 - std::sys_common::backtrace::_print::h915ed5f42cfbd4ee
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/sys_common/backtrace.rs:47:5
7: 0x7f17c6ca45b5 - std::sys_common::backtrace::print::hea29825fc290d5a9
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/sys_common/backtrace.rs:34:9
8: 0x7f17c6ca693f - std::panicking::default_hook::{{closure}}::h1b79e91daf05b290
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/panicking.rs:267:22
9: 0x7f17c6ca667b - std::panicking::default_hook::h25494375c1c30e08
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/panicking.rs:286:9
10: 0x7f17c5ef7714 - rustc_driver[47b15bc801079be3]::DEFAULT_HOOK::{closure#0}::{closure#0}
11: 0x7f17c6ca713d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hda0ac1d4b9b4f79d
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/alloc/src/boxed.rs:2032:9
12: 0x7f17c6ca713d - std::panicking::rust_panic_with_hook::h5cab6f426c3a6e86
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/panicking.rs:692:13
13: 0x7f17c60c23a1 - std[5fdfef2f826aac6e]::panicking::begin_panic::<rustc_errors[83d0390b540c377c]::ExplicitBug>::{closure#0}
14: 0x7f17c60c0f56 - std[5fdfef2f826aac6e]::sys_common::backtrace::__rust_end_short_backtrace::<std[5fdfef2f826aac6e]::panicking::begin_panic<rustc_errors[83d0390b540c377c]::ExplicitBug>::{closure#0}, !>
15: 0x7f17c611e2c6 - std[5fdfef2f826aac6e]::panicking::begin_panic::<rustc_errors[83d0390b540c377c]::ExplicitBug>
16: 0x7f17c6103896 - std[5fdfef2f826aac6e]::panic::panic_any::<rustc_errors[83d0390b540c377c]::ExplicitBug>
17: 0x7f17c6100522 - <rustc_errors[83d0390b540c377c]::HandlerInner>::span_bug::<rustc_span[57a73cbaf19116fe]::span_encoding::Span, &alloc[4c90e52d7659c26e]::string::String>
18: 0x7f17c61002c7 - <rustc_errors[83d0390b540c377c]::Handler>::span_bug::<rustc_span[57a73cbaf19116fe]::span_encoding::Span, &alloc[4c90e52d7659c26e]::string::String>
19: 0x7f17c60f2e39 - rustc_middle[2e460662929054fb]::ty::context::tls::with_context_opt::<rustc_middle[2e460662929054fb]::ty::context::tls::with_opt<rustc_middle[2e460662929054fb]::util::bug::opt_span_bug_fmt<rustc_span[57a73cbaf19116fe]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
20: 0x7f17c60f22b6 - rustc_middle[2e460662929054fb]::util::bug::opt_span_bug_fmt::<rustc_span[57a73cbaf19116fe]::span_encoding::Span>
21: 0x7f17c4209804 - rustc_middle[2e460662929054fb]::util::bug::span_bug_fmt::<rustc_span[57a73cbaf19116fe]::span_encoding::Span>
22: 0x7f17c6076775 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::suggest_missing_break_or_return_expr
23: 0x7f17c6111a97 - <rustc_hir_typeck[8c3e029a30e483e6]::coercion::CoerceMany<&rustc_hir[9a5869f023ce050]::hir::Expr>>::report_return_mismatched_types
24: 0x7f17c42113e8 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_block_with_expected
25: 0x7f17c41bcb9f - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
26: 0x7f17c41bf1aa - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
27: 0x7f17c420f961 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_block_with_expected
28: 0x7f17c41bcb9f - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
29: 0x7f17c41a84c3 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_return_expr
30: 0x7f17c419dc6f - rustc_hir_typeck[8c3e029a30e483e6]::check::check_fn
31: 0x7f17c4278939 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_expr_closure
32: 0x7f17c41c0c09 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
33: 0x7f17c406d3e5 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_argument_types
34: 0x7f17c4249057 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_call
35: 0x7f17c41bc79e - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
36: 0x7f17c41a84c3 - <rustc_hir_typeck[8c3e029a30e483e6]::fn_ctxt::FnCtxt>::check_return_expr
37: 0x7f17c419dc6f - rustc_hir_typeck[8c3e029a30e483e6]::check::check_fn
38: 0x7f17c418858b - rustc_hir_typeck[8c3e029a30e483e6]::typeck
39: 0x7f17c45698a2 - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::VecCache<rustc_span[57a73cbaf19116fe]::def_id::LocalDefId, &rustc_middle[2e460662929054fb]::ty::context::TypeckResults>>
40: 0x7f17c58aef2c - <rustc_query_impl[7f9f218292072b3f]::Queries as rustc_middle[2e460662929054fb]::ty::query::QueryEngine>::typeck
41: 0x7f17c4b4307e - rustc_mir_build[49b0c824457695bc]::thir::cx::thir_body
42: 0x7f17c4b29f32 - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::DefaultCache<rustc_middle[2e460662929054fb]::ty::WithOptConstParam<rustc_span[57a73cbaf19116fe]::def_id::LocalDefId>, core[2ebc8f0527d3a5b9]::result::Result<(&rustc_data_structures[8077d2f5269eed54]::steal::Steal<rustc_middle[2e460662929054fb]::thir::Thir>, rustc_middle[2e460662929054fb]::thir::ExprId), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>>
43: 0x7f17c4b227f0 - rustc_mir_build[49b0c824457695bc]::build::mir_built
44: 0x7f17c4b89349 - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::DefaultCache<rustc_middle[2e460662929054fb]::ty::WithOptConstParam<rustc_span[57a73cbaf19116fe]::def_id::LocalDefId>, &rustc_data_structures[8077d2f5269eed54]::steal::Steal<rustc_middle[2e460662929054fb]::mir::Body>>>
45: 0x7f17c4ee15ad - rustc_mir_transform[f7a572f6f0553b41]::check_unsafety::unsafety_check_result
46: 0x7f17c4efd4ad - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::VecCache<rustc_span[57a73cbaf19116fe]::def_id::LocalDefId, &rustc_middle[2e460662929054fb]::mir::query::UnsafetyCheckResult>>
47: 0x7f17c4ef9457 - rustc_mir_transform[f7a572f6f0553b41]::mir_const
48: 0x7f17c4b8967f - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::DefaultCache<rustc_middle[2e460662929054fb]::ty::WithOptConstParam<rustc_span[57a73cbaf19116fe]::def_id::LocalDefId>, &rustc_data_structures[8077d2f5269eed54]::steal::Steal<rustc_middle[2e460662929054fb]::mir::Body>>>
49: 0x7f17c4ffe32d - rustc_mir_transform[f7a572f6f0553b41]::mir_promoted
50: 0x7f17c4c5bc62 - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::DefaultCache<rustc_middle[2e460662929054fb]::ty::WithOptConstParam<rustc_span[57a73cbaf19116fe]::def_id::LocalDefId>, (&rustc_data_structures[8077d2f5269eed54]::steal::Steal<rustc_middle[2e460662929054fb]::mir::Body>, &rustc_data_structures[8077d2f5269eed54]::steal::Steal<rustc_index[35e7a2f1e1896273]::vec::IndexVec<rustc_middle[2e460662929054fb]::mir::Promoted, rustc_middle[2e460662929054fb]::mir::Body>>)>>
51: 0x7f17c4c5a4df - rustc_borrowck[7e9e484e24850319]::mir_borrowck
52: 0x7f17c4f5454d - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::VecCache<rustc_span[57a73cbaf19116fe]::def_id::LocalDefId, &rustc_middle[2e460662929054fb]::mir::query::BorrowCheckResult>>
53: 0x7f17c58af2da - <rustc_query_impl[7f9f218292072b3f]::Queries as rustc_middle[2e460662929054fb]::ty::query::QueryEngine>::mir_borrowck
54: 0x7f17c56e3e15 - rustc_hir_analysis[6861c8a19017cd32]::collect::type_of::type_of
55: 0x7f17c4814136 - rustc_query_system[8fa2214c90c7f124]::query::plumbing::get_query::<rustc_query_impl[7f9f218292072b3f]::queries::type_of, rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt>
56: 0x7f17c515e43c - rustc_hir_analysis[6861c8a19017cd32]::check::check::check_mod_item_types
57: 0x7f17c49fcae3 - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::VecCache<rustc_span[57a73cbaf19116fe]::def_id::LocalDefId, ()>>
58: 0x7f17c52adf53 - rustc_query_system[8fa2214c90c7f124]::query::plumbing::get_query::<rustc_query_impl[7f9f218292072b3f]::queries::check_mod_item_types, rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt>
59: 0x7f17c55c3c15 - <rustc_middle[2e460662929054fb]::hir::map::Map>::for_each_module::<rustc_hir_analysis[6861c8a19017cd32]::check_crate::{closure#6}::{closure#0}>
60: 0x7f17c42b9d72 - rustc_hir_analysis[6861c8a19017cd32]::check_crate
61: 0x7f17c42b99bb - rustc_interface[70f300d734fc89c]::passes::analysis
62: 0x7f17c5699cda - rustc_query_system[8fa2214c90c7f124]::query::plumbing::try_execute_query::<rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt, rustc_query_system[8fa2214c90c7f124]::query::caches::DefaultCache<(), core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>>
63: 0x7f17c56999d0 - rustc_query_system[8fa2214c90c7f124]::query::plumbing::get_query::<rustc_query_impl[7f9f218292072b3f]::queries::analysis, rustc_query_impl[7f9f218292072b3f]::plumbing::QueryCtxt>
64: 0x7f17c503d21b - <rustc_interface[70f300d734fc89c]::passes::QueryContext>::enter::<rustc_driver[47b15bc801079be3]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>
65: 0x7f17c5034bce - <rustc_interface[70f300d734fc89c]::interface::Compiler>::enter::<rustc_driver[47b15bc801079be3]::run_compiler::{closure#1}::{closure#2}, core[2ebc8f0527d3a5b9]::result::Result<core[2ebc8f0527d3a5b9]::option::Option<rustc_interface[70f300d734fc89c]::queries::Linker>, rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>
66: 0x7f17c502fbe8 - rustc_span[57a73cbaf19116fe]::with_source_map::<core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>, rustc_interface[70f300d734fc89c]::interface::run_compiler<core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>, rustc_driver[47b15bc801079be3]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
67: 0x7f17c502f6d5 - <scoped_tls[25055b14e1bad790]::ScopedKey<rustc_span[57a73cbaf19116fe]::SessionGlobals>>::set::<rustc_interface[70f300d734fc89c]::interface::run_compiler<core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>, rustc_driver[47b15bc801079be3]::run_compiler::{closure#1}>::{closure#0}, core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>
68: 0x7f17c502ecc2 - std[5fdfef2f826aac6e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[70f300d734fc89c]::util::run_in_thread_pool_with_globals<rustc_interface[70f300d734fc89c]::interface::run_compiler<core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>, rustc_driver[47b15bc801079be3]::run_compiler::{closure#1}>::{closure#0}, core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>
69: 0x7f17c579de48 - <<std[5fdfef2f826aac6e]::thread::Builder>::spawn_unchecked_<rustc_interface[70f300d734fc89c]::util::run_in_thread_pool_with_globals<rustc_interface[70f300d734fc89c]::interface::run_compiler<core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>, rustc_driver[47b15bc801079be3]::run_compiler::{closure#1}>::{closure#0}, core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2ebc8f0527d3a5b9]::result::Result<(), rustc_errors[83d0390b540c377c]::ErrorGuaranteed>>::{closure#1} as core[2ebc8f0527d3a5b9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
70: 0x7f17c6cae383 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0e7d2d4274dfead7
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/alloc/src/boxed.rs:2000:9
71: 0x7f17c6cae383 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd693ed6c57fc42c8
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/alloc/src/boxed.rs:2000:9
72: 0x7f17c6cae383 - std::sys::unix::thread::Thread::new::thread_start::hde394400e2e1e846
at /rustc/203c8765ea33c65d888febe0e8219c4bb11b0d89/library/std/src/sys/unix/thread.rs:108:17
73: 0x7f17c29068fd - <unknown>
74: 0x7f17c2988a60 - <unknown>
75: 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.67.0-nightly (203c8765e 2022-12-05) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `a::e`
#1 [thir_body] building THIR for `a::e`
#2 [mir_built] building MIR for `a::e`
#3 [unsafety_check_result] unsafety-checking `a::e`
#4 [mir_const] preparing `a::e` for borrow checking
#5 [mir_promoted] processing MIR for `a::e`
#6 [mir_borrowck] borrow-checking `a::e`
#7 [type_of] computing type of `a::e::{opaque#0}`
#8 [check_mod_item_types] checking item types in top-level module
#9 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0601, E0670, E0706.
For more information about an error, try `rustc --explain E0601`.