@@ -355,31 +355,6 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
355355 }
356356}
357357
358- #[ derive( Debug ) ]
359- pub struct FnPtrCast ;
360- impl < ' tcx > NonConstOp < ' tcx > for FnPtrCast {
361- fn status_in_item ( & self , ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
362- if ccx. const_kind ( ) != hir:: ConstContext :: ConstFn {
363- Status :: Allowed
364- } else {
365- Status :: Unstable ( sym:: const_fn_fn_ptr_basics)
366- }
367- }
368-
369- fn build_error (
370- & self ,
371- ccx : & ConstCx < ' _ , ' tcx > ,
372- span : Span ,
373- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
374- feature_err (
375- & ccx. tcx . sess . parse_sess ,
376- sym:: const_fn_fn_ptr_basics,
377- span,
378- & format ! ( "function pointer casts are not allowed in {}s" , ccx. const_kind( ) ) ,
379- )
380- }
381- }
382-
383358#[ derive( Debug ) ]
384359pub struct Generator ( pub hir:: GeneratorKind ) ;
385360impl < ' tcx > NonConstOp < ' tcx > for Generator {
@@ -821,40 +796,6 @@ pub mod ty {
821796 }
822797 }
823798
824- #[ derive( Debug ) ]
825- pub struct FnPtr ( pub mir:: LocalKind ) ;
826- impl < ' tcx > NonConstOp < ' tcx > for FnPtr {
827- fn importance ( & self ) -> DiagnosticImportance {
828- match self . 0 {
829- mir:: LocalKind :: Var | mir:: LocalKind :: Temp => DiagnosticImportance :: Secondary ,
830- mir:: LocalKind :: ReturnPointer | mir:: LocalKind :: Arg => {
831- DiagnosticImportance :: Primary
832- }
833- }
834- }
835-
836- fn status_in_item ( & self , ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
837- if ccx. const_kind ( ) != hir:: ConstContext :: ConstFn {
838- Status :: Allowed
839- } else {
840- Status :: Unstable ( sym:: const_fn_fn_ptr_basics)
841- }
842- }
843-
844- fn build_error (
845- & self ,
846- ccx : & ConstCx < ' _ , ' tcx > ,
847- span : Span ,
848- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
849- feature_err (
850- & ccx. tcx . sess . parse_sess ,
851- sym:: const_fn_fn_ptr_basics,
852- span,
853- & format ! ( "function pointers cannot appear in {}s" , ccx. const_kind( ) ) ,
854- )
855- }
856- }
857-
858799 #[ derive( Debug ) ]
859800 pub struct ImplTrait ;
860801 impl < ' tcx > NonConstOp < ' tcx > for ImplTrait {
@@ -876,49 +817,6 @@ pub mod ty {
876817 }
877818 }
878819
879- #[ derive( Debug ) ]
880- pub struct TraitBound ( pub mir:: LocalKind ) ;
881- impl < ' tcx > NonConstOp < ' tcx > for TraitBound {
882- fn importance ( & self ) -> DiagnosticImportance {
883- match self . 0 {
884- mir:: LocalKind :: Var | mir:: LocalKind :: Temp => DiagnosticImportance :: Secondary ,
885- mir:: LocalKind :: ReturnPointer | mir:: LocalKind :: Arg => {
886- DiagnosticImportance :: Primary
887- }
888- }
889- }
890-
891- fn status_in_item ( & self , ccx : & ConstCx < ' _ , ' tcx > ) -> Status {
892- if ccx. const_kind ( ) != hir:: ConstContext :: ConstFn {
893- Status :: Allowed
894- } else {
895- Status :: Unstable ( sym:: const_fn_trait_bound)
896- }
897- }
898-
899- fn build_error (
900- & self ,
901- ccx : & ConstCx < ' _ , ' tcx > ,
902- span : Span ,
903- ) -> DiagnosticBuilder < ' tcx , ErrorGuaranteed > {
904- let mut err = feature_err (
905- & ccx. tcx . sess . parse_sess ,
906- sym:: const_fn_trait_bound,
907- span,
908- "trait bounds other than `Sized` on const fn parameters are unstable" ,
909- ) ;
910-
911- match ccx. fn_sig ( ) {
912- Some ( fn_sig) if !fn_sig. span . contains ( span) => {
913- err. span_label ( fn_sig. span , "function declared as const here" ) ;
914- }
915- _ => { }
916- }
917-
918- err
919- }
920- }
921-
922820 #[ derive( Debug ) ]
923821 pub struct DynTrait ( pub mir:: LocalKind ) ;
924822 impl < ' tcx > NonConstOp < ' tcx > for DynTrait {
0 commit comments