]> git.lizzy.rs Git - rust.git/blob - src/test/ui/sanitize-cfg.rs
rustdoc: Fix handling of compile errors when running `rustdoc --test`
[rust.git] / src / test / ui / sanitize-cfg.rs
1 // Verifies that when compiling with -Zsanitizer=option,
2 // the `#[cfg(sanitize = "option")]` attribute is configured.
3
4 // needs-sanitizer-support
5 // only-linux
6 // only-x86_64
7 // check-pass
8 // revisions: address leak memory thread
9 //[address]compile-flags: -Zsanitizer=address --cfg address
10 //[leak]compile-flags:    -Zsanitizer=leak    --cfg leak
11 //[memory]compile-flags:  -Zsanitizer=memory  --cfg memory
12 //[thread]compile-flags:  -Zsanitizer=thread  --cfg thread
13
14 #![feature(cfg_sanitize)]
15
16 #[cfg(all(sanitize = "address", address))]
17 fn main() {}
18
19 #[cfg(all(sanitize = "leak", leak))]
20 fn main() {}
21
22 #[cfg(all(sanitize = "memory", memory))]
23 fn main() {}
24
25 #[cfg(all(sanitize = "thread", thread))]
26 fn main() {}