summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-20 12:30:25 -0700
committerGitHub <noreply@github.com>2020-07-20 12:30:25 -0700
commit15f8b80d952de86014ebad8dbcefdb86573320ec (patch)
tree6840bfef3e7b77e4968a9490c1840f582e6afeb5
parent6467f6f494b79cf2125204b6d192ace5cc3c1e87 (diff)
parent58b862072c97c17133f3b700b71edf69ce0a7efe (diff)
downloadrust-15f8b80d952de86014ebad8dbcefdb86573320ec.tar.gz
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).
-rw-r--r--src/doc/unstable-book/src/compiler-flags/sanitizer.md7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/sanitizer.md b/src/doc/unstable-book/src/compiler-flags/sanitizer.md
index 5e2e04c063b..93908e9190e 100644
--- a/src/doc/unstable-book/src/compiler-flags/sanitizer.md
+++ b/src/doc/unstable-book/src/compiler-flags/sanitizer.md
@@ -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`
@@ -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