Closed
Description
main.rs:
mod ice;
fn main() {
}
ice.rs:
use async_trait::async_trait;
#[async_trait]
pub trait T1 {
async fn f1(&self) -> Result<m1::S1, ()>;
}
mod m1 {
pub struct S1 {
pub v1: String,
}
}
pub enum E1 {}
#[async_trait]
impl T1 for () {
async fn f1(&self) -> Result<m1::S1, ()> {
if false {
return m1::S1 {
v1: format!(""),
}
} else {
return Err(m1::E1::
}
}
}
(reduced sample courtesy of @ComputerDruid)
Output:
error: expected identifier, found `)`
--> src/ice.rs:24:9
|
24 | }
| ^ expected identifier
error: incorrect close delimiter: `}`
--> src/ice.rs:24:9
|
22 | } else {
| - close delimiter possibly meant for this
23 | return Err(m1::E1::
| - un-closed delimiter
24 | }
| ^ incorrect close delimiter
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: DistinctSources(DistinctSources { begin: (Real("src/main.rs"), BytePos(0)), end: (Real("src/ice.rs"), BytePos(25)) })', src/libcore/result.rs:1188:5
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: <alloc::boxed::Box<F> as core::ops::function::Fn<A>>::call
at /b/s/w/ir/k/rust/src/liballoc/boxed.rs:1036
7: proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}
at /b/s/w/ir/k/rust/src/libproc_macro/bridge/client.rs:305
8: std::panicking::rust_panic_with_hook
9: rust_begin_unwind
10: core::panicking::panic_fmt
11: core::result::unwrap_failed
12: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
13: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
14: <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic
15: <rustc_errors::json::JsonEmitter as rustc_errors::emitter::Emitter>::emit_diagnostic
16: rustc_errors::HandlerInner::emit_diagnostic
17: rustc_errors::diagnostic_builder::DiagnosticBuilder::emit_unless
18: rustc_typeck::check::coercion::CoerceMany<E>::coerce_inner
19: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
20: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
21: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
22: rustc_typeck::check::FnCtxt::check_block_with_expected
23: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
24: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
25: rustc_typeck::check::_match::<impl rustc_typeck::check::FnCtxt>::check_match
26: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
27: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
28: rustc_typeck::check::FnCtxt::check_block_with_expected
29: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
30: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
31: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
32: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
33: rustc_typeck::check::FnCtxt::check_block_with_expected
34: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
35: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
36: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
37: rustc_typeck::check::check_fn
38: rustc_typeck::check::closure::<impl rustc_typeck::check::FnCtxt>::check_expr_closure
39: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
40: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
41: rustc_typeck::check::FnCtxt::check_argument_types
42: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
43: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
44: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
45: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
46: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
47: rustc_typeck::check::check_fn
48: rustc::ty::context::tls::with_context::{{closure}}
49: rustc_typeck::check::typeck_tables_of
50: rustc::ty::query::__query_compute::typeck_tables_of
51: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
52: rustc::dep_graph::graph::DepGraph::with_task_impl
53: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
54: rustc::ty::query::__query_compute::typeck_tables_of
55: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
56: rustc::dep_graph::graph::DepGraph::with_task_impl
57: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
58: rustc_typeck::collect::type_of
59: rustc::ty::query::__query_compute::type_of
60: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
61: rustc::dep_graph::graph::DepGraph::with_task_impl
62: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
63: rustc::hir::intravisit::walk_expr
64: rustc::hir::intravisit::Visitor::visit_fn
65: rustc::hir::intravisit::walk_item
66: <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item
67: rustc::hir::map::Map::visit_item_likes_in_module
68: rustc_typeck::collect::collect_mod_item_types
69: rustc::ty::query::__query_compute::collect_mod_item_types
70: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
71: rustc::dep_graph::graph::DepGraph::with_task_impl
72: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
73: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
74: rustc_typeck::check_crate::{{closure}}::{{closure}}
75: rustc::util::common::time
76: rustc_typeck::check_crate
77: rustc_interface::passes::analysis
78: rustc::ty::query::__query_compute::analysis
79: rustc::dep_graph::graph::DepGraph::with_task_impl
80: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
81: rustc::ty::context::tls::enter_global
82: rustc_interface::interface::run_compiler_in_existing_thread_pool
83: std::thread::local::LocalKey<T>::with
84: scoped_tls::ScopedKey<T>::set
85: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.42.0-nightly (c605199e8 2019-12-18) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck_tables_of] processing `<() as ice::T1>::f1::__f1`
#1 [typeck_tables_of] processing `<() as ice::T1>::f1::__f1::{{closure}}#0`
#2 [type_of] processing `<() as ice::T1>::f1::__f1::{{closure}}#0`
#3 [collect_mod_item_types] collecting item types in module `ice`
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.