File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,20 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
159159 panic ! ( "index out of bounds: the len is {len} but the index is {index}" )
160160}
161161
162+ #[ cold]
163+ #[ cfg_attr( not( feature = "panic_immediate_abort" ) , inline( never) ) ]
164+ #[ track_caller]
165+ #[ cfg_attr( not( bootstrap) , lang = "panic_misaligned_pointer_dereference" ) ] // needed by codegen for panic on misaligned pointer deref
166+ fn panic_misaligned_pointer_dereference ( required : usize , found : usize ) -> ! {
167+ if cfg ! ( feature = "panic_immediate_abort" ) {
168+ super :: intrinsics:: abort ( )
169+ }
170+
171+ panic ! (
172+ "misaligned pointer dereference: address must be a multiple of {required:#x} but is {found:#x}"
173+ )
174+ }
175+
162176/// Panic because we cannot unwind out of a function.
163177///
164178/// This function is called directly by the codegen backend, and must not have
You can’t perform that action at this time.
0 commit comments