@@ -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:: def:: { self , DefMap , ExportMap } ;
49
49
use middle:: dependency_format;
50
50
use middle:: fast_reject;
@@ -6104,20 +6104,20 @@ impl<'tcx> ctxt<'tcx> {
6104
6104
found) ;
6105
6105
}
6106
6106
Err ( err) => {
6107
- let err_description = err. description ( ) ;
6108
- let found = match count_expr. node {
6107
+ let err_msg = match count_expr. node {
6109
6108
ast:: ExprPath ( None , ast:: Path {
6110
6109
global : false ,
6111
6110
ref segments,
6112
6111
..
6113
6112
} ) if segments. len ( ) == 1 =>
6114
- format ! ( "{}" , "found variable" ) ,
6115
- _ =>
6116
- format ! ( "but {}" , err_description) ,
6113
+ format ! ( "found variable" ) ,
6114
+ _ => match err. kind {
6115
+ ErrKind :: MiscCatchAll => format ! ( "but found {}" , err. description( ) ) ,
6116
+ _ => format ! ( "but {}" , err. description( ) )
6117
+ }
6117
6118
} ;
6118
6119
span_err ! ( self . sess, count_expr. span, E0307 ,
6119
- "expected constant integer for repeat count, {}" ,
6120
- found) ;
6120
+ "expected constant integer for repeat count, {}" , err_msg) ;
6121
6121
}
6122
6122
}
6123
6123
0
0 commit comments