Skip to content

link_ordinal attribute position is not restricted #100009

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ehuss opened this issue Aug 1, 2022 · 1 comment · Fixed by #100091
Closed

link_ordinal attribute position is not restricted #100009

ehuss opened this issue Aug 1, 2022 · 1 comment · Fixed by #100091
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. F-raw_dylib `#![feature(raw_dylib)]`

Comments

@ehuss
Copy link
Contributor

ehuss commented Aug 1, 2022

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
@ehuss ehuss added A-attributes Area: Attributes (`#[…]`, `#![…]`) C-bug Category: This is a bug. F-raw_dylib `#![feature(raw_dylib)]` labels Aug 1, 2022
@crlf0710 crlf0710 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. labels Aug 1, 2022
@chenyukang
Copy link
Member

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. F-raw_dylib `#![feature(raw_dylib)]`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants