diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-19 01:52:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-19 01:52:10 +0200 |
| commit | d51002ce078c5de8d49e700b3c22c9c3cc84ff94 (patch) | |
| tree | a1ad2f138f5c3bf5f37c396b4d974e4ea3eca0dd /src/librustdoc | |
| parent | dcd5b20177f7b8408ccc42869e9151f7cfd45686 (diff) | |
| parent | e152554e11ff44b1a08e21a8416e1fc18504764e (diff) | |
| download | rust-d51002ce078c5de8d49e700b3c22c9c3cc84ff94.tar.gz rust-d51002ce078c5de8d49e700b3c22c9c3cc84ff94.zip | |
Rollup merge of #61898 - petrochenkov:sekind, r=eddyb
syntax: Factor out common fields from `SyntaxExtension` variants And some other related cleanups. Continuation of https://github.com/rust-lang/rust/pull/61606. This will also help to unblock https://github.com/rust-lang/rust/pull/61877.
Diffstat (limited to 'src/librustdoc')
| -rw-r--r-- | src/librustdoc/clean/inline.rs | 12 | ||||
| -rw-r--r-- | src/librustdoc/passes/collect_intra_doc_links.rs | 4 |
2 files changed, 5 insertions, 11 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index c14ae5932af..9259b3b5d3a 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -3,7 +3,7 @@ use std::iter::once; use syntax::ast; -use syntax::ext::base::{MacroKind, SyntaxExtension}; +use syntax::ext::base::MacroKind; use syntax::symbol::sym; use syntax_pos::Span; @@ -470,18 +470,12 @@ fn build_macro(cx: &DocContext<'_>, did: DefId, name: ast::Name) -> clean::ItemE }) } LoadedMacro::ProcMacro(ext) => { - let helpers = match &*ext { - &SyntaxExtension::Derive(_, ref syms, ..) => { syms.clean(cx) } - _ => Vec::new(), - }; - clean::ProcMacroItem(clean::ProcMacro { - kind: ext.kind(), - helpers, + kind: ext.macro_kind(), + helpers: ext.helper_attrs.clean(cx), }) } } - } /// A trait's generics clause actually contains all of the predicates for all of diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 7fbfc3e1fc0..68b96a40829 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -423,7 +423,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { /// Resolves a string as a macro. fn macro_resolve(cx: &DocContext<'_>, path_str: &str) -> Option<Res> { - use syntax::ext::base::{MacroKind, SyntaxExtension}; + use syntax::ext::base::{MacroKind, SyntaxExtensionKind}; let segment = ast::PathSegment::from_ident(Ident::from_str(path_str)); let path = ast::Path { segments: vec![segment], span: DUMMY_SP }; cx.enter_resolver(|resolver| { @@ -433,7 +433,7 @@ fn macro_resolve(cx: &DocContext<'_>, path_str: &str) -> Option<Res> { if let Res::Def(DefKind::Macro(MacroKind::ProcMacroStub), _) = res { // skip proc-macro stubs, they'll cause `get_macro` to crash } else { - if let SyntaxExtension::LegacyBang { .. } = *resolver.get_macro(res) { + if let SyntaxExtensionKind::LegacyBang(..) = resolver.get_macro(res).kind { return Some(res.map_id(|_| panic!("unexpected id"))); } } |
