Navigation Menu

Skip to content

Commit

Permalink
Update link_ordinal duplicate attribute handling.
Browse files Browse the repository at this point in the history
This removes the duplicate check, as this is now handled in a
centralized location.
  • Loading branch information
ehuss committed Nov 21, 2021
1 parent 4c60ea8 commit 36dcd4c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
8 changes: 0 additions & 8 deletions compiler/rustc_typeck/src/collect.rs
Expand Up @@ -2865,14 +2865,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
} else if attr.has_name(sym::link_name) {
codegen_fn_attrs.link_name = attr.value_str();
} else if attr.has_name(sym::link_ordinal) {
if link_ordinal_span.is_some() {
tcx.sess
.struct_span_err(
attr.span,
"multiple `link_ordinal` attributes on a single definition",
)
.emit();
}
link_ordinal_span = Some(attr.span);
if let ordinal @ Some(_) = check_link_ordinal(tcx, attr) {
codegen_fn_attrs.link_ordinal = ordinal;
Expand Down
3 changes: 1 addition & 2 deletions src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs
Expand Up @@ -4,9 +4,8 @@

#[link(name = "foo", kind = "raw-dylib")]
extern "C" {
#[link_ordinal(1)]
#[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes
#[link_ordinal(2)]
//~^ ERROR multiple `link_ordinal` attributes on a single definition
fn foo();
}

Expand Down
8 changes: 7 additions & 1 deletion src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr
Expand Up @@ -7,7 +7,13 @@ LL | #![feature(raw_dylib)]
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information

error: multiple `link_ordinal` attributes on a single definition
error: multiple `link_ordinal` attributes
--> $DIR/link-ordinal-multiple.rs:7:5
|
LL | #[link_ordinal(1)]
| ^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/link-ordinal-multiple.rs:8:5
|
LL | #[link_ordinal(2)]
Expand Down

0 comments on commit 36dcd4c

Please sign in to comment.