@@ -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;
@@ -6098,20 +6098,20 @@ impl<'tcx> ctxt<'tcx> {
6098
6098
found) ;
6099
6099
}
6100
6100
Err ( err) => {
6101
- let err_description = err. description ( ) ;
6102
- let found = match count_expr. node {
6101
+ let err_msg = match count_expr. node {
6103
6102
ast:: ExprPath ( None , ast:: Path {
6104
6103
global : false ,
6105
6104
ref segments,
6106
6105
..
6107
6106
} ) if segments. len ( ) == 1 =>
6108
- format ! ( "{}" , "found variable" ) ,
6109
- _ =>
6110
- format ! ( "but {}" , err_description) ,
6107
+ format ! ( "found variable" ) ,
6108
+ _ => match err. kind {
6109
+ ErrKind :: MiscCatchAll => format ! ( "but found {}" , err. description( ) ) ,
6110
+ _ => format ! ( "but {}" , err. description( ) )
6111
+ }
6111
6112
} ;
6112
6113
span_err ! ( self . sess, count_expr. span, E0307 ,
6113
- "expected constant integer for repeat count, {}" ,
6114
- found) ;
6114
+ "expected constant integer for repeat count, {}" , err_msg) ;
6115
6115
}
6116
6116
}
6117
6117
0
0 commit comments