Closed
Description
The link_ordinal
attribute currently does not appear to have any restrictions on where it is located.
The following code compiles without warning or error:
#[link_ordinal(123)]
struct Foo{}
I expected to see this happen: An error when link_ordinal
is placed in the wrong position.
Instead, this happened: link_ordinal
is ignored in wrong positions.
The code in CheckAttrVisitor
can be used to enforce this. Just add a check_link_ordinal
method that validates its location (see the other methods for how to do that).
Meta
rustc 1.64.0-nightly (2643b1646 2022-07-27)
binary: rustc
commit-hash: 2643b16468fda787470340890212591d8bc832b7
commit-date: 2022-07-27
host: x86_64-apple-darwin
release: 1.64.0-nightly
LLVM version: 14.0.6