Skip to content

Commit

Permalink
Rollup merge of #74522 - tmiasko:sanitizer-docs, r=nikomatsakis
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
Manishearth authored Jul 20, 2020
2 parents 6467f6f + 58b8620 commit 15f8b80
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/doc/unstable-book/src/compiler-flags/sanitizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ of bugs:
* Double-free, invalid free
* Memory leaks

The memory leak detection is enabled by default on Linux, and can be enabled
with runtime flag `ASAN_OPTIONS=detect_leaks=1` on macOS.

AddressSanitizer is supported on the following targets:

* `x86_64-apple-darwin`
Expand Down Expand Up @@ -196,10 +199,6 @@ fn main() {
```shell
$ export \
CC=clang \
CXX=clang++ \
CFLAGS='-fsanitize=memory -fsanitize-memory-track-origins' \
CXXFLAGS='-fsanitize=memory -fsanitize-memory-track-origins' \
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins' \
RUSTDOCFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins'
$ cargo clean
Expand Down

0 comments on commit 15f8b80

Please sign in to comment.