mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00

This commit stabilizes the `edition` key in `Cargo.toml`, both in the `[package]` section and inside subtargets. Additionally the `cargo new` and `cargo init` subcommands have been enhanced with a `--edition` flag to allow explicitly specifying the edition to be generated. This commit does not yet change the default edition that's generated. Closes #5980
38 lines
849 B
Rust
38 lines
849 B
Rust
use support::{basic_lib_manifest, is_nightly, project};
|
|
|
|
#[test]
|
|
fn edition_works_for_build_script() {
|
|
if !is_nightly() {
|
|
return;
|
|
}
|
|
|
|
let p = project()
|
|
.file(
|
|
"Cargo.toml",
|
|
r#"
|
|
[package]
|
|
name = 'foo'
|
|
version = '0.1.0'
|
|
edition = '2018'
|
|
|
|
[build-dependencies]
|
|
a = { path = 'a' }
|
|
"#,
|
|
).file("src/lib.rs", "")
|
|
.file(
|
|
"build.rs",
|
|
r#"
|
|
fn main() {
|
|
a::foo();
|
|
}
|
|
"#,
|
|
).file("a/Cargo.toml", &basic_lib_manifest("a"))
|
|
.file("a/src/lib.rs", "pub fn foo() {}")
|
|
.build();
|
|
|
|
p.cargo("build -v")
|
|
.masquerade_as_nightly_cargo()
|
|
.with_status(0)
|
|
.run();
|
|
}
|