Mastodon Feed: Post

Mastodon Feed

rust@octodon.social ("Rust tips") wrote:

#Rust has meta attributes that can apply to entire modules, like #[cfg(…)], #[allow(…)] and #[deny(…)].

The #[…] attribute syntax used outside of a module is equivalent to #![…] syntax inside it:

#\[cfg(windows)\]  
mod win {  
}

mod win {  
  #!\[cfg(windows)\]      
}

You have to use #![…] attribute syntax at the top of the lib.rs file, because there's no outer file that has the `mod` declaration for lib.rs.