mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Insert null checks for pointer dereferences when debug assertions are enabled
Similar to how the alignment is already checked, this adds a check for null pointer dereferences in debug mode. It is implemented similarly to the alignment check as a MirPass. This is related to a 2025H1 project goal for better UB checks in debug mode: https://github.com/rust-lang/rust-project-goals/pull/177.
This commit is contained in:
parent
d473536c8e
commit
8196d260e8
@ -411,6 +411,7 @@ language_item_table! {
|
|||||||
PanicLocation, sym::panic_location, panic_location, Target::Struct, GenericRequirement::None;
|
PanicLocation, sym::panic_location, panic_location, Target::Struct, GenericRequirement::None;
|
||||||
PanicImpl, sym::panic_impl, panic_impl, Target::Fn, GenericRequirement::None;
|
PanicImpl, sym::panic_impl, panic_impl, Target::Fn, GenericRequirement::None;
|
||||||
PanicCannotUnwind, sym::panic_cannot_unwind, panic_cannot_unwind, Target::Fn, GenericRequirement::Exact(0);
|
PanicCannotUnwind, sym::panic_cannot_unwind, panic_cannot_unwind, Target::Fn, GenericRequirement::Exact(0);
|
||||||
|
PanicNullPointerDereference, sym::panic_null_pointer_dereference, panic_null_pointer_dereference, Target::Fn, GenericRequirement::None;
|
||||||
/// libstd panic entry point. Necessary for const eval to be able to catch it
|
/// libstd panic entry point. Necessary for const eval to be able to catch it
|
||||||
BeginPanic, sym::begin_panic, begin_panic_fn, Target::Fn, GenericRequirement::None;
|
BeginPanic, sym::begin_panic, begin_panic_fn, Target::Fn, GenericRequirement::None;
|
||||||
|
|
||||||
|
@ -363,6 +363,7 @@ define_symbols! {
|
|||||||
panic_location,
|
panic_location,
|
||||||
panic_misaligned_pointer_dereference,
|
panic_misaligned_pointer_dereference,
|
||||||
panic_nounwind,
|
panic_nounwind,
|
||||||
|
panic_null_pointer_dereference,
|
||||||
panic,
|
panic,
|
||||||
Param,
|
Param,
|
||||||
parse,
|
parse,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user