File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -591,28 +591,32 @@ impl<'tcx> Analyzer<'tcx> {
591591 continue ;
592592 }
593593 let rustc_hir:: StmtKind :: Semi ( expr) = stmt. kind else {
594- panic ! (
595- "annotated path is expected to be a semi statement, but found: {:?}" ,
596- stmt . kind
594+ self . tcx . dcx ( ) . span_err (
595+ stmt . span ,
596+ "annotated path is expected to be a semi statement" ,
597597 ) ;
598+ continue ;
598599 } ;
599600 let rustc_hir:: ExprKind :: Path ( qpath) = expr. kind else {
600- panic ! (
601- "annotated path is expected to be a path expression, but found: {:?}" ,
602- expr . kind
601+ self . tcx . dcx ( ) . span_err (
602+ expr . span ,
603+ "annotated path is expected to be a path expression" ,
603604 ) ;
605+ continue ;
604606 } ;
605607 let rustc_hir:: QPath :: Resolved ( _, path) = qpath else {
606- panic ! (
607- "qpath is unexpectedly not resolved in annotated path: {:?}" ,
608- qpath
608+ self . tcx . dcx ( ) . span_err (
609+ expr . span ,
610+ "annotated path is expected to be a resolved path" ,
609611 ) ;
612+ continue ;
610613 } ;
611614 let rustc_hir:: def:: Res :: Def ( _, def_id) = path. res else {
612- panic ! (
613- "annotated path is expected to refer to a def, but found: {:?}" ,
614- path. res
615+ self . tcx . dcx ( ) . span_err (
616+ path. span ,
617+ "annotated path is expected to refer to a definition" ,
615618 ) ;
619+ continue ;
616620 } ;
617621 return Some ( def_id) ;
618622 }
You can’t perform that action at this time.
0 commit comments