diff options
| author | Eric Huss <eric@huss.org> | 2021-11-21 08:02:00 -0800 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2021-11-21 08:02:00 -0800 |
| commit | 36dcd4cbd9a455707f2b790e01fbdc38a86d5e9b (patch) | |
| tree | c45c39a847afd3243834c55f674606d0a080d796 | |
| parent | 4c60ea8228993a11d46f2dfb110128325441c77b (diff) | |
| download | rust-36dcd4cbd9a455707f2b790e01fbdc38a86d5e9b.tar.gz rust-36dcd4cbd9a455707f2b790e01fbdc38a86d5e9b.zip | |
Update link_ordinal duplicate attribute handling.
This removes the duplicate check, as this is now handled in a centralized location.
| -rw-r--r-- | compiler/rustc_typeck/src/collect.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs | 3 | ||||
| -rw-r--r-- | src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr | 8 |
3 files changed, 8 insertions, 11 deletions
diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index 209690ec5fc..de1606a7ed5 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -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; diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs index 98741212677..0ab994ecd45 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.rs @@ -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(); } diff --git a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr index a79fb2de944..4772533ab2f 100644 --- a/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr +++ b/src/test/ui/rfc-2627-raw-dylib/link-ordinal-multiple.stderr @@ -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)] |
