3 ms·
Shouldn't .rs files declare the version of the language they were written for? At least optionally?
by amelius 8y ago
Shouldn't .rs files declare the version of the language they were written for? At least optionally?
- ekidd 8y agoThe Rust "edition" flag is set on a per-library ("crate") basis, not per source file. It basically just controls a few small differences at the parser level. I'm really happy about the ability to mix older Rust 2015 and newer Rust 2018 code in the same project, and the tools for automatically migrating code to the 2018 edition. It took us like 3 hours to migrate a large code base at work, and I think I needed to file a bug report about exactly one upstream library. Everything else was seamless. And we can still use all our Rust 2015 dependencies.
- Tuna-Fish 8y agoWith [2018], rust has gone on the path of tightly integrating the build system into the language. Before, you had to declare the crates you were using with "extern crate" in your main package. Now, the only place those are found is in the Cargo.toml build script. The language version is chosen in the same place.
- steveklabnik 8y agoThis imposes no additional requirements on rustc, it’s the same as it previously was. Cargo is no more tightly integrated.
- gpm 8y agoThis makes using rustc without cargo much harder. For instance, previously I could `rustc src/main.rs -L deps` and assuming that the dependencies had all been built and had their rlibs put in deps things would just work. Now that is no longer possible, I have to manually specify every external dependency on the command line.
- kibwen 8y ago`extern crate` hasn't been made a syntax error, it's just now possible to elide it. There are plenty of use cases where I imagine people will still use it, not least of which is play.rust-lang.org, which has no direct access to Cargo or rustc, and `extern crate` is what one will continue to use to import third-party libraries there.