File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed
compiler/rustc_infer/src/infer Expand file tree Collapse file tree 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> {
15851585 Ok ( None ) => {
15861586 let tcx = self . tcx ;
15871587 let def_id = unevaluated. def ;
1588- span_bug ! (
1588+ Err ( ErrorHandled :: from ( tcx . sess . span_delayed_bug (
15891589 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+ ) ) )
15931595 }
15941596 Err ( err) => Err ( err) ,
15951597 }
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