diff options
| author | Caio <c410.f3r@gmail.com> | 2019-07-14 22:03:19 -0300 |
|---|---|---|
| committer | Caio <c410.f3r@gmail.com> | 2019-07-14 22:03:19 -0300 |
| commit | d326d53d904b776e8992501b49dedb805b88b1ce (patch) | |
| tree | 8470c3e42d6a4220a56d841a81c771605d814c7e | |
| parent | 7d41ebf768faca490addc7c616b3a9274621f0e9 (diff) | |
Chapter for param_attrs
| -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..5e649487525 --- /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() +} +``` \ No newline at end of file |
