Skip to content

Commit 15f8b80

Browse files
authored
Rollup merge of #74522 - tmiasko:sanitizer-docs, r=nikomatsakis
Update sanitizer docs * Document AddressSanitizer memory leak detection defaults. * Remove CC & CFLAGS from MemorySanitizer example - they are now unnecessary for pure Rust projects (backtrace-rs moved away from libbacktrace).
2 parents 6467f6f + 58b8620 commit 15f8b80

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/doc/unstable-book/src/compiler-flags/sanitizer.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ of bugs:
2626
* Double-free, invalid free
2727
* Memory leaks
2828

29+
The memory leak detection is enabled by default on Linux, and can be enabled
30+
with runtime flag `ASAN_OPTIONS=detect_leaks=1` on macOS.
31+
2932
AddressSanitizer is supported on the following targets:
3033

3134
* `x86_64-apple-darwin`
@@ -196,10 +199,6 @@ fn main() {
196199
197200
```shell
198201
$ export \
199-
CC=clang \
200-
CXX=clang++ \
201-
CFLAGS='-fsanitize=memory -fsanitize-memory-track-origins' \
202-
CXXFLAGS='-fsanitize=memory -fsanitize-memory-track-origins' \
203202
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins' \
204203
RUSTDOCFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins'
205204
$ cargo clean

0 commit comments

Comments
 (0)