fornwall / rust-script

Run Rust files and expressions as scripts without any setup or compilation step.
https://rust-script.org
Apache License 2.0
1.27k stars 43 forks source link

Can't use crate-level attributes with cargo dependencies doc comment #134

Open Andrew15-5 opened 4 months ago

Andrew15-5 commented 4 months ago

Thing like #![feature(duration_constructors)] must be placed before any doc comment, but /// \``cargo` doc comment (apparently) must be placed before crate-level attributes (or anything else, really). So this is a deadlock situation.

#!/usr/bin/env rust-script
/// ```cargo
/// [dependencies]
/// chrono = "0.4.38"
/// ```
#![feature(duration_constructors)]
#!/usr/bin/env rust-script
#![feature(duration_constructors)]
/// ```cargo
/// [dependencies]
/// chrono = "0.4.38"
/// ```

This means that such attributes type (crate-level) must be ignored/skipped by rust-script or something (I don't know the implementation).