diff options
| author | Jonathan Brouwer <jonathantbrouwer@gmail.com> | 2025-07-16 13:46:08 +0200 |
|---|---|---|
| committer | Jonathan Brouwer <jonathantbrouwer@gmail.com> | 2025-08-27 20:25:16 +0200 |
| commit | e8d08b5416c0fd159388fe6cdd1a3b43dd759132 (patch) | |
| tree | 8e5a053a64d37350c4f342ee70920a439f089241 /compiler/rustc_hir | |
| parent | aab5e0bf1fc26eb96ab6f694f05074a80d9de5f9 (diff) | |
| download | rust-e8d08b5416c0fd159388fe6cdd1a3b43dd759132.tar.gz rust-e8d08b5416c0fd159388fe6cdd1a3b43dd759132.zip | |
Port the `#[link]` attribute to the new parser
Diffstat (limited to 'compiler/rustc_hir')
| -rw-r--r-- | compiler/rustc_hir/src/attrs/data_structures.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/attrs/encode_cross_crate.rs | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/attrs/data_structures.rs b/compiler/rustc_hir/src/attrs/data_structures.rs index 1810ef2bdf9..dd5565d6f90 100644 --- a/compiler/rustc_hir/src/attrs/data_structures.rs +++ b/compiler/rustc_hir/src/attrs/data_structures.rs @@ -351,6 +351,17 @@ impl NativeLibKind { ) } } + +#[derive(Debug, Encodable, Decodable, Clone, HashStable_Generic, PrintAttribute)] +pub struct LinkEntry { + pub span: Span, + pub kind: NativeLibKind, + pub name: Symbol, + pub cfg: Option<CfgEntry>, + pub verbatim: Option<bool>, + pub import_name_type: Option<(PeImportNameType, Span)>, +} + /// Represents parsed *built-in* inert attributes. /// /// ## Overview @@ -521,6 +532,9 @@ pub enum AttributeKind { /// Represents `#[inline]` and `#[rustc_force_inline]`. Inline(InlineAttr, Span), + /// Represents `#[link]`. + Link(ThinVec<LinkEntry>, Span), + /// Represents `#[link_name]`. LinkName { name: Symbol, span: Span }, diff --git a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs index e5329c104bb..3810bb6d003 100644 --- a/compiler/rustc_hir/src/attrs/encode_cross_crate.rs +++ b/compiler/rustc_hir/src/attrs/encode_cross_crate.rs @@ -50,6 +50,7 @@ impl AttributeKind { Fundamental { .. } => Yes, Ignore { .. } => No, Inline(..) => No, + Link(..) => No, LinkName { .. } => Yes, // Needed for rustdoc LinkOrdinal { .. } => No, LinkSection { .. } => Yes, // Needed for rustdoc |
