Skip to content

Commit 4529f89

Browse files
author
Hero Bird
authored
Update 2540-formal-function-parameter-attributes.md
1 parent 67f2e2e commit 4529f89

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

text/2540-formal-function-parameter-attributes.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ For raw pointers that are oftentimes used when operating with C code one could p
3636
You could for example mirror C's restrict keyword or even be more explicit by stating what pointer argument might overlap.
3737

3838
```rust
39-
fn foo(#[overlaps_with(in_b) in_a: *const u8, #[overlaps_with(in_a)] in_b: *const u8, #[restrict] out: *mut u8);
39+
fn foo(
40+
#[overlaps_with(in_b)] in_a: *const u8,
41+
#[overlaps_with(in_a)] in_b: *const u8,
42+
#[restrict] out: *mut u8
43+
);
4044
```
4145

4246
Which might state that the pointers `in_a` and `in_b` might overlap but `out` is non overlapping.
@@ -52,7 +56,7 @@ Also procedural macros could greatly benefit from having their own defined custo
5256
Formal parameters of functions, methods, closures and functions in trait definitions may have attributes attached to them.
5357
This allows to provide additional information to a given formal parameter.
5458

55-
To reify this we introduce the `#[unused]` attribute that states that the attributed parameter is unused in the associated implementation.
59+
For the next examples the hypothetical `#[unused]` attribute means that the attributed parameter is unused in the associated implementation.
5660

5761
## Examples
5862

0 commit comments

Comments
 (0)