Skip to content

Commit 36dcd4c

Browse files
committed
Update link_ordinal duplicate attribute handling.
This removes the duplicate check, as this is now handled in a centralized location.
1 parent 4c60ea8 commit 36dcd4c

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

compiler/rustc_typeck/src/collect.rs

-8
Original file line numberDiff line numberDiff line change
@@ -2865,14 +2865,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
28652865
} else if attr.has_name(sym::link_name) {
28662866
codegen_fn_attrs.link_name = attr.value_str();
28672867
} else if attr.has_name(sym::link_ordinal) {
2868-
if link_ordinal_span.is_some() {
2869-
tcx.sess
2870-
.struct_span_err(
2871-
attr.span,
2872-
"multiple `link_ordinal` attributes on a single definition",
2873-
)
2874-
.emit();
2875-
}
28762868
link_ordinal_span = Some(attr.span);
28772869
if let ordinal @ Some(_) = check_link_ordinal(tcx, attr) {
28782870
codegen_fn_attrs.link_ordinal = ordinal;

src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44

55
#[link(name = "foo", kind = "raw-dylib")]
66
extern "C" {
7-
#[link_ordinal(1)]
7+
#[link_ordinal(1)] //~ ERROR multiple `link_ordinal` attributes
88
#[link_ordinal(2)]
9-
//~^ ERROR multiple `link_ordinal` attributes on a single definition
109
fn foo();
1110
}
1211

src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ LL | #![feature(raw_dylib)]
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #58713 <https://github.com/rust-lang/rust/issues/58713> for more information
99

10-
error: multiple `link_ordinal` attributes on a single definition
10+
error: multiple `link_ordinal` attributes
11+
--> $DIR/link-ordinal-multiple.rs:7:5
12+
|
13+
LL | #[link_ordinal(1)]
14+
| ^^^^^^^^^^^^^^^^^^ help: remove this attribute
15+
|
16+
note: attribute also specified here
1117
--> $DIR/link-ordinal-multiple.rs:8:5
1218
|
1319
LL | #[link_ordinal(2)]

0 commit comments

Comments
 (0)