From 6a744ea4d515a70c5c90fef85cfa4c7ba8ae7f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Gerber?= Date: Thu, 26 Mar 2020 22:57:33 +0100 Subject: [PATCH] Create output dir in rustdoc markdown render --- src/librustdoc/markdown.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index a41fdd2ff17af..0a1b5f588158f 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -1,4 +1,4 @@ -use std::fs::File; +use std::fs::{create_dir_all, File}; use std::io::prelude::*; use std::path::PathBuf; @@ -40,6 +40,11 @@ pub fn render( diag: &rustc_errors::Handler, edition: Edition, ) -> i32 { + if let Err(e) = create_dir_all(&options.output) { + diag.struct_err(&format!("{}: {}", options.output.display(), e)).emit(); + return 4; + } + let mut output = options.output; output.push(input.file_name().unwrap()); output.set_extension("html");