Skip to content

internal: error on duplicate #[pin] attribute#120

Merged
nbdd0121 merged 1 commit into
Rust-for-Linux:mainfrom
mentonin:duplicate-pin
Jul 10, 2026
Merged

internal: error on duplicate #[pin] attribute#120
nbdd0121 merged 1 commit into
Rust-for-Linux:mainfrom
mentonin:duplicate-pin

Conversation

@mentonin

Copy link
Copy Markdown
Contributor

adds the error and a compile_fail test to check for it.

Closes: #119

@mentonin

Copy link
Copy Markdown
Contributor Author

I am new to both this project and Rust macros, but this problem seemed easy to tackle. Let me know if I should implement it with a different pattern instead.

I am also not sure if this should be documented on the CHANGELOG.md, or if the error/message should be different.

Comment thread internal/src/pin_data.rs Outdated
Comment thread internal/src/pin_data.rs Outdated
Comment thread tests/ui/compile-fail/pin_data/twice_pin.rs Outdated
Duplicated `#[pin]` has no effect, thus error if misused.

Reported-by: Mohamad Alsadhan <mo@sdhn.cc>
Closes: Rust-for-Linux#119
Signed-off-by: Luiz Georg <luizgngeorg@gmail.com>
[ Reworded commit message, and change the logic so code generation still
  continue after reporting error - Gary ]
Signed-off-by: Gary Guo <gary@garyguo.net>
@nbdd0121 nbdd0121 merged commit 0be155f into Rust-for-Linux:main Jul 10, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

multiple #[pin] attributes don't error

2 participants