diff options
Diffstat (limited to 'src/librustdoc/doctest/rust.rs')
| -rw-r--r-- | src/librustdoc/doctest/rust.rs | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/librustdoc/doctest/rust.rs b/src/librustdoc/doctest/rust.rs index 5c0898f28fc..71a0e3d72de 100644 --- a/src/librustdoc/doctest/rust.rs +++ b/src/librustdoc/doctest/rust.rs @@ -122,23 +122,14 @@ impl<'a, 'tcx> HirCollector<'a, 'tcx> { // anything else, this will combine them for us. let attrs = Attributes::from_ast(ast_attrs); if let Some(doc) = attrs.opt_doc_value() { - // Use the outermost invocation, so that doctest names come from where the docs were written. - let span = ast_attrs - .iter() - .find(|attr| attr.doc_str().is_some()) - .map(|attr| attr.span.ctxt().outer_expn().expansion_cause().unwrap_or(attr.span)) - .unwrap_or(DUMMY_SP); + let span = span_of_fragments(&attrs.doc_strings).unwrap_or(sp); self.collector.position = span; markdown::find_testable_code( &doc, &mut self.collector, self.codes, self.enable_per_target_ignores, - Some(&crate::html::markdown::ExtraInfo::new( - self.tcx, - def_id, - span_of_fragments(&attrs.doc_strings).unwrap_or(sp), - )), + Some(&crate::html::markdown::ExtraInfo::new(self.tcx, def_id, span)), ); } |
