Skip to content

Commit

Permalink
Support edition 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
mohe2015 committed Dec 19, 2023
1 parent 8f62662 commit ee0a562
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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

0 comments on commit ee0a562

Please sign in to comment.