rust/src
bors aa4cfd0809 Auto merge of #134424 - 1c3t3a:null-checks, r=saethlin
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 inserts checks in the same places as the `CheckAlignment` pass and additionally
also inserts checks for `Borrows`, so code like
```rust
let ptr: *const u32 = std::ptr::null();
let val: &u32 = unsafe { &*ptr };
```
will have a check inserted on dereference. This is done because null references
are UB. The alignment check doesn't cover these places, because in `&(*ptr).field`,
the exact requirement is that the final reference must be aligned. This is something to
consider further enhancements of the alignment check.

For now this is implemented as a separate `MirPass`, to make it easy to disable
this check if necessary.

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.

r? `@saethlin`
2025-01-31 15:56:53 +00:00
..
bootstrap Rollup merge of #133429 - EnzymeAD:autodiff-middle, r=oli-obk 2025-01-31 00:26:30 -05:00
build_helper Update username in build helper example 2025-01-28 10:51:30 +01:00
ci ci: use windows 2025 for i686-mingw 2025-01-29 21:26:39 +01:00
doc Auto merge of #136332 - jhpratt:rollup-aa69d0e, r=jhpratt 2025-01-31 09:42:28 +00:00
etc Rollup merge of #135812 - Walnut356:gdb_osstring, r=Mark-Simulacrum 2025-01-26 01:51:15 -05:00
gcc@fd3498bff0 Update GCC version 2024-09-06 16:01:46 +02:00
librustdoc Auto merge of #136318 - matthiaskrgr:rollup-a159mzo, r=matthiaskrgr 2025-01-30 23:11:38 +00:00
llvm-project@7e8c93c87c Update to LLVM 19.1.7 2025-01-14 14:46:09 +01:00
rustc-std-workspace update rustc-std-workspace crates 2024-11-04 07:45:15 +01:00
rustdoc-json-types Rollup merge of #135799 - aDotInTheVoid:skrrt-skrrt-revrrt, r=GuillaumeGomez 2025-01-24 08:08:08 +01:00
tools Auto merge of #134424 - 1c3t3a:null-checks, r=saethlin 2025-01-31 15:56:53 +00:00
README.md
stage0 bump stage0 2025-01-08 20:03:28 +01:00
version bump version 2025-01-03 10:36:06 +01:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.