diff --git a/src/librustc_mir_build/hair/pattern/mod.rs b/src/librustc_mir_build/hair/pattern/mod.rs index 4fa23906a3568..a5c87bc963f49 100644 --- a/src/librustc_mir_build/hair/pattern/mod.rs +++ b/src/librustc_mir_build/hair/pattern/mod.rs @@ -509,11 +509,6 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { fn lower_pattern_unadjusted(&mut self, pat: &'tcx hir::Pat<'tcx>) -> Pat<'tcx> { let mut ty = self.typeck_results.node_type(pat.hir_id); - if let ty::Error(_) = ty.kind { - // Avoid ICEs (e.g., #50577 and #50585). - return Pat { span: pat.span, ty, kind: Box::new(PatKind::Wild) }; - } - let kind = match pat.kind { hir::PatKind::Wild => PatKind::Wild, diff --git a/src/test/ui/issue-74047.rs b/src/test/ui/issue-74047.rs new file mode 100644 index 0000000000000..2e4f3e675c3b1 --- /dev/null +++ b/src/test/ui/issue-74047.rs @@ -0,0 +1,17 @@ +// edition:2018 + +use std::convert::{TryFrom, TryInto}; +use std::io; + +pub struct MyStream; +pub struct OtherStream; + +pub async fn connect() -> io::Result { + let stream: MyStream = OtherStream.try_into()?; + Ok(stream) +} + +impl TryFrom for MyStream {} +//~^ ERROR: missing + +fn main() {} diff --git a/src/test/ui/issue-74047.stderr b/src/test/ui/issue-74047.stderr new file mode 100644 index 0000000000000..6f477c77cedbd --- /dev/null +++ b/src/test/ui/issue-74047.stderr @@ -0,0 +1,12 @@ +error[E0046]: not all trait items implemented, missing: `Error`, `try_from` + --> $DIR/issue-74047.rs:14:1 + | +LL | impl TryFrom for MyStream {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Error`, `try_from` in implementation + | + = help: implement the missing item: `type Error = Type;` + = help: implement the missing item: `fn try_from(_: T) -> std::result::Result>::Error> { todo!() }` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`.