Skip to content
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

no_sanitize attribute can be applied to any item with arbitrary arguments #128487

Closed
oli-obk opened this issue Aug 1, 2024 · 0 comments · Fixed by #128552
Closed

no_sanitize attribute can be applied to any item with arbitrary arguments #128487

oli-obk opened this issue Aug 1, 2024 · 0 comments · Fixed by #128552
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-sanitizers Area: Sanitizers for correctness and code quality C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Aug 1, 2024

I tried this code:

#![feature(no_sanitize)]
#[no_sanitize(cake, bar, foo, bop)]
type Foo = ();

I expected to see this happen: compilation failure because of attribute on an item where it makes no sense

Instead, this happened: compiled successfully

Meta

rustc --version --verbose:

1.82.0-nightly

2024-07-31 28a58f2fa7f0c46b8fab

cc #39699

see #128444 for where to fix this issue

@oli-obk oli-obk added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. C-bug Category: This is a bug. labels Aug 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 1, 2024
@tmiasko tmiasko added A-sanitizers Area: Sanitizers for correctness and code quality and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Aug 1, 2024
@fmease fmease added A-attributes Area: Attributes (`#[…]`, `#![…]`) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 1, 2024
@bors bors closed this as completed in 6c2e067 Aug 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Aug 8, 2024
Rollup merge of rust-lang#128552 - s7tya:check-no-sanitize-attribute-pos, r=BoxyUwU

Emit an error for invalid use of the `#[no_sanitize]` attribute

fixes rust-lang#128487.

Currently, the use of the `#[no_sanitize]` attribute for Mod, Impl,... is incorrectly permitted. This PR will correct this issue by generating errors, and I've also added some UI test cases for it.

Referenced rust-lang#128458. As far as I know, the `#[no_sanitize]` attribute can only be used with functions, so I changed that part to `Fn` and `Method` using `check_applied_to_fn_or_method`. However, I couldn't find explicit documentation on this, so I could be mistaken...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-sanitizers Area: Sanitizers for correctness and code quality C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants