about summary refs log tree commit diff
path: root/library/std/src/path.rs
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2025-07-25 17:55:45 -0700
committerJosh Triplett <josh@joshtriplett.org>2025-07-25 22:02:09 -0700
commit1e2d58798fab4aa6275acf3746e1aec5340fc97f (patch)
treefb561695a8315defa3599c3bc6cc9be31a36f977 /library/std/src/path.rs
parent56c5b1df941664567d3c1f820d5861fdb25a3ca4 (diff)
downloadrust-1e2d58798fab4aa6275acf3746e1aec5340fc97f.tar.gz
rust-1e2d58798fab4aa6275acf3746e1aec5340fc97f.zip
Avoid making the start of a doc code block conditional
Placing the opening triple-backquote inside a `cfg_attr` makes many
tools confused, including syntax highlighters (e.g. vim's) and rustfmt.

Instead, use a `cfg` inside the doc code block.
Diffstat (limited to 'library/std/src/path.rs')
-rw-r--r--library/std/src/path.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index d9c34d4fa04..055e7f81480 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -3259,8 +3259,8 @@ impl Path {
     ///
     /// # Examples
     ///
-    #[cfg_attr(unix, doc = "```no_run")]
-    #[cfg_attr(not(unix), doc = "```ignore")]
+    /// ```rust,no_run
+    /// # #[cfg(unix)] {
     /// use std::path::Path;
     /// use std::os::unix::fs::symlink;
     ///
@@ -3268,6 +3268,7 @@ impl Path {
     /// symlink("/origin_does_not_exist/", link_path).unwrap();
     /// assert_eq!(link_path.is_symlink(), true);
     /// assert_eq!(link_path.exists(), false);
+    /// # }
     /// ```
     ///
     /// # See Also