@@ -89,12 +89,15 @@ impl<'tcx> NonConstOp<'tcx> for ConditionallyConstCall<'tcx> {
89
89
}
90
90
91
91
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
92
- ccx. dcx ( ) . create_err ( errors:: ConditionallyConstCall {
93
- span,
94
- def_path_str : ccx. tcx . def_path_str_with_args ( self . callee , self . args ) ,
95
- def_descr : ccx. tcx . def_descr ( self . callee ) ,
96
- kind : ccx. const_kind ( ) ,
97
- } )
92
+ ccx. tcx . sess . create_feature_err (
93
+ errors:: ConditionallyConstCall {
94
+ span,
95
+ def_path_str : ccx. tcx . def_path_str_with_args ( self . callee , self . args ) ,
96
+ def_descr : ccx. tcx . def_descr ( self . callee ) ,
97
+ kind : ccx. const_kind ( ) ,
98
+ } ,
99
+ sym:: const_trait_impl,
100
+ )
98
101
}
99
102
}
100
103
@@ -417,15 +420,8 @@ impl<'tcx> NonConstOp<'tcx> for Coroutine {
417
420
418
421
fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
419
422
let msg = format ! ( "{:#}s are not allowed in {}s" , self . 0 , ccx. const_kind( ) ) ;
420
- if let hir:: CoroutineKind :: Desugared (
421
- hir:: CoroutineDesugaring :: Async ,
422
- hir:: CoroutineSource :: Block ,
423
- ) = self . 0
424
- {
425
- ccx. tcx . sess . create_feature_err (
426
- errors:: UnallowedOpInConstContext { span, msg } ,
427
- sym:: const_async_blocks,
428
- )
423
+ if let Status :: Unstable { gate, .. } = self . status_in_item ( ccx) {
424
+ ccx. tcx . sess . create_feature_err ( errors:: UnallowedOpInConstContext { span, msg } , gate)
429
425
} else {
430
426
ccx. dcx ( ) . create_err ( errors:: UnallowedOpInConstContext { span, msg } )
431
427
}
0 commit comments