Skip to content

Remove the FnParamForbiddenAttr diagnostic - #162770

Draft
JonathanBrouwer wants to merge 4 commits into
rust-lang:mainfrom
JonathanBrouwer:param-target-checking
Draft

JonathanBrouwer wants to merge 4 commits into
rust-lang:mainfrom
JonathanBrouwer:param-target-checking

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Blocked on #162761

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 14, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job test-aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/scalable-vectors/invalid.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/scalable-vectors/invalid/invalid.stderr`
diff of stderr:

- error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
-   --> $DIR/invalid.rs:110:11
-    |
- LL | fn barqux(#[rustc_scalable_vector(4)] _x: u32) {}
-    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- 
7 error: the `rustc_scalable_vector` attribute cannot be used on extern crates
8   --> $DIR/invalid.rs:10:3
9    |

333 LL | struct OkayNoArg(f32);
334    |                  ^^^
335 
- error: aborting due to 39 previous errors
+ error: aborting due to 38 previous errors
337 
---
To only update this specific test, also pass `--test-args scalable-vectors/invalid.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/scalable-vectors/invalid.rs" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/scalable-vectors/invalid" "-Znext-solver=coherence" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024"
stdout: none
--- stderr -------------------------------
error: the `rustc_scalable_vector` attribute cannot be used on extern crates
##[error]  --> /checkout/tests/ui/scalable-vectors/invalid.rs:10:3
   |
---

error: the `rustc_scalable_vector` attribute cannot be used on type parameters
##[error]  --> /checkout/tests/ui/scalable-vectors/invalid.rs:51:12
   |
LL | enum Bar<#[rustc_scalable_vector(4)] T> {
   |            ^^^^^^^^^^^^^^^^^^^^^
   |
   = help: the `rustc_scalable_vector` attribute can only be applied to structs

error: the `rustc_scalable_vector` attribute cannot be used on enum variants
---

error: the `rustc_scalable_vector` attribute cannot be used on function params
##[error]  --> /checkout/tests/ui/scalable-vectors/invalid.rs:110:13
   |
LL | fn barqux(#[rustc_scalable_vector(4)] _x: u32) {}
   |             ^^^^^^^^^^^^^^^^^^^^^
   |
   = help: the `rustc_scalable_vector` attribute can only be applied to structs

error: the `rustc_scalable_vector` attribute cannot be used on functions
---

error: the `rustc_scalable_vector` attribute cannot be used on closures
##[error]  --> /checkout/tests/ui/scalable-vectors/invalid.rs:127:16
   |
LL |     let _x = #[rustc_scalable_vector(4)] || { };
   |                ^^^^^^^^^^^^^^^^^^^^^
   |
   = help: the `rustc_scalable_vector` attribute can only be applied to structs

error: the `rustc_scalable_vector` attribute cannot be used on expressions
##[error]  --> /checkout/tests/ui/scalable-vectors/invalid.rs:129:16
   |
LL |     let _y = #[rustc_scalable_vector(4)] 3 + 4;
   |                ^^^^^^^^^^^^^^^^^^^^^
   |
   = help: the `rustc_scalable_vector` attribute can only be applied to structs

error: the `rustc_scalable_vector` attribute cannot be used on statements
---
   |                         expected an integer literal here
   |
help: try changing it to one of the following valid forms of the attribute
   |
LL - #[rustc_scalable_vector("4")]
LL + #[rustc_scalable_vector]
   |
LL - #[rustc_scalable_vector("4")]
LL + #[rustc_scalable_vector(count)]
   |

error[E0805]: malformed `rustc_scalable_vector` attribute input
##[error]  --> /checkout/tests/ui/scalable-vectors/invalid.rs:147:3
   |
---

error: scalable vector structs can only have scalable vector fields
##[error]  --> /checkout/tests/ui/scalable-vectors/invalid.rs:163:18
   |
LL | struct OkayNoArg(f32);
   |                  ^^^

error: aborting due to 38 previous errors

Some errors have detailed explanations: E0539, E0805.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants