@@ -44,7 +44,7 @@ use metadata::csearch;
44
44
use middle;
45
45
use middle:: cast;
46
46
use middle:: check_const;
47
- use middle:: const_eval:: { self , ConstVal } ;
47
+ use middle:: const_eval:: { self , ConstVal , ErrKind } ;
48
48
use middle:: const_eval:: EvalHint :: UncheckedExprHint ;
49
49
use middle:: def:: { self , DefMap , ExportMap } ;
50
50
use middle:: dependency_format;
@@ -6107,20 +6107,20 @@ impl<'tcx> ctxt<'tcx> {
6107
6107
found) ;
6108
6108
}
6109
6109
Err ( err) => {
6110
- let err_description = err. description ( ) ;
6111
- let found = match count_expr. node {
6110
+ let err_msg = match count_expr. node {
6112
6111
ast:: ExprPath ( None , ast:: Path {
6113
6112
global : false ,
6114
6113
ref segments,
6115
6114
..
6116
6115
} ) 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
+ }
6120
6121
} ;
6121
6122
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) ;
6124
6124
}
6125
6125
}
6126
6126
0
0 commit comments