Skip to content

Commit 8533310

Browse files
Port the #[link] attribute to the new parser
1 parent 00fe7d1 commit 8533310

File tree

14 files changed

+639
-623
lines changed

14 files changed

+639
-623
lines changed

compiler/rustc_attr_parsing/messages.ftl

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,55 @@ attr_parsing_invalid_meta_item = expected a literal (`1u8`, `1.0f32`, `"string"`
189189
190190
attr_parsing_suffixed_literal_in_attribute = suffixed literals are not allowed in attributes
191191
.help = instead of using a suffixed literal (`1u8`, `1.0f32`, etc.), use an unsuffixed version (`1`, `1.0`, etc.)
192+
193+
attr_parsing_as_needed_compatibility =
194+
linking modifier `as-needed` is only compatible with `dylib` and `framework` linking kinds
195+
196+
attr_parsing_bundle_needs_static =
197+
linking modifier `bundle` is only compatible with `static` linking kind
198+
199+
attr_parsing_empty_link_name =
200+
link name must not be empty
201+
.label = empty link name
202+
203+
attr_parsing_import_name_type_raw =
204+
import name type can only be used with link kind `raw-dylib`
205+
206+
attr_parsing_import_name_type_x86 =
207+
import name type is only supported on x86
208+
209+
attr_parsing_incompatible_wasm_link =
210+
`wasm_import_module` is incompatible with other arguments in `#[link]` attributes
211+
212+
attr_parsing_invalid_link_modifier =
213+
invalid linking modifier syntax, expected '+' or '-' prefix before one of: bundle, verbatim, whole-archive, as-needed
214+
215+
attr_parsing_link_arg_unstable =
216+
link kind `link-arg` is unstable
217+
218+
attr_parsing_link_cfg_unstable =
219+
link cfg is unstable
220+
221+
attr_parsing_link_framework_apple =
222+
link kind `framework` is only supported on Apple targets
223+
224+
attr_parsing_link_requires_name =
225+
`#[link]` attribute requires a `name = "string"` argument
226+
.label = missing `name` argument
227+
228+
attr_parsing_multiple_modifiers =
229+
multiple `{$modifier}` modifiers in a single `modifiers` argument
230+
231+
attr_parsing_multiple_renamings =
232+
multiple renamings were specified for library `{$lib_name}`
233+
attr_parsing_raw_dylib_no_nul =
234+
link name must not contain NUL characters if link kind is `raw-dylib`
235+
236+
attr_parsing_raw_dylib_elf_unstable =
237+
link kind `raw-dylib` is unstable on ELF platforms
238+
239+
attr_parsing_raw_dylib_only_windows =
240+
link kind `raw-dylib` is only supported on Windows targets
241+
242+
attr_parsing_whole_archive_needs_static =
243+
linking modifier `whole-archive` is only compatible with `static` linking kind

compiler/rustc_attr_parsing/src/attributes/cfg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub fn parse_cfg_attr<'c, S: Stage>(
3636
parse_cfg_entry(cx, single)
3737
}
3838

39-
fn parse_cfg_entry<S: Stage>(
39+
pub(crate) fn parse_cfg_entry<S: Stage>(
4040
cx: &mut AcceptContext<'_, '_, S>,
4141
item: &MetaItemOrLitParser<'_>,
4242
) -> Option<CfgEntry> {

0 commit comments

Comments
 (0)