@@ -89,12 +89,15 @@ impl<'tcx> NonConstOp<'tcx> for ConditionallyConstCall<'tcx> {
8989 }
9090
9191 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+ )
98101 }
99102}
100103
@@ -417,15 +420,8 @@ impl<'tcx> NonConstOp<'tcx> for Coroutine {
417420
418421 fn build_error ( & self , ccx : & ConstCx < ' _ , ' tcx > , span : Span ) -> Diag < ' tcx > {
419422 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)
429425 } else {
430426 ccx. dcx ( ) . create_err ( errors:: UnallowedOpInConstContext { span, msg } )
431427 }
0 commit comments