From d326d53d904b776e8992501b49dedb805b88b1ce Mon Sep 17 00:00:00 2001 From: Caio Date: Sun, 14 Jul 2019 22:03:19 -0300 Subject: [PATCH 1/2] Chapter for param_attrs --- .../src/language-features/param-attrs.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/doc/unstable-book/src/language-features/param-attrs.md 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 From 5ad4901bc99e9be9e7ab863886b7946c56e8ffbf Mon Sep 17 00:00:00 2001 From: Caio Date: Sun, 14 Jul 2019 22:28:42 -0300 Subject: [PATCH 2/2] Add newline --- src/doc/unstable-book/src/language-features/param-attrs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/unstable-book/src/language-features/param-attrs.md b/src/doc/unstable-book/src/language-features/param-attrs.md index 5e649487525..4b83c204ba1 100644 --- a/src/doc/unstable-book/src/language-features/param-attrs.md +++ b/src/doc/unstable-book/src/language-features/param-attrs.md @@ -24,4 +24,4 @@ fn len( { slice.len() } -``` \ No newline at end of file +```