Skip to content

link_ordinal attribute position is not restricted #100009

Closed
@ehuss

Description

@ehuss

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

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-help-wantedCall for participation: Help is requested to fix this issue.F-raw_dylib`#![feature(raw_dylib)]`

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions