These #[...] and #![...] are not comments; they're attributes (somewhat similar to Java's @Something annotations). Comments in Rust start with // or /<star> like in C or C++. There's only the special case that "doc comments" (starting with /// or /<star><star> or //! or /<star>!) are automatically converted into #[doc="..."] or #![doc="..."] attributes.
The difference is that attributes are always meaningful to the compiler (and can only be used in specific places); other than doc comments (which turn into attributes), comments never are meaningful to the compiler.
(edit: HN's comment markup eats the * character, I replaced them with <star> above)
#[...] is an attribute, more like @foo annotations in Java, not a comment. Comments do not use # in Rust
Re:Learn Go in five minutes
by corytheboyd on Tuesday January 05, 2021 @12:32PM
(#25648091)
> Comments do not use # in Rust
Oof what a dumb mistake, sorry about that!
Re:Learn Go in five minutes
by felipellrocha on Tuesday January 05, 2021 @02:35PM
(#25649922)
It's ok. Other people probably had the same question!
I’ve only read through the rust book without using it for anything (yet) and have done no work on golang, so I’m legitimately curious to hear your input, not challenging you on semantics :p
Edit: Rust does not use # for comments. Sorry I just had that mixed up in my head, but thanks for the answers!