File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/doc/unstable-book/src/language-features Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ # ` param_attrs `
2+
3+ The tracking issue for this feature is: [ #60406 ]
4+
5+ [ #60406 ] : https://github.com/rust-lang/rust/issues/60406
6+
7+ Allow attributes in formal function parameter position so external tools and compiler internals can
8+ take advantage of the additional information that the parameters provide.
9+
10+ Enables finer conditional compilation with ` #[cfg(..)] ` and linting control of variables. Moreover,
11+ opens the path to richer DSLs created by users.
12+
13+ ------------------------
14+
15+ Example:
16+
17+ ``` rust
18+ #![feature(param_attrs)]
19+
20+ fn len (
21+ #[cfg (windows )] slice : & [u16 ],
22+ #[cfg (not (windows ))] slice : & [u8 ],
23+ ) -> usize
24+ {
25+ slice . len ()
26+ }
27+ ```
You can’t perform that action at this time.
0 commit comments