@@ -44,7 +44,7 @@ use metadata::csearch;
4444use middle;
4545use middle:: cast;
4646use middle:: check_const;
47- use middle:: const_eval:: { self , ConstVal } ;
47+ use middle:: const_eval:: { self , ConstVal , ErrKind } ;
4848use middle:: const_eval:: EvalHint :: UncheckedExprHint ;
4949use middle:: def:: { self , DefMap , ExportMap } ;
5050use middle:: dependency_format;
@@ -6107,20 +6107,20 @@ impl<'tcx> ctxt<'tcx> {
61076107 found) ;
61086108 }
61096109 Err ( err) => {
6110- let err_description = err. description ( ) ;
6111- let found = match count_expr. node {
6110+ let err_msg = match count_expr. node {
61126111 ast:: ExprPath ( None , ast:: Path {
61136112 global : false ,
61146113 ref segments,
61156114 ..
61166115 } ) if segments. len ( ) == 1 =>
6117- format ! ( "{}" , "found variable" ) ,
6118- _ =>
6119- format ! ( "but {}" , err_description) ,
6116+ format ! ( "found variable" ) ,
6117+ _ => match err. kind {
6118+ ErrKind :: MiscCatchAll => format ! ( "but found {}" , err. description( ) ) ,
6119+ _ => format ! ( "but {}" , err. description( ) )
6120+ }
61206121 } ;
61216122 span_err ! ( self . sess, count_expr. span, E0307 ,
6122- "expected constant integer for repeat count, {}" ,
6123- found) ;
6123+ "expected constant integer for repeat count, {}" , err_msg) ;
61246124 }
61256125 }
61266126 0
0 commit comments