summaryrefslogtreecommitdiffstats
path: root/src/librustdoc/doctest.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustdoc/doctest.rs')
-rw-r--r--src/librustdoc/doctest.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 36d5adb63..741d329fb 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -10,6 +10,7 @@ use rustc_middle::hir::nested_filter;
use rustc_middle::ty::TyCtxt;
use rustc_parse::maybe_new_parser_from_source_str;
use rustc_parse::parser::attr::InnerAttrPolicy;
+use rustc_resolve::rustdoc::span_of_fragments;
use rustc_session::config::{self, CrateType, ErrorOutputType};
use rustc_session::parse::ParseSess;
use rustc_session::{lint, EarlyErrorHandler, Session};
@@ -33,7 +34,6 @@ use crate::clean::{types::AttributesExt, Attributes};
use crate::config::Options as RustdocOptions;
use crate::html::markdown::{self, ErrorCodes, Ignore, LangString};
use crate::lint::init_lints;
-use crate::passes::span_of_attrs;
/// Options that apply to all doctests in a crate or Markdown file (for `rustdoc foo.md`).
#[derive(Clone, Default)]
@@ -109,6 +109,7 @@ pub(crate) fn run(options: RustdocOptions) -> Result<(), ErrorGuaranteed> {
make_codegen_backend: None,
registry: rustc_driver::diagnostics_registry(),
ice_file: None,
+ expanded_args: options.expanded_args.clone(),
};
let test_args = options.test_args.clone();
@@ -680,7 +681,7 @@ pub(crate) fn make_test(
if s.contains(crate_name) {
// rustdoc implicitly inserts an `extern crate` item for the own crate
// which may be unused, so we need to allow the lint.
- prog.push_str(&format!("#[allow(unused_extern_crates)]\n"));
+ prog.push_str("#[allow(unused_extern_crates)]\n");
prog.push_str(&format!("extern crate r#{crate_name};\n"));
line_offset += 1;
@@ -1240,8 +1241,9 @@ impl<'a, 'hir, 'tcx> HirCollector<'a, 'hir, 'tcx> {
Some(&crate::html::markdown::ExtraInfo::new(
self.tcx,
def_id.to_def_id(),
- span_of_attrs(&attrs).unwrap_or(sp),
+ span_of_fragments(&attrs.doc_strings).unwrap_or(sp),
)),
+ self.tcx.features().custom_code_classes_in_docs,
);
}