Remove span method from AttributesExt trait

This commit is contained in:
Guillaume Gomez 2023-03-23 17:37:29 +01:00
parent de61a789af
commit 87ea9941d5
2 changed files with 3 additions and 6 deletions

View File

@ -878,10 +878,6 @@ pub(crate) trait AttributesExt {
fn iter<'a>(&'a self) -> Self::Attributes<'a>;
fn span(&self) -> Option<rustc_span::Span> {
self.iter().find(|attr| attr.doc_str().is_some()).map(|attr| attr.span)
}
fn cfg(&self, tcx: TyCtxt<'_>, hidden_cfg: &FxHashSet<Cfg>) -> Option<Arc<Cfg>> {
let sess = tcx.sess;
let doc_cfg_active = tcx.features().doc_cfg;

View File

@ -1239,8 +1239,9 @@ impl<'a, 'hir, 'tcx> HirCollector<'a, 'hir, 'tcx> {
if let Some(doc) = attrs.collapsed_doc_value() {
// Use the outermost invocation, so that doctest names come from where the docs were written.
let span = ast_attrs
.span()
.map(|span| span.ctxt().outer_expn().expansion_cause().unwrap_or(span))
.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);
self.collector.set_position(span);
markdown::find_testable_code(