diff options
| author | Ralf Jung <post@ralfj.de> | 2019-12-02 09:34:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-02 09:34:09 +0100 |
| commit | 8438770e1fc647bc06745cfafc4da32dcc5b85b2 (patch) | |
| tree | e34c4cc093f3d1ebbf71deb279fd2dc047e4e594 /src/doc/unstable-book | |
| parent | f5c81e0a986e4285d3d0fd781a1bd475753eb12c (diff) | |
| parent | c703ff26555bc25739384b2104dfb538ec7435c7 (diff) | |
| download | rust-8438770e1fc647bc06745cfafc4da32dcc5b85b2.tar.gz rust-8438770e1fc647bc06745cfafc4da32dcc5b85b2.zip | |
Rollup merge of #66245 - tmiasko:cfg-sanitize, r=oli-obk
Conditional compilation for sanitizers Configure sanitize option when compiling with a sanitizer to make it possible to execute different code depending on whether given sanitizer is enabled or not.
Diffstat (limited to 'src/doc/unstable-book')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/cfg-sanitize.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/cfg-sanitize.md b/src/doc/unstable-book/src/language-features/cfg-sanitize.md new file mode 100644 index 00000000000..949f24ab9c1 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/cfg-sanitize.md @@ -0,0 +1,36 @@ +# `cfg_sanitize` + +The tracking issue for this feature is: [#39699] + +[#39699]: https://github.com/rust-lang/rust/issues/39699 + +------------------------ + +The `cfg_sanitize` feature makes it possible to execute different code +depending on whether a particular sanitizer is enabled or not. + +## Examples + +``` rust +#![feature(cfg_sanitize)] + +#[cfg(sanitize = "thread")] +fn a() { + // ... +} + +#[cfg(not(sanitize = "thread"))] +fn a() { + // ... +} + +fn b() { + if cfg!(sanitize = "leak") { + // ... + } else { + // ... + } +} + +``` + |
