about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2018-07-21 16:30:02 -0600
committerMark Rousskov <mark.simulacrum@gmail.com>2018-07-31 11:37:21 -0600
commitad40e4517f1969e60eac9fcac2affa75bb2e715e (patch)
tree15da583e6275a8b4297d366a3468286c63dfd079 /src/librustdoc/html
parent0af5a6be0531a1ad038bd150239847cb4acc5026 (diff)
Provide warnings for invalid code blocks in markdown files
Previously we would only warn on Rust code but we can also do so when
testing markdown (the diag::Handler is available).
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/markdown.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index d01745f4a46..0774ce34718 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -27,7 +27,6 @@
 
 #![allow(non_camel_case_types)]
 
-use rustc::session;
 use std::cell::RefCell;
 use std::collections::{HashMap, VecDeque};
 use std::default::Default;
@@ -37,6 +36,7 @@ use std::ops::Range;
 use std::str;
 use syntax::feature_gate::UnstableFeatures;
 use syntax::codemap::Span;
+use errors;
 
 use html::render::derive_id;
 use html::toc::TocBuilder;
@@ -470,7 +470,7 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
 }
 
 pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector, position: Span,
-                          sess: Option<&session::Session>) {
+                          handler: &errors::Handler) {
     tests.set_position(position);
 
     let is_nightly = UnstableFeatures::from_environment().is_nightly_build();
@@ -521,9 +521,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector, position: Sp
                                    line, filename, block_info.allow_fail);
                     prev_offset = offset;
                 } else {
-                    if let Some(ref sess) = sess {
-                        sess.span_warn(position, "invalid start of a new code block");
-                    }
+                    handler.span_warn(position, "invalid start of a new code block");
                     break;
                 }
             }