From 29e0e148d9336bd554a4ef400f628f4a21413349 Mon Sep 17 00:00:00 2001 From: pinkforest <36498018+pinkforest@users.noreply.github.com> Date: Thu, 30 Jun 2022 20:31:02 +1000 Subject: [PATCH] rustdoc: fix 98690 --- src/librustdoc/doctest.rs | 6 ++++-- src/test/rustdoc-ui/issue-98690.rs | 9 +++++++++ src/test/rustdoc-ui/issue-98690.stderr | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/test/rustdoc-ui/issue-98690.rs create mode 100644 src/test/rustdoc-ui/issue-98690.stderr diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index ab72f4a3f502c..509c4253f0f76 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -1003,8 +1003,10 @@ impl Tester for Collector { let outdir = if let Some(mut path) = rustdoc_options.persist_doctests.clone() { path.push(&test_id); - std::fs::create_dir_all(&path) - .expect("Couldn't create directory for doctest executables"); + if let Err(err) = std::fs::create_dir_all(&path) { + eprintln!("Couldn't create directory for doctest executables: {}", err); + panic::resume_unwind(box ()); + } DirState::Perm(path) } else { diff --git a/src/test/rustdoc-ui/issue-98690.rs b/src/test/rustdoc-ui/issue-98690.rs new file mode 100644 index 0000000000000..bfe803402c287 --- /dev/null +++ b/src/test/rustdoc-ui/issue-98690.rs @@ -0,0 +1,9 @@ +// compile-flags: --test --persist-doctests /../../ -Z unstable-options +// failure-status: 101 + +#![crate_name = "foo"] + +//! ```rust +//! use foo::dummy; +//! dummy(); +//! ``` diff --git a/src/test/rustdoc-ui/issue-98690.stderr b/src/test/rustdoc-ui/issue-98690.stderr new file mode 100644 index 0000000000000..47d94f99a4563 --- /dev/null +++ b/src/test/rustdoc-ui/issue-98690.stderr @@ -0,0 +1 @@ +Couldn't create directory for doctest executables: Permission denied (os error 13)