Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support edition 2024 #250

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use std::path::PathBuf;

#[derive(Serialize, Debug)]
pub struct Manifest {
#[serde(rename = "cargo-features")]
pub cargo_features: Vec<String>,
pub package: Package,
#[serde(skip_serializing_if = "Map::is_empty")]
pub features: Map<String, Vec<String>>,
Expand Down Expand Up @@ -44,6 +46,8 @@ pub enum Edition {
E2018,
#[serde(rename = "2021")]
E2021,
#[serde(rename = "2024")]
E2024,
}

#[derive(Serialize, Debug)]
Expand Down
9 changes: 8 additions & 1 deletion src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::env::Update;
use crate::error::{Error, Result};
use crate::expand::{expand_globs, ExpandedTest};
use crate::flock::Lock;
use crate::manifest::{Bin, Build, Config, Manifest, Name, Package, Workspace};
use crate::manifest::{Bin, Build, Config, Edition, Manifest, Name, Package, Workspace};
use crate::message::{self, Fail, Warn};
use crate::normalize::{self, Context, Variations};
use crate::{features, rustflags, Expected, Runner, Test};
Expand Down Expand Up @@ -222,6 +222,12 @@ impl Runner {
.ok_or(Error::NoWorkspaceManifest)?,
};

let cargo_features = if let Edition::E2024 = edition {
vec!["edition2024".to_owned()]
} else {
vec![]
};

let mut dependencies = Map::new();
dependencies.extend(source_manifest.dependencies);
dependencies.extend(source_manifest.dev_dependencies);
Expand Down Expand Up @@ -286,6 +292,7 @@ impl Runner {
}

let mut manifest = Manifest {
cargo_features,
package: Package {
name: project_name.to_owned(),
version: "0.0.0".to_owned(),
Expand Down