From 251878ebc4a86b3f9c94992d89c42d3a0a60cf68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Sat, 18 Jul 2020 00:00:00 +0000 Subject: [PATCH 1/2] Remove CC & CFLAGS from MemorySanitizer example They are now unnecessary for projects written in Rust, since backtrace-rs used by the standard library has only Rust dependencies. --- src/doc/unstable-book/src/compiler-flags/sanitizer.md | 4 ---- 1 file changed, 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 5e2e04c063bc4..c15f339783f7e 100644 --- a/src/doc/unstable-book/src/compiler-flags/sanitizer.md +++ b/src/doc/unstable-book/src/compiler-flags/sanitizer.md @@ -196,10 +196,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 From 58b862072c97c17133f3b700b71edf69ce0a7efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Sat, 18 Jul 2020 00:00:00 +0000 Subject: [PATCH 2/2] Document AddressSanitizer memory leak detection defaults --- src/doc/unstable-book/src/compiler-flags/sanitizer.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/doc/unstable-book/src/compiler-flags/sanitizer.md b/src/doc/unstable-book/src/compiler-flags/sanitizer.md index c15f339783f7e..93908e9190e64 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`