diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-07-14 11:04:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-14 11:04:52 +0200 |
| commit | 93c10272d0912d9dd517f61390279a4112b9dbad (patch) | |
| tree | f6f5b56f3bdbfae97d04a37fbb734f59fddfe658 /compiler/rustc_metadata | |
| parent | ad635e5d0696076b4412dd7db7b7e8c0867d6e0c (diff) | |
| parent | 75561c446afb63444e9b192563d46eccf7051c61 (diff) | |
| download | rust-93c10272d0912d9dd517f61390279a4112b9dbad.tar.gz rust-93c10272d0912d9dd517f61390279a4112b9dbad.zip | |
Rollup merge of #143217 - Periodic1911:link-ordinal, r=jdonszelmann
Port #[link_ordinal] to the new attribute parsing infrastructure Ports link_ordinal to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
Diffstat (limited to 'compiler/rustc_metadata')
| -rw-r--r-- | compiler/rustc_metadata/src/native_libs.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index f10d71f4c65..4d276f814ef 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -3,6 +3,7 @@ use std::path::{Path, PathBuf}; use rustc_abi::ExternAbi; use rustc_ast::CRATE_NODE_ID; +use rustc_attr_data_structures::{AttributeKind, find_attr}; use rustc_attr_parsing as attr; use rustc_data_structures::fx::FxHashSet; use rustc_middle::query::LocalCrate; @@ -496,14 +497,9 @@ impl<'tcx> Collector<'tcx> { } _ => { for &child_item in foreign_items { - if self.tcx.def_kind(child_item).has_codegen_attrs() - && self.tcx.codegen_fn_attrs(child_item).link_ordinal.is_some() + if let Some(span) = find_attr!(self.tcx.get_all_attrs(child_item), AttributeKind::LinkOrdinal {span, ..} => *span) { - let link_ordinal_attr = - self.tcx.get_attr(child_item, sym::link_ordinal).unwrap(); - sess.dcx().emit_err(errors::LinkOrdinalRawDylib { - span: link_ordinal_attr.span(), - }); + sess.dcx().emit_err(errors::LinkOrdinalRawDylib { span }); } } |
