-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.
Description
Hi,
I've never used this RFC repo, so apologies if I'm doing this wrong :)
In rust-lang/rust#47712 someone suggested an RFC would be required.
Occasionally I find I need to conditionally use several libraries. For example, to import data structures used in a conditionally compiled function.
#[cfg(debug_assertions)]
use std::slice;
#[cfg(debug_assertions)]
use std::fs::File;
#[cfg(debug_assertions)]
use std::io::prelude::*;
#[cfg(debug_assertions)]
use std::convert::AsRef;
#[cfg(debug_assertions)]
use std::path::Path;
Whereas, I'd like to write:
#[cfg(debug_assertions)] {
use std::slice;
use std::fs::File;
use std::io::prelude::*;
use std::convert::AsRef;
use std::path::Path;
}
This currently gives:
error: expected item after attributes
--> src/lib.rs:53:24
|
53 | #[cfg(debug_assertions)] {
Thanks
wllenyj, petersn and toymil
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.