]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/lib.rs
rustc: Load the `rustc_trans` crate at runtime
[rust.git] / src / librustdoc / lib.rs
index 6347c4a58dddd34779d72b41c262857ff0869436..e39fe20310c2851a8288033b32fed37c2376e9a8 100644 (file)
@@ -63,8 +63,6 @@
 use std::process;
 use std::sync::mpsc::channel;
 
-use rustc_driver::rustc_trans;
-
 use externalfiles::ExternalHtml;
 use rustc::session::search_paths::SearchPaths;
 use rustc::session::config::{ErrorOutputType, RustcOptGroup, nightly_options,
@@ -264,6 +262,11 @@ pub fn opts() -> Vec<RustcOptGroup> {
             o.optflag("", "deny-render-differences", "abort doc runs when markdown rendering \
                                                       differences are found")
         }),
+        unstable("themes", |o| {
+            o.optmulti("", "themes",
+                       "additional themes which will be added to the generated docs",
+                       "FILES")
+        }),
     ]
 }
 
@@ -365,6 +368,15 @@ pub fn main_args(args: &[String]) -> isize {
         }
     }
 
+    let mut themes = Vec::new();
+    for theme in matches.opt_strs("themes").iter().map(|s| PathBuf::from(&s)) {
+        if !theme.is_file() {
+            eprintln!("rustdoc: option --themes arguments must all be files");
+            return 1;
+        }
+        themes.push(theme);
+    }
+
     let external_html = match ExternalHtml::load(
             &matches.opt_strs("html-in-header"),
             &matches.opt_strs("html-before-content"),
@@ -413,7 +425,8 @@ pub fn main_args(args: &[String]) -> isize {
                                   renderinfo,
                                   render_type,
                                   sort_modules_alphabetically,
-                                  deny_render_differences)
+                                  deny_render_differences,
+                                  themes)
                     .expect("failed to generate documentation");
                 0
             }