You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The attributes section doesn't cover how these rules are applied to typically used libraries or binaries and should be expanded. For example, why does this case fail? It's trying to apply that feature to the enclosing module which seems reasonable:
pubmod inner {// Not valid. `feature` is only applicable to crates.#![feature(step_by)]pubfnthrees(){for i in(0..10).step_by(3){println!("{}", i);}}}fnmain(){
inner::threes();}
It would be useful to expand it to include examples that show actual usage patterns like how to enable #![feature()], #[test], and #[cfg] patterns on a lib.rs and main.rs files in a practical fashion. This seems like it would enable people much more than it does currently.
My attempt at answering such a question is here in case it's useful.
The text was updated successfully, but these errors were encountered:
mdinger
changed the title
the book attributes isn't practically useful
the book attributes page isn't practically useful
Sep 25, 2015
foo.rs:3:5: 3:25 warning: crate-level attribute should be in the root module, #[warn(unused_attributes)] on by default
foo.rs:3 #![feature(step_by)]
^~~~~~~~~~~~~~~~~~~~
This is good feedback, but given my work on the next-gen of the book, I'm not likely to fix it. If anyone wants to flesh out this section with more, please feel free!
The attributes section doesn't cover how these rules are applied to typically used libraries or binaries and should be expanded. For example, why does this case fail? It's trying to apply that feature to the enclosing module which seems reasonable:
It would be useful to expand it to include examples that show actual usage patterns like how to enable
#![feature()]
,#[test]
, and#[cfg]
patterns on alib.rs
andmain.rs
files in a practical fashion. This seems like it would enable people much more than it does currently.My attempt at answering such a question is here in case it's useful.
The text was updated successfully, but these errors were encountered: