@@ -67,6 +67,7 @@ pub enum TypeError<'tcx> {
67
67
) ,
68
68
ObjectUnsafeCoercion ( DefId ) ,
69
69
ConstMismatch ( ExpectedFound < & ' tcx ty:: Const < ' tcx > > ) ,
70
+ ConstMismatchTooGeneric ( ExpectedFound < & ' tcx ty:: Const < ' tcx > > , Option < String > ) ,
70
71
71
72
IntrinsicCast ,
72
73
/// Safe `#[target_feature]` functions are not assignable to safe function pointers.
@@ -201,6 +202,12 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
201
202
ConstMismatch ( ref values) => {
202
203
write ! ( f, "expected `{}`, found `{}`" , values. expected, values. found)
203
204
}
205
+ ConstMismatchTooGeneric ( ref values, ref suggestion) => match suggestion {
206
+ Some ( sugg) => {
207
+ write ! ( f, "expected `{}`, found `{}`" , values. expected, sugg)
208
+ }
209
+ None => write ! ( f, "expected `{}`, found `{}`" , values. expected, values. found) ,
210
+ } ,
204
211
IntrinsicCast => write ! ( f, "cannot coerce intrinsics to function pointers" ) ,
205
212
TargetFeatureCast ( _) => write ! (
206
213
f,
@@ -233,6 +240,7 @@ impl<'tcx> TypeError<'tcx> {
233
240
| ProjectionMismatched ( _)
234
241
| ExistentialMismatch ( _)
235
242
| ConstMismatch ( _)
243
+ | ConstMismatchTooGeneric ( _, _)
236
244
| IntrinsicCast
237
245
| ObjectUnsafeCoercion ( _) => true ,
238
246
}
0 commit comments