@@ -466,51 +466,50 @@ impl<'a> ReportErrorExt for UndefinedBehaviorInfo<'a> {
466
466
fn diagnostic_message ( & self ) -> DiagMessage {
467
467
use UndefinedBehaviorInfo :: * ;
468
468
469
- use crate :: fluent_generated:: * ;
470
469
match self {
471
470
Ub ( msg) => msg. clone ( ) . into ( ) ,
472
471
Custom ( x) => ( x. msg ) ( ) ,
473
472
ValidationError ( e) => e. diagnostic_message ( ) ,
474
473
475
- Unreachable => const_eval_unreachable,
476
- BoundsCheckFailed { .. } => const_eval_bounds_check_failed,
477
- DivisionByZero => const_eval_division_by_zero,
478
- RemainderByZero => const_eval_remainder_by_zero,
479
- DivisionOverflow => const_eval_division_overflow,
480
- RemainderOverflow => const_eval_remainder_overflow,
481
- PointerArithOverflow => const_eval_pointer_arithmetic_overflow,
482
- ArithOverflow { .. } => const_eval_overflow_arith,
483
- ShiftOverflow { .. } => const_eval_overflow_shift,
484
- InvalidMeta ( InvalidMetaKind :: SliceTooBig ) => const_eval_invalid_meta_slice,
485
- InvalidMeta ( InvalidMetaKind :: TooBig ) => const_eval_invalid_meta,
486
- UnterminatedCString ( _) => const_eval_unterminated_c_string,
487
- PointerUseAfterFree ( _, _) => const_eval_pointer_use_after_free,
488
- PointerOutOfBounds { .. } => const_eval_pointer_out_of_bounds,
489
- DanglingIntPointer { addr : 0 , .. } => const_eval_dangling_null_pointer,
490
- DanglingIntPointer { .. } => const_eval_dangling_int_pointer,
491
- AlignmentCheckFailed { .. } => const_eval_alignment_check_failed,
492
- WriteToReadOnly ( _) => const_eval_write_to_read_only,
493
- DerefFunctionPointer ( _) => const_eval_deref_function_pointer,
494
- DerefVTablePointer ( _) => const_eval_deref_vtable_pointer,
495
- DerefTypeIdPointer ( _) => const_eval_deref_typeid_pointer,
496
- InvalidBool ( _) => const_eval_invalid_bool,
497
- InvalidChar ( _) => const_eval_invalid_char,
498
- InvalidTag ( _) => const_eval_invalid_tag,
499
- InvalidFunctionPointer ( _) => const_eval_invalid_function_pointer,
500
- InvalidVTablePointer ( _) => const_eval_invalid_vtable_pointer,
501
- InvalidVTableTrait { .. } => const_eval_invalid_vtable_trait,
502
- InvalidStr ( _) => const_eval_invalid_str,
503
- InvalidUninitBytes ( None ) => const_eval_invalid_uninit_bytes_unknown,
504
- InvalidUninitBytes ( Some ( _) ) => const_eval_invalid_uninit_bytes,
505
- DeadLocal => const_eval_dead_local,
506
- ScalarSizeMismatch ( _) => const_eval_scalar_size_mismatch,
507
- UninhabitedEnumVariantWritten ( _) => const_eval_uninhabited_enum_variant_written,
508
- UninhabitedEnumVariantRead ( _) => const_eval_uninhabited_enum_variant_read,
474
+ Unreachable => fluent :: const_eval_unreachable,
475
+ BoundsCheckFailed { .. } => fluent :: const_eval_bounds_check_failed,
476
+ DivisionByZero => fluent :: const_eval_division_by_zero,
477
+ RemainderByZero => fluent :: const_eval_remainder_by_zero,
478
+ DivisionOverflow => fluent :: const_eval_division_overflow,
479
+ RemainderOverflow => fluent :: const_eval_remainder_overflow,
480
+ PointerArithOverflow => fluent :: const_eval_pointer_arithmetic_overflow,
481
+ ArithOverflow { .. } => fluent :: const_eval_overflow_arith,
482
+ ShiftOverflow { .. } => fluent :: const_eval_overflow_shift,
483
+ InvalidMeta ( InvalidMetaKind :: SliceTooBig ) => fluent :: const_eval_invalid_meta_slice,
484
+ InvalidMeta ( InvalidMetaKind :: TooBig ) => fluent :: const_eval_invalid_meta,
485
+ UnterminatedCString ( _) => fluent :: const_eval_unterminated_c_string,
486
+ PointerUseAfterFree ( _, _) => fluent :: const_eval_pointer_use_after_free,
487
+ PointerOutOfBounds { .. } => fluent :: const_eval_pointer_out_of_bounds,
488
+ DanglingIntPointer { addr : 0 , .. } => fluent :: const_eval_dangling_null_pointer,
489
+ DanglingIntPointer { .. } => fluent :: const_eval_dangling_int_pointer,
490
+ AlignmentCheckFailed { .. } => fluent :: const_eval_alignment_check_failed,
491
+ WriteToReadOnly ( _) => fluent :: const_eval_write_to_read_only,
492
+ DerefFunctionPointer ( _) => fluent :: const_eval_deref_function_pointer,
493
+ DerefVTablePointer ( _) => fluent :: const_eval_deref_vtable_pointer,
494
+ DerefTypeIdPointer ( _) => fluent :: const_eval_deref_typeid_pointer,
495
+ InvalidBool ( _) => fluent :: const_eval_invalid_bool,
496
+ InvalidChar ( _) => fluent :: const_eval_invalid_char,
497
+ InvalidTag ( _) => fluent :: const_eval_invalid_tag,
498
+ InvalidFunctionPointer ( _) => fluent :: const_eval_invalid_function_pointer,
499
+ InvalidVTablePointer ( _) => fluent :: const_eval_invalid_vtable_pointer,
500
+ InvalidVTableTrait { .. } => fluent :: const_eval_invalid_vtable_trait,
501
+ InvalidStr ( _) => fluent :: const_eval_invalid_str,
502
+ InvalidUninitBytes ( None ) => fluent :: const_eval_invalid_uninit_bytes_unknown,
503
+ InvalidUninitBytes ( Some ( _) ) => fluent :: const_eval_invalid_uninit_bytes,
504
+ DeadLocal => fluent :: const_eval_dead_local,
505
+ ScalarSizeMismatch ( _) => fluent :: const_eval_scalar_size_mismatch,
506
+ UninhabitedEnumVariantWritten ( _) => fluent :: const_eval_uninhabited_enum_variant_written,
507
+ UninhabitedEnumVariantRead ( _) => fluent :: const_eval_uninhabited_enum_variant_read,
509
508
InvalidNichedEnumVariantWritten { .. } => {
510
- const_eval_invalid_niched_enum_variant_written
509
+ fluent :: const_eval_invalid_niched_enum_variant_written
511
510
}
512
- AbiMismatchArgument { .. } => const_eval_incompatible_arg_types,
513
- AbiMismatchReturn { .. } => const_eval_incompatible_return_types,
511
+ AbiMismatchArgument { .. } => fluent :: const_eval_incompatible_arg_types,
512
+ AbiMismatchReturn { .. } => fluent :: const_eval_incompatible_return_types,
514
513
}
515
514
}
516
515
@@ -653,80 +652,79 @@ impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
653
652
fn diagnostic_message ( & self ) -> DiagMessage {
654
653
use rustc_middle:: mir:: interpret:: ValidationErrorKind :: * ;
655
654
656
- use crate :: fluent_generated:: * ;
657
655
match self . kind {
658
656
PtrToUninhabited { ptr_kind : PointerKind :: Box , .. } => {
659
- const_eval_validation_box_to_uninhabited
657
+ fluent :: const_eval_validation_box_to_uninhabited
660
658
}
661
659
PtrToUninhabited { ptr_kind : PointerKind :: Ref ( _) , .. } => {
662
- const_eval_validation_ref_to_uninhabited
663
- }
664
-
665
- PointerAsInt { .. } => const_eval_validation_pointer_as_int,
666
- PartialPointer => const_eval_validation_partial_pointer,
667
- MutableRefToImmutable => const_eval_validation_mutable_ref_to_immutable,
668
- MutableRefInConst => const_eval_validation_mutable_ref_in_const,
669
- NullFnPtr => const_eval_validation_null_fn_ptr,
670
- NeverVal => const_eval_validation_never_val,
671
- NonnullPtrMaybeNull { .. } => const_eval_validation_nonnull_ptr_out_of_range,
672
- PtrOutOfRange { .. } => const_eval_validation_ptr_out_of_range,
673
- OutOfRange { .. } => const_eval_validation_out_of_range,
674
- UnsafeCellInImmutable => const_eval_validation_unsafe_cell,
675
- UninhabitedVal { .. } => const_eval_validation_uninhabited_val,
676
- InvalidEnumTag { .. } => const_eval_validation_invalid_enum_tag,
677
- UninhabitedEnumVariant => const_eval_validation_uninhabited_enum_variant,
678
- Uninit { .. } => const_eval_validation_uninit,
679
- InvalidVTablePtr { .. } => const_eval_validation_invalid_vtable_ptr,
680
- InvalidMetaWrongTrait { .. } => const_eval_validation_invalid_vtable_trait,
660
+ fluent :: const_eval_validation_ref_to_uninhabited
661
+ }
662
+
663
+ PointerAsInt { .. } => fluent :: const_eval_validation_pointer_as_int,
664
+ PartialPointer => fluent :: const_eval_validation_partial_pointer,
665
+ MutableRefToImmutable => fluent :: const_eval_validation_mutable_ref_to_immutable,
666
+ MutableRefInConst => fluent :: const_eval_validation_mutable_ref_in_const,
667
+ NullFnPtr => fluent :: const_eval_validation_null_fn_ptr,
668
+ NeverVal => fluent :: const_eval_validation_never_val,
669
+ NonnullPtrMaybeNull { .. } => fluent :: const_eval_validation_nonnull_ptr_out_of_range,
670
+ PtrOutOfRange { .. } => fluent :: const_eval_validation_ptr_out_of_range,
671
+ OutOfRange { .. } => fluent :: const_eval_validation_out_of_range,
672
+ UnsafeCellInImmutable => fluent :: const_eval_validation_unsafe_cell,
673
+ UninhabitedVal { .. } => fluent :: const_eval_validation_uninhabited_val,
674
+ InvalidEnumTag { .. } => fluent :: const_eval_validation_invalid_enum_tag,
675
+ UninhabitedEnumVariant => fluent :: const_eval_validation_uninhabited_enum_variant,
676
+ Uninit { .. } => fluent :: const_eval_validation_uninit,
677
+ InvalidVTablePtr { .. } => fluent :: const_eval_validation_invalid_vtable_ptr,
678
+ InvalidMetaWrongTrait { .. } => fluent :: const_eval_validation_invalid_vtable_trait,
681
679
InvalidMetaSliceTooLarge { ptr_kind : PointerKind :: Box } => {
682
- const_eval_validation_invalid_box_slice_meta
680
+ fluent :: const_eval_validation_invalid_box_slice_meta
683
681
}
684
682
InvalidMetaSliceTooLarge { ptr_kind : PointerKind :: Ref ( _) } => {
685
- const_eval_validation_invalid_ref_slice_meta
683
+ fluent :: const_eval_validation_invalid_ref_slice_meta
686
684
}
687
685
688
686
InvalidMetaTooLarge { ptr_kind : PointerKind :: Box } => {
689
- const_eval_validation_invalid_box_meta
687
+ fluent :: const_eval_validation_invalid_box_meta
690
688
}
691
689
InvalidMetaTooLarge { ptr_kind : PointerKind :: Ref ( _) } => {
692
- const_eval_validation_invalid_ref_meta
690
+ fluent :: const_eval_validation_invalid_ref_meta
693
691
}
694
692
UnalignedPtr { ptr_kind : PointerKind :: Ref ( _) , .. } => {
695
- const_eval_validation_unaligned_ref
693
+ fluent:: const_eval_validation_unaligned_ref
694
+ }
695
+ UnalignedPtr { ptr_kind : PointerKind :: Box , .. } => {
696
+ fluent:: const_eval_validation_unaligned_box
696
697
}
697
- UnalignedPtr { ptr_kind : PointerKind :: Box , .. } => const_eval_validation_unaligned_box,
698
698
699
- NullPtr { ptr_kind : PointerKind :: Box , .. } => const_eval_validation_null_box,
700
- NullPtr { ptr_kind : PointerKind :: Ref ( _) , .. } => const_eval_validation_null_ref,
699
+ NullPtr { ptr_kind : PointerKind :: Box , .. } => fluent :: const_eval_validation_null_box,
700
+ NullPtr { ptr_kind : PointerKind :: Ref ( _) , .. } => fluent :: const_eval_validation_null_ref,
701
701
DanglingPtrNoProvenance { ptr_kind : PointerKind :: Box , .. } => {
702
- const_eval_validation_dangling_box_no_provenance
702
+ fluent :: const_eval_validation_dangling_box_no_provenance
703
703
}
704
704
DanglingPtrNoProvenance { ptr_kind : PointerKind :: Ref ( _) , .. } => {
705
- const_eval_validation_dangling_ref_no_provenance
705
+ fluent :: const_eval_validation_dangling_ref_no_provenance
706
706
}
707
707
DanglingPtrOutOfBounds { ptr_kind : PointerKind :: Box } => {
708
- const_eval_validation_dangling_box_out_of_bounds
708
+ fluent :: const_eval_validation_dangling_box_out_of_bounds
709
709
}
710
710
DanglingPtrOutOfBounds { ptr_kind : PointerKind :: Ref ( _) } => {
711
- const_eval_validation_dangling_ref_out_of_bounds
711
+ fluent :: const_eval_validation_dangling_ref_out_of_bounds
712
712
}
713
713
DanglingPtrUseAfterFree { ptr_kind : PointerKind :: Box } => {
714
- const_eval_validation_dangling_box_use_after_free
714
+ fluent :: const_eval_validation_dangling_box_use_after_free
715
715
}
716
716
DanglingPtrUseAfterFree { ptr_kind : PointerKind :: Ref ( _) } => {
717
- const_eval_validation_dangling_ref_use_after_free
717
+ fluent :: const_eval_validation_dangling_ref_use_after_free
718
718
}
719
- InvalidBool { .. } => const_eval_validation_invalid_bool,
720
- InvalidChar { .. } => const_eval_validation_invalid_char,
721
- InvalidFnPtr { .. } => const_eval_validation_invalid_fn_ptr,
719
+ InvalidBool { .. } => fluent :: const_eval_validation_invalid_bool,
720
+ InvalidChar { .. } => fluent :: const_eval_validation_invalid_char,
721
+ InvalidFnPtr { .. } => fluent :: const_eval_validation_invalid_fn_ptr,
722
722
}
723
723
}
724
724
725
725
fn add_args < G : EmissionGuarantee > ( self , err : & mut Diag < ' _ , G > ) {
726
726
use rustc_middle:: mir:: interpret:: ValidationErrorKind :: * ;
727
727
728
- use crate :: fluent_generated as fluent;
729
-
730
728
if let PointerAsInt { .. } | PartialPointer = self . kind {
731
729
err. help ( fluent:: const_eval_ptr_as_bytes_1) ;
732
730
err. help ( fluent:: const_eval_ptr_as_bytes_2) ;
@@ -841,25 +839,23 @@ impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
841
839
842
840
impl ReportErrorExt for UnsupportedOpInfo {
843
841
fn diagnostic_message ( & self ) -> DiagMessage {
844
- use crate :: fluent_generated:: * ;
845
842
match self {
846
843
UnsupportedOpInfo :: Unsupported ( s) => s. clone ( ) . into ( ) ,
847
- UnsupportedOpInfo :: ExternTypeField => const_eval_extern_type_field,
848
- UnsupportedOpInfo :: UnsizedLocal => const_eval_unsized_local,
849
- UnsupportedOpInfo :: ReadPartialPointer ( _) => const_eval_partial_pointer_read,
850
- UnsupportedOpInfo :: ReadPointerAsInt ( _) => const_eval_read_pointer_as_int,
851
- UnsupportedOpInfo :: ThreadLocalStatic ( _) => const_eval_thread_local_static,
852
- UnsupportedOpInfo :: ExternStatic ( _) => const_eval_extern_static,
844
+ UnsupportedOpInfo :: ExternTypeField => fluent :: const_eval_extern_type_field,
845
+ UnsupportedOpInfo :: UnsizedLocal => fluent :: const_eval_unsized_local,
846
+ UnsupportedOpInfo :: ReadPartialPointer ( _) => fluent :: const_eval_partial_pointer_read,
847
+ UnsupportedOpInfo :: ReadPointerAsInt ( _) => fluent :: const_eval_read_pointer_as_int,
848
+ UnsupportedOpInfo :: ThreadLocalStatic ( _) => fluent :: const_eval_thread_local_static,
849
+ UnsupportedOpInfo :: ExternStatic ( _) => fluent :: const_eval_extern_static,
853
850
}
854
851
}
855
852
856
853
fn add_args < G : EmissionGuarantee > ( self , diag : & mut Diag < ' _ , G > ) {
857
854
use UnsupportedOpInfo :: * ;
858
855
859
- use crate :: fluent_generated:: * ;
860
856
if let ReadPointerAsInt ( _) | ReadPartialPointer ( _) = self {
861
- diag. help ( const_eval_ptr_as_bytes_1) ;
862
- diag. help ( const_eval_ptr_as_bytes_2) ;
857
+ diag. help ( fluent :: const_eval_ptr_as_bytes_1) ;
858
+ diag. help ( fluent :: const_eval_ptr_as_bytes_2) ;
863
859
}
864
860
match self {
865
861
// `ReadPointerAsInt(Some(info))` is never printed anyway, it only serves as an error to
@@ -904,10 +900,9 @@ impl<'tcx> ReportErrorExt for InterpErrorKind<'tcx> {
904
900
905
901
impl < ' tcx > ReportErrorExt for InvalidProgramInfo < ' tcx > {
906
902
fn diagnostic_message ( & self ) -> DiagMessage {
907
- use crate :: fluent_generated:: * ;
908
903
match self {
909
- InvalidProgramInfo :: TooGeneric => const_eval_too_generic,
910
- InvalidProgramInfo :: AlreadyReported ( _) => const_eval_already_reported,
904
+ InvalidProgramInfo :: TooGeneric => fluent :: const_eval_too_generic,
905
+ InvalidProgramInfo :: AlreadyReported ( _) => fluent :: const_eval_already_reported,
911
906
InvalidProgramInfo :: Layout ( e) => e. diagnostic_message ( ) ,
912
907
}
913
908
}
@@ -929,12 +924,13 @@ impl<'tcx> ReportErrorExt for InvalidProgramInfo<'tcx> {
929
924
930
925
impl ReportErrorExt for ResourceExhaustionInfo {
931
926
fn diagnostic_message ( & self ) -> DiagMessage {
932
- use crate :: fluent_generated:: * ;
933
927
match self {
934
- ResourceExhaustionInfo :: StackFrameLimitReached => const_eval_stack_frame_limit_reached,
935
- ResourceExhaustionInfo :: MemoryExhausted => const_eval_memory_exhausted,
936
- ResourceExhaustionInfo :: AddressSpaceFull => const_eval_address_space_full,
937
- ResourceExhaustionInfo :: Interrupted => const_eval_interrupted,
928
+ ResourceExhaustionInfo :: StackFrameLimitReached => {
929
+ fluent:: const_eval_stack_frame_limit_reached
930
+ }
931
+ ResourceExhaustionInfo :: MemoryExhausted => fluent:: const_eval_memory_exhausted,
932
+ ResourceExhaustionInfo :: AddressSpaceFull => fluent:: const_eval_address_space_full,
933
+ ResourceExhaustionInfo :: Interrupted => fluent:: const_eval_interrupted,
938
934
}
939
935
}
940
936
fn add_args < G : EmissionGuarantee > ( self , _: & mut Diag < ' _ , G > ) { }
0 commit comments