Attributes
Reading
-
What actually are attributes? - Jana Dönszelmann | EuroRust 2025 YouTube
The part on how they changed and centralized attribute parsing is interesting.
Design
-
Which character to introduce attribute?
#,@@clashes with bindings inmatcharms.
#attr;
#attr("foo")
#attr{name = "c"}
fn item() {
#rustfmt::skip
let matrix = [
1, 2, 3,
4, 5, 6,
];
#allow(clippy::placeholder_name)
let foo = ();
}
-
Concern: Bare attributes (i.e. no
[]to delimit) on expression can conflict#foo (1) #foo() 1 #foo [1, 2, 3] #foo[] 1Currently, attributes have precedence.
-
Do we not have bare attributes?
#foois#foo() -
Do we delimit the attribute? with
;?e.g.
#foo; [1, 2, 3]
-