Closed
Description
I tried this code:
#[async_trait]
pub trait Thing {
type Item;
fn not_async(&self) -> String
async fn get_thing(&self) -> anyhow::Result<Self::Item>;
}
I expected to see this happen:
I would expect the compiler to complain about the missing crate
Instead, this happened:
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/librustc_hir/definitions.rs:358: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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.45.2 (d3fb005a3 2020-07-31) running on x86_64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C linker=clang --crate-type lib
note: some of the compiler flags provided by cargo are hidden
Meta
rustc --version --verbose
:
rustc 1.45.2 (d3fb005a3 2020-07-31)
binary: rustc
commit-hash: d3fb005a39e62501b8b0b356166e515ae24e2e54
commit-date: 2020-07-31
host: x86_64-apple-darwin
release: 1.45.2
LLVM version: 10.0
<version>
Backtrace
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/librustc_hir/definitions.rs:358:9
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: rustc_driver::report_ice
6: std::panicking::rust_panic_with_hook
7: rust_begin_unwind
8: core::panicking::panic_fmt
9: core::panicking::panic
10: rustc_middle::hir::map::Map::def_kind
11: core::ops::function::FnOnce::call_once
12: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
14: rustc_data_structures::stack::ensure_sufficient_stack
15: rustc_query_system::query::plumbing::get_query_impl
16: rustc_middle::ty::util::<impl rustc_middle::ty::context::TyCtxt>::closure_base_def_id
17: rustc_typeck::collect::generics_of
18: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::generics_of>::compute
19: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
20: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
21: rustc_query_system::query::plumbing::get_query_impl
22: rustc_query_system::query::plumbing::ensure_query_impl
23: rustc_hir::intravisit::walk_expr
24: rustc_hir::intravisit::walk_expr
25: rustc_hir::intravisit::walk_body
26: rustc_hir::intravisit::walk_trait_item
27: <rustc_typeck::collect::CollectItemTypesVisitor as rustc_hir::intravisit::Visitor>::visit_trait_item
28: rustc_middle::hir::map::Map::visit_item_likes_in_module
29: rustc_typeck::collect::collect_mod_item_types
30: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_mod_item_types>::compute
31: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
33: rustc_query_system::query::plumbing::get_query_impl
34: rustc_query_system::query::plumbing::ensure_query_impl
35: rustc_typeck::check_crate
36: rustc_interface::passes::analysis
37: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
38: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
40: rustc_query_system::query::plumbing::get_query_impl
41: rustc_middle::ty::context::tls::enter_global
42: rustc_interface::interface::run_compiler_in_existing_thread_pool
43: rustc_ast::attr::with_globals
<backtrace>