Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/doc/unstable-book/src/language-features/param-attrs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# `param_attrs`

The tracking issue for this feature is: [#60406]

[#60406]: https://github.com/rust-lang/rust/issues/60406

Allow attributes in formal function parameter position so external tools and compiler internals can
take advantage of the additional information that the parameters provide.

Enables finer conditional compilation with `#[cfg(..)]` and linting control of variables. Moreover,
opens the path to richer DSLs created by users.

------------------------

Example:

```rust
#![feature(param_attrs)]

fn len(
#[cfg(windows)] slice: &[u16],
#[cfg(not(windows))] slice: &[u8],
) -> usize
{
slice.len()
}
```