@@ -393,16 +393,17 @@ impl Subdiagnostic for FrameNote {
393393 }
394394 let msg = diag. eagerly_translate ( inline_fluent ! (
395395 r#"{$times ->
396- [0] {const_eval_frame_note_inner}
397- *[other] [... {$times} additional calls {const_eval_frame_note_inner} ...]
398- }
399-
400- const_eval_frame_note_inner = inside {$where_ ->
401- [closure] closure
402- [instance] `{$instance}`
403- *[other] {""}
404- }
405- "#
396+ [0] inside {$where_ ->
397+ [closure] closure
398+ [instance] `{$instance}`
399+ *[other] {""}
400+ }
401+ *[other] [... {$times} additional calls inside {$where_ ->
402+ [closure] closure
403+ [instance] `{$instance}`
404+ *[other] {""}
405+ } ...]
406+ }"#
406407 ) ) ;
407408 diag. remove_arg ( "times" ) ;
408409 diag. remove_arg ( "where_" ) ;
@@ -663,89 +664,96 @@ impl<'a> ReportErrorExt for UndefinedBehaviorInfo<'a> {
663664 InvalidMeta ( InvalidMetaKind :: SliceTooBig ) => "invalid metadata in wide pointer: slice is bigger than largest supported object" . into ( ) ,
664665 InvalidMeta ( InvalidMetaKind :: TooBig ) => "invalid metadata in wide pointer: total size is bigger than largest supported object" . into ( ) ,
665666 UnterminatedCString ( _) => "reading a null-terminated string starting at {$pointer} with no null found before end of allocation" . into ( ) ,
666- PointerUseAfterFree ( _, _) => inline_fluent ! ( "{$operation ->
667- [MemoryAccess] memory access failed
668- [InboundsPointerArithmetic] in-bounds pointer arithmetic failed
669- *[Dereferenceable] pointer not dereferenceable
670- }: {$alloc_id} has been freed, so this pointer is dangling" ) ,
671- PointerOutOfBounds { .. } => inline_fluent ! ( "{$operation ->
672- [MemoryAccess] memory access failed
673- [InboundsPointerArithmetic] in-bounds pointer arithmetic failed
674- *[Dereferenceable] pointer not dereferenceable
675- }: {$operation ->
676- [MemoryAccess] attempting to access {$inbounds_size ->
677- [1] 1 byte
678- *[x] {$inbounds_size} bytes
679- }
680- [InboundsPointerArithmetic] attempting to offset pointer by {$inbounds_size ->
681- [1] 1 byte
682- *[x] {$inbounds_size} bytes
683- }
684- *[Dereferenceable] pointer must {$inbounds_size ->
685- [0] point to some allocation
686- [1] be dereferenceable for 1 byte
687- *[x] be dereferenceable for {$inbounds_size} bytes
688- }
689- }, but got {$pointer} which {$ptr_offset_is_neg ->
690- [true] points to before the beginning of the allocation
691- *[false] {$inbounds_size_is_neg ->
692- [false] {$alloc_size_minus_ptr_offset ->
693- [0] is at or beyond the end of the allocation of size {$alloc_size ->
694- [1] 1 byte
695- *[x] {$alloc_size} bytes
696- }
697- [1] is only 1 byte from the end of the allocation
698- *[x] is only {$alloc_size_minus_ptr_offset} bytes from the end of the allocation
699- }
700- *[true] {$ptr_offset_abs ->
701- [0] is at the beginning of the allocation
702- *[other] is only {$ptr_offset_abs} bytes from the beginning of the allocation
703- }
704- }
705- }
706- " ) ,
707- DanglingIntPointer { addr : 0 , .. } => inline_fluent ! ( "{$operation ->
708- [MemoryAccess] memory access failed
709- [InboundsPointerArithmetic] in-bounds pointer arithmetic failed
710- *[Dereferenceable] pointer not dereferenceable
711- }: {$operation ->
712- [MemoryAccess] attempting to access {$inbounds_size ->
713- [1] 1 byte
714- *[x] {$inbounds_size} bytes
715- }
716- [InboundsPointerArithmetic] attempting to offset pointer by {$inbounds_size ->
717- [1] 1 byte
718- *[x] {$inbounds_size} bytes
719- }
720- *[Dereferenceable] pointer must {$inbounds_size ->
721- [0] point to some allocation
722- [1] be dereferenceable for 1 byte
723- *[x] be dereferenceable for {$inbounds_size} bytes
724- }
725- }, but got null pointer" ) ,
726- DanglingIntPointer { .. } => inline_fluent ! ( "{$operation ->
727- [MemoryAccess] memory access failed
728- [InboundsPointerArithmetic] in-bounds pointer arithmetic failed
729- *[Dereferenceable] pointer not dereferenceable
730- }: {$operation ->
731- [MemoryAccess] attempting to access {$inbounds_size ->
732- [1] 1 byte
733- *[x] {$inbounds_size} bytes
734- }
735- [InboundsPointerArithmetic] attempting to offset pointer by {$inbounds_size ->
736- [1] 1 byte
737- *[x] {$inbounds_size} bytes
738- }
739- *[Dereferenceable] pointer must {$inbounds_size ->
740- [0] point to some allocation
741- [1] be dereferenceable for 1 byte
742- *[x] be dereferenceable for {$inbounds_size} bytes
743- }
744- }, but got {$pointer} which is a dangling pointer (it has no provenance)" ) ,
745- AlignmentCheckFailed { .. } => inline_fluent ! ( "{$msg ->
746- [AccessedPtr] accessing memory
747- *[other] accessing memory based on pointer
748- } with alignment {$has}, but alignment {$required} is required" ) ,
667+ PointerUseAfterFree ( _, _) => inline_fluent ! (
668+ "{$operation ->
669+ [MemoryAccess] memory access failed
670+ [InboundsPointerArithmetic] in-bounds pointer arithmetic failed
671+ *[Dereferenceable] pointer not dereferenceable
672+ }: {$alloc_id} has been freed, so this pointer is dangling"
673+ ) ,
674+ PointerOutOfBounds { .. } => inline_fluent ! (
675+ "{$operation ->
676+ [MemoryAccess] memory access failed
677+ [InboundsPointerArithmetic] in-bounds pointer arithmetic failed
678+ *[Dereferenceable] pointer not dereferenceable
679+ }: {$operation ->
680+ [MemoryAccess] attempting to access {$inbounds_size ->
681+ [1] 1 byte
682+ *[x] {$inbounds_size} bytes
683+ }
684+ [InboundsPointerArithmetic] attempting to offset pointer by {$inbounds_size ->
685+ [1] 1 byte
686+ *[x] {$inbounds_size} bytes
687+ }
688+ *[Dereferenceable] pointer must {$inbounds_size ->
689+ [0] point to some allocation
690+ [1] be dereferenceable for 1 byte
691+ *[x] be dereferenceable for {$inbounds_size} bytes
692+ }
693+ }, but got {$pointer} which {$ptr_offset_is_neg ->
694+ [true] points to before the beginning of the allocation
695+ *[false] {$inbounds_size_is_neg ->
696+ [false] {$alloc_size_minus_ptr_offset ->
697+ [0] is at or beyond the end of the allocation of size {$alloc_size ->
698+ [1] 1 byte
699+ *[x] {$alloc_size} bytes
700+ }
701+ [1] is only 1 byte from the end of the allocation
702+ *[x] is only {$alloc_size_minus_ptr_offset} bytes from the end of the allocation
703+ }
704+ *[true] {$ptr_offset_abs ->
705+ [0] is at the beginning of the allocation
706+ *[other] is only {$ptr_offset_abs} bytes from the beginning of the allocation
707+ }
708+ }
709+ }"
710+ ) ,
711+ DanglingIntPointer { addr : 0 , .. } => inline_fluent ! (
712+ "{$operation ->
713+ [MemoryAccess] memory access failed
714+ [InboundsPointerArithmetic] in-bounds pointer arithmetic failed
715+ *[Dereferenceable] pointer not dereferenceable
716+ }: {$operation ->
717+ [MemoryAccess] attempting to access {$inbounds_size ->
718+ [1] 1 byte
719+ *[x] {$inbounds_size} bytes
720+ }
721+ [InboundsPointerArithmetic] attempting to offset pointer by {$inbounds_size ->
722+ [1] 1 byte
723+ *[x] {$inbounds_size} bytes
724+ }
725+ *[Dereferenceable] pointer must {$inbounds_size ->
726+ [0] point to some allocation
727+ [1] be dereferenceable for 1 byte
728+ *[x] be dereferenceable for {$inbounds_size} bytes
729+ }
730+ }, but got null pointer" ) ,
731+ DanglingIntPointer { .. } => inline_fluent ! (
732+ "{$operation ->
733+ [MemoryAccess] memory access failed
734+ [InboundsPointerArithmetic] in-bounds pointer arithmetic failed
735+ *[Dereferenceable] pointer not dereferenceable
736+ }: {$operation ->
737+ [MemoryAccess] attempting to access {$inbounds_size ->
738+ [1] 1 byte
739+ *[x] {$inbounds_size} bytes
740+ }
741+ [InboundsPointerArithmetic] attempting to offset pointer by {$inbounds_size ->
742+ [1] 1 byte
743+ *[x] {$inbounds_size} bytes
744+ }
745+ *[Dereferenceable] pointer must {$inbounds_size ->
746+ [0] point to some allocation
747+ [1] be dereferenceable for 1 byte
748+ *[x] be dereferenceable for {$inbounds_size} bytes
749+ }
750+ }, but got {$pointer} which is a dangling pointer (it has no provenance)" ) ,
751+ AlignmentCheckFailed { .. } => inline_fluent ! (
752+ "{$msg ->
753+ [AccessedPtr] accessing memory
754+ *[other] accessing memory based on pointer
755+ } with alignment {$has}, but alignment {$required} is required"
756+ ) ,
749757 WriteToReadOnly ( _) => inline_fluent ! ( "writing to {$allocation} which is read-only" ) ,
750758 DerefFunctionPointer ( _) => inline_fluent ! ( "accessing {$allocation} which contains a function" ) ,
751759 DerefVTablePointer ( _) => inline_fluent ! ( "accessing {$allocation} which contains a vtable" ) ,
@@ -936,9 +944,9 @@ impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
936944 NullFnPtr { .. } => {
937945 inline_fluent ! (
938946 "{$front_matter}: encountered a {$maybe ->
939- [true] maybe-null
940- *[false] null
941- } function pointer"
947+ [true] maybe-null
948+ *[false] null
949+ } function pointer"
942950 )
943951 }
944952 NeverVal => {
@@ -1021,17 +1029,17 @@ impl<'tcx> ReportErrorExt for ValidationErrorInfo<'tcx> {
10211029 NullPtr { ptr_kind : PointerKind :: Box , .. } => {
10221030 inline_fluent ! (
10231031 "{$front_matter}: encountered a {$maybe ->
1024- [true] maybe-null
1025- *[false] null
1026- } box"
1032+ [true] maybe-null
1033+ *[false] null
1034+ } box"
10271035 )
10281036 }
10291037 NullPtr { ptr_kind : PointerKind :: Ref ( _) , .. } => {
10301038 inline_fluent ! (
10311039 "{$front_matter}: encountered a {$maybe ->
1032- [true] maybe-null
1033- *[false] null
1034- } reference"
1040+ [true] maybe-null
1041+ *[false] null
1042+ } reference"
10351043 )
10361044 }
10371045 DanglingPtrNoProvenance { ptr_kind : PointerKind :: Box , .. } => {
0 commit comments