about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-21 01:39:11 +0200
committerGitHub <noreply@github.com>2019-10-21 01:39:11 +0200
commit194d1935d393c635b620cf82bd299868e7bddce1 (patch)
tree1a0e38a4f2ca0422d0622b6b8759ce2bafd79e0b /src/test/rustdoc
parent7979016aff545f7b41cc517031026020b340989d (diff)
parent5db17335a15e5e290bd7505cc37b2177c86b51c1 (diff)
Rollup merge of #65314 - tmiasko:rustdoc-z, r=ollie27
rustdoc: forward -Z options to rustc

Currently rustdoc does not forward `-Z` options to rustc when building
test executables. This makes impossible to use rustdoc to run test
samples when crate under test is instrumented with one of sanitizers
`-Zsanitizer=...`, since the final linking step will not include
sanitizer runtime library.

Forward `-Z` options to rustc to solve the issue.

Helps with #43031.
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/sanitizer-option.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/rustdoc/sanitizer-option.rs b/src/test/rustdoc/sanitizer-option.rs
new file mode 100644
index 00000000000..6af9ed3e33f
--- /dev/null
+++ b/src/test/rustdoc/sanitizer-option.rs
@@ -0,0 +1,17 @@
+// needs-sanitizer-support
+// compile-flags: --test -Z sanitizer=address
+//
+// #43031: Verify that rustdoc passes `-Z` options to rustc. Use an extern
+// function that is provided by the sanitizer runtime, if flag is not passed
+// correctly, then linking will fail.
+
+/// ```
+/// extern {
+///     fn __sanitizer_print_stack_trace();
+/// }
+///
+/// fn main() {
+///     unsafe { __sanitizer_print_stack_trace() };
+/// }
+/// ```
+pub fn z_flag_is_passed_to_rustc() {}