File tree 3 files changed +26
-4
lines changed
compiler/rustc_infer/src/infer
3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -1585,11 +1585,13 @@ impl<'tcx> InferCtxt<'tcx> {
1585
1585
Ok ( None ) => {
1586
1586
let tcx = self . tcx ;
1587
1587
let def_id = unevaluated. def ;
1588
- span_bug ! (
1588
+ Err ( ErrorHandled :: from ( tcx . sess . span_delayed_bug (
1589
1589
tcx. def_span ( def_id) ,
1590
- "unable to construct a constant value for the unevaluated constant {:?}" ,
1591
- unevaluated
1592
- ) ;
1590
+ format ! (
1591
+ "unable to construct a constant value for the unevaluated constant {:?}" ,
1592
+ unevaluated
1593
+ ) ,
1594
+ ) ) )
1593
1595
}
1594
1596
Err ( err) => Err ( err) ,
1595
1597
}
Original file line number Diff line number Diff line change
1
+ #![ feature( generic_const_exprs) ]
2
+ #![ allow( incomplete_features) ]
3
+
4
+ struct Checked < const F : fn ( ) > ;
5
+ //~^ERROR: using function pointers as const generic parameters is forbidden
6
+
7
+ fn foo ( ) { }
8
+ const _: Checked < foo > = Checked :: < foo > ;
9
+
10
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: using function pointers as const generic parameters is forbidden
2
+ --> $DIR/issue-118545.rs:4:25
3
+ |
4
+ LL | struct Checked<const F: fn()>;
5
+ | ^^^^
6
+ |
7
+ = note: the only supported types are integers, `bool` and `char`
8
+
9
+ error: aborting due to 1 previous error
10
+
You can’t perform that action at this time.
0 commit comments