diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-07-16 11:38:54 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-16 11:38:54 -0400 |
| commit | c9be624c26ca4555478d7e7c0bfd8898cb014c2d (patch) | |
| tree | 7b42c5bdde66c0176d95ffddf32bc47e1dddc939 /src | |
| parent | ae2672340cf8e4243b99a59c7f01b663a4d4dc78 (diff) | |
| parent | 5ad4901bc99e9be9e7ab863886b7946c56e8ffbf (diff) | |
Rollup merge of #62683 - c410-f3r:fn-attrs-doc, r=Centril
Chapter for `param_attrs` Most the information was taken from the RFC. cc #60406
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/param-attrs.md | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/doc/unstable-book/src/language-features/param-attrs.md b/src/doc/unstable-book/src/language-features/param-attrs.md new file mode 100644 index 00000000000..4b83c204ba1 --- /dev/null +++ b/src/doc/unstable-book/src/language-features/param-attrs.md @@ -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() +} +``` |
