diff options
| -rw-r--r-- | src/librustdoc/json/conversions.rs | 8 | ||||
| -rw-r--r-- | src/rustdoc-json-types/lib.rs | 7 | ||||
| -rw-r--r-- | tests/rustdoc-json/attrs/macro_export.rs | 4 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index 08bc0bb1950..fe69a5abee1 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -908,8 +908,12 @@ fn maybe_from_hir_attr( hir::Attribute::Parsed(kind) => kind, hir::Attribute::Unparsed(_) => { - // FIXME: We should handle `#[doc(hidden)]`. - return Some(other_attr(tcx, attr)); + return Some(if attr.has_name(sym::macro_export) { + Attribute::MacroExport + // FIXME: We should handle `#[doc(hidden)]`. + } else { + other_attr(tcx, attr) + }); } }; diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 6235b0e8576..40f89009a43 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -37,8 +37,8 @@ pub type FxHashMap<K, V> = HashMap<K, V>; // re-export for use in src/librustdoc // will instead cause conflicts. See #94591 for more. (This paragraph and the "Latest feature" line // are deliberately not in a doc comment, because they need not be in public docs.) // -// Latest feature: Structured Attributes -pub const FORMAT_VERSION: u32 = 54; +// Latest feature: Add Attribute::MacroUse +pub const FORMAT_VERSION: u32 = 55; /// The root of the emitted JSON blob. /// @@ -216,6 +216,9 @@ pub enum Attribute { /// `#[must_use]` MustUse { reason: Option<String> }, + /// `#[macro_export]` + MacroExport, + /// `#[export_name = "name"]` ExportName(String), diff --git a/tests/rustdoc-json/attrs/macro_export.rs b/tests/rustdoc-json/attrs/macro_export.rs index 1472aabb6ff..5d487cf6a56 100644 --- a/tests/rustdoc-json/attrs/macro_export.rs +++ b/tests/rustdoc-json/attrs/macro_export.rs @@ -1,7 +1,7 @@ //@ compile-flags: --document-private-items //@ set exported_id = "$.index[?(@.name=='exported')].id" -//@ is "$.index[?(@.name=='exported')].attrs" '[{"other": "#[macro_export]"}]' +//@ is "$.index[?(@.name=='exported')].attrs" '["macro_export"]' //@ is "$.index[?(@.name=='exported')].visibility" '"public"' #[macro_export] @@ -19,7 +19,7 @@ macro_rules! not_exported { //@ set module_id = "$.index[?(@.name=='module')].id" pub mod module { //@ set exported_from_mod_id = "$.index[?(@.name=='exported_from_mod')].id" - //@ is "$.index[?(@.name=='exported_from_mod')].attrs" '[{"other": "#[macro_export]"}]' + //@ is "$.index[?(@.name=='exported_from_mod')].attrs" '["macro_export"]' //@ is "$.index[?(@.name=='exported_from_mod')].visibility" '"public"' #[macro_export] macro_rules! exported_from_mod { |
