]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #57984 - phansch:improve_check_ty_error, r=zackmdavis
authorMazdak Farrokhzad <twingoow@gmail.com>
Thu, 31 Jan 2019 01:10:47 +0000 (02:10 +0100)
committerGitHub <noreply@github.com>
Thu, 31 Jan 2019 01:10:47 +0000 (02:10 +0100)
Improve bug message in check_ty

This branch was hit in Clippy and I think it would be nice to
show the thing that was unexpected in the bug message.

It's also in line with the other `bug!` messages in `check_ty`.

src/librustc_typeck/collect.rs

index ade84faae8dbd864bc0eb7c0ad4b15199336896b..120467cbd13a08bff3767377c45324a38e26ab0a 100644 (file)
@@ -1303,12 +1303,12 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
             }
         },
 
-        Node::GenericParam(param) => match param.kind {
+        Node::GenericParam(param) => match &param.kind {
             hir::GenericParamKind::Type {
                 default: Some(ref ty),
                 ..
             } => icx.to_ty(ty),
-            _ => bug!("unexpected non-type NodeGenericParam"),
+            x => bug!("unexpected non-type Node::GenericParam: {:?}", x),
         },
 
         x => {