]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/test.rs
Auto merge of #53002 - QuietMisdreavus:brother-may-i-have-some-loops, r=pnkfelix
[rust.git] / src / librustdoc / test.rs
index 9723b4528008956b80c64b99494ac22a5c5aa23d..d8e382f6998ceb1b66e108d7770a04c8feabe92f 100644 (file)
@@ -42,7 +42,7 @@
 use errors::emitter::ColorConfig;
 
 use clean::Attributes;
-use html::markdown::{self, LangString};
+use html::markdown::{self, ErrorCodes, LangString};
 
 #[derive(Clone, Default)]
 pub struct TestOptions {
@@ -73,7 +73,7 @@ pub fn run(input_path: &Path,
         maybe_sysroot: maybe_sysroot.clone().or_else(
             || Some(env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_path_buf())),
         search_paths: libs.clone(),
-        crate_types: vec![config::CrateTypeDylib],
+        crate_types: vec![config::CrateType::Dylib],
         cg: cg.clone(),
         externs: externs.clone(),
         unstable_features: UnstableFeatures::from_environment(),
@@ -83,7 +83,7 @@ pub fn run(input_path: &Path,
             ..config::basic_debugging_options()
         },
         edition,
-        ..config::basic_options().clone()
+        ..config::Options::default()
     };
     driver::spawn_thread_pool(sessopts, |sessopts| {
         let codemap = Lrc::new(CodeMap::new(sessopts.file_path_mapping()));
@@ -145,7 +145,8 @@ pub fn run(input_path: &Path,
             let mut hir_collector = HirCollector {
                 sess: &sess,
                 collector: &mut collector,
-                map: &map
+                map: &map,
+                codes: ErrorCodes::from(sess.opts.unstable_features.is_nightly_build()),
             };
             hir_collector.visit_testable("".to_string(), &krate.attrs, |this| {
                 intravisit::walk_crate(this, krate);
@@ -215,7 +216,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
         maybe_sysroot: maybe_sysroot.or_else(
             || Some(env::current_exe().unwrap().parent().unwrap().parent().unwrap().to_path_buf())),
         search_paths: libs,
-        crate_types: vec![config::CrateTypeExecutable],
+        crate_types: vec![config::CrateType::Executable],
         output_types: outputs,
         externs,
         cg: config::CodegenOptions {
@@ -229,7 +230,7 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
             ..config::basic_debugging_options()
         },
         edition,
-        ..config::basic_options().clone()
+        ..config::Options::default()
     };
 
     // Shuffle around a few input and output handles here. We're going to pass
@@ -662,7 +663,8 @@ pub fn register_header(&mut self, name: &str, level: u32) {
 struct HirCollector<'a, 'hir: 'a> {
     sess: &'a session::Session,
     collector: &'a mut Collector,
-    map: &'a hir::map::Map<'hir>
+    map: &'a hir::map::Map<'hir>,
+    codes: ErrorCodes,
 }
 
 impl<'a, 'hir> HirCollector<'a, 'hir> {
@@ -688,7 +690,7 @@ fn visit_testable<F: FnOnce(&mut Self)>(&mut self,
         // anything else, this will combine them for us
         if let Some(doc) = attrs.collapsed_doc_value() {
             self.collector.set_position(attrs.span.unwrap_or(DUMMY_SP));
-            let res = markdown::find_testable_code(&doc, self.collector);
+            let res = markdown::find_testable_code(&doc, self.collector, self.codes);
             if let Err(err) = res {
                 self.sess.diagnostic().span_warn(attrs.span.unwrap_or(DUMMY_SP),
                     &err.to_string());