@@ -545,9 +545,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
545545 ExprKind :: AddrOf ( kind, mutbl, oprnd) => {
546546 self . check_expr_addr_of ( kind, mutbl, oprnd, expected, expr)
547547 }
548- ExprKind :: Path ( QPath :: LangItem ( lang_item, _) ) => {
549- self . check_lang_item_path ( lang_item, expr)
550- }
548+ ExprKind :: Path ( QPath :: LangItem ( ..) ) => unreachable ! ( ) ,
551549 ExprKind :: Path ( ref qpath) => self . check_expr_path ( qpath, expr, None ) ,
552550 ExprKind :: InlineAsm ( asm) => {
553551 // We defer some asm checks as we may not have resolved the input and output types yet (they may still be infer vars).
@@ -748,14 +746,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
748746 }
749747 }
750748
751- fn check_lang_item_path (
752- & self ,
753- lang_item : hir:: LangItem ,
754- expr : & ' tcx hir:: Expr < ' tcx > ,
755- ) -> Ty < ' tcx > {
756- self . resolve_lang_item_path ( lang_item, expr. span , expr. hir_id ) . 1
757- }
758-
759749 pub ( crate ) fn check_expr_path (
760750 & self ,
761751 qpath : & ' tcx hir:: QPath < ' tcx > ,
@@ -780,6 +770,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
780770 {
781771 Some ( ObligationCauseCode :: ForLoopIterator )
782772 }
773+ LangItem :: TryTraitFromOutput
774+ if expr. span . is_desugaring ( DesugaringKind :: TryBlock ) =>
775+ {
776+ // FIXME it's a try block, not a question mark
777+ Some ( ObligationCauseCode :: QuestionMark )
778+ }
779+ LangItem :: TryTraitBranch | LangItem :: TryTraitFromResidual
780+ if expr. span . is_desugaring ( DesugaringKind :: QuestionMark ) =>
781+ {
782+ Some ( ObligationCauseCode :: QuestionMark )
783+ }
783784 _ => None ,
784785 } ;
785786 if let Some ( code) = code {
0 commit comments