Skip to content

Commit

Permalink
Remove all usages of unstable rust features (#10813)
Browse files Browse the repository at this point in the history
Removed all `#![feature]` flags, except for `#![feature(test)]`. Once parser benchmarks are ported to something that is compatible with stable rust, we will be able to switch to it.
  • Loading branch information
Frizi authored Aug 22, 2024
1 parent 60ae6f9 commit 7653280
Show file tree
Hide file tree
Showing 81 changed files with 356 additions and 359 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ blocks_in_conditions = "allow" # Until the issue is fixed: https://github.com/ru
# We are tryingto maintain minimum set of dependencies. Before adding a new dependency, consult it
# with the core development team. Thank you!
chrono = { version = "0.4.31", features = ["serde"] }
clap = { version = "4.5.4", features = ["derive", "env", "wrap_help", "string"] }
clap = { version = "4.5.15", features = ["derive", "env", "wrap_help", "string"] }
derive-where = "1.2.7"
directories = { version = "5.0.1" }
dirs = { version = "5.0.1" }
Expand Down
8 changes: 7 additions & 1 deletion app/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,13 @@ export default [
eslintJs.configs.recommended,
{
// Playwright build cache and Vite build directory.
ignores: ['**/.cache/**', '**/playwright-report', '**/dist', '**/build.mjs'],
ignores: [
'**/.cache/**',
'**/playwright-report',
'**/dist',
'**/build.mjs',
'**/*.timestamp-*.mjs',
],
},
{
settings: {
Expand Down
3 changes: 1 addition & 2 deletions app/gui2/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ const conf = [
{
ignores: [
'dist',
'shared/ast/generated',
'templates',
'.histoire',
'playwright-report',
'test-results',
'vite.ydoc-server-polyglot.config.ts',
'**/*.timestamp-*.mjs',
],
},
...compat.extends('plugin:vue/vue3-recommended'),
Expand Down
2 changes: 1 addition & 1 deletion build/build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ base64 = "0.13.0"
bytes = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
convert_case = { workspace = true }
derive-where = { workspace = true }
derive_more = { workspace = true }
dirs = { workspace = true }
futures = { workspace = true }
glob = "0.3.0"
handlebars = "4.3.5"
heck = "0.4.0"
enso-build-base = { path = "../base" }
enso-enso-font = { path = "../../lib/rust/enso-font" }
enso-font = { path = "../../lib/rust/font" }
Expand Down
5 changes: 1 addition & 4 deletions build/build/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// === Features ===
#![feature(exit_status_error)]

use ide_ci::prelude::*;

use ide_ci::programs::cargo::build::rerun_if_file_changed;
Expand All @@ -14,6 +11,6 @@ fn main() -> Result {
let out_dir = ide_ci::programs::cargo::build_env::OUT_DIR.get()?;
let out_path = out_dir.join("paths.rs");
ide_ci::fs::write(&out_path, code.to_string())?;
std::process::Command::new("rustfmt").arg(&out_path).status()?.exit_ok()?;
assert!(std::process::Command::new("rustfmt").arg(&out_path).status()?.success());
Ok(())
}
9 changes: 5 additions & 4 deletions build/build/src/ci_gen/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use crate::engine::env;
use crate::ide::web::env::VITE_ENSO_AG_GRID_LICENSE_KEY;
use crate::ide::web::env::VITE_ENSO_MAPBOX_API_TOKEN;

use heck::ToKebabCase;
use convert_case::Case;
use convert_case::Casing;
use ide_ci::actions::workflow::definition::cancel_workflow_action;
use ide_ci::actions::workflow::definition::Access;
use ide_ci::actions::workflow::definition::Job;
Expand Down Expand Up @@ -206,7 +207,7 @@ impl JobArchetype for JvmTests {
format!(
"{}-{}-{os}-{arch}",
self.id_key_base(),
self.graal_edition.to_string().to_kebab_case()
self.graal_edition.to_string().to_case(Case::Kebab)
)
}
}
Expand Down Expand Up @@ -251,7 +252,7 @@ impl JobArchetype for StandardLibraryTests {
format!(
"{}-{}-{os}-{arch}",
self.id_key_base(),
self.graal_edition.to_string().to_kebab_case()
self.graal_edition.to_string().to_case(Case::Kebab)
)
}
}
Expand Down Expand Up @@ -491,7 +492,7 @@ impl JobArchetype for CiCheckBackend {
format!(
"{}-{}-{os}-{arch}",
self.id_key_base(),
self.graal_edition.to_string().to_kebab_case()
self.graal_edition.to_string().to_case(Case::Kebab)
)
}
}
4 changes: 2 additions & 2 deletions build/build/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ impl BuiltArtifacts {
pub fn artifacts(&self) -> Vec<&dyn IsArtifact> {
let mut artifacts = Vec::<&dyn IsArtifact>::new();
for package in self.packages() {
artifacts.push(package);
artifacts.push(package.as_dyn_artifact());
}
for bundle in self.bundles() {
artifacts.push(bundle);
artifacts.push(bundle.as_dyn_artifact());
}
artifacts
}
Expand Down
17 changes: 17 additions & 0 deletions build/build/src/engine/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,51 @@ pub trait IsArtifact: AsRef<Path> + Send + Sync {
let name = self.asset_file_stem();
async move { release.upload_compressed_dir_as(path, name?).await }.boxed()
}

fn as_dyn_artifact(&self) -> &dyn IsArtifact;
}

impl IsArtifact for crate::paths::generated::EnginePackage {
fn kind(&self) -> ArtifactKind {
ArtifactKind::EnginePackage
}
fn as_dyn_artifact(&self) -> &dyn IsArtifact {
self
}
}

impl IsArtifact for crate::paths::generated::ProjectManagerPackage {
fn kind(&self) -> ArtifactKind {
ArtifactKind::ProjectManagerPackage
}
fn as_dyn_artifact(&self) -> &dyn IsArtifact {
self
}
}

impl IsArtifact for crate::paths::generated::ProjectManagerBundle {
fn kind(&self) -> ArtifactKind {
ArtifactKind::ProjectManagerBundle
}
fn as_dyn_artifact(&self) -> &dyn IsArtifact {
self
}
}

impl IsArtifact for crate::paths::generated::LauncherPackage {
fn kind(&self) -> ArtifactKind {
ArtifactKind::LauncherPackage
}
fn as_dyn_artifact(&self) -> &dyn IsArtifact {
self
}
}

impl IsArtifact for crate::paths::generated::LauncherBundle {
fn kind(&self) -> ArtifactKind {
ArtifactKind::LauncherBundle
}
fn as_dyn_artifact(&self) -> &dyn IsArtifact {
self
}
}
5 changes: 2 additions & 3 deletions build/build/src/engine/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,8 @@ impl RunContext {
.args(run)
.current_dir(&self.paths.repo_root)
.spawn()?
.wait()
.await?
.exit_ok()?;
.wait_ok()
.await?;
} else {
debug!("Spawning default shell.");
let mut shell =
Expand Down
3 changes: 3 additions & 0 deletions build/build/src/enso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ impl BuiltEnso {

#[async_trait]
impl Program for BuiltEnso {
type Command = Command;
type Version = Version;

fn executable_name(&self) -> &str {
ide_ci::platform::DEFAULT_SHELL.executable_name()
}
Expand Down
9 changes: 5 additions & 4 deletions build/build/src/ide/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,11 @@ pub struct RemoveEmptyCscEnvVars;
impl Manipulator for RemoveEmptyCscEnvVars {
fn apply<C: IsCommandWrapper + ?Sized>(&self, command: &mut C) {
for var in ide_ci::env::known::electron_builder::CI_CSC_SECRETS {
if let Ok(value) = std::env::var(var)
&& value.is_empty()
{
command.env_remove(var);
match std::env::var(var) {
Ok(value) if value.is_empty() => {
command.env_remove(var);
}
_ => {}
}
}
}
Expand Down
12 changes: 0 additions & 12 deletions build/build/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
// === Features ===
#![feature(hash_set_entry)]
#![feature(type_alias_impl_trait)]
#![feature(trait_alias)]
#![feature(let_chains)]
#![feature(exit_status_error)]
#![feature(async_closure)]
#![feature(associated_type_defaults)]
#![feature(duration_constants)]
#![feature(slice_take)]
#![feature(future_join)]
#![feature(trait_upcasting)]
// === Non-Standard Linter Configuration ===
#![warn(trivial_casts)]
#![warn(unused_qualifications)]
Expand Down
3 changes: 3 additions & 0 deletions build/build/src/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ pub mod project_manager {
pub struct ProjectManager;

impl Program for ProjectManager {
type Command = Command;
type Version = Version;

fn executable_name(&self) -> &'static str {
"project-manager"
}
Expand Down
2 changes: 1 addition & 1 deletion build/ci_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ bincode = "1.3.3"
bytes = { workspace = true }
chrono = { workspace = true }
clap = { workspace = true }
convert_case = { workspace = true }
data-encoding = "2.3.2"
dependency_runner = "1.1.0"
derive-where = { workspace = true }
Expand All @@ -26,7 +27,6 @@ futures = { workspace = true }
futures-util = { workspace = true }
glob = "0.3.0"
headers = "0.3.7"
heck = "0.4.0"
http-serde = "1.1.0"
indicatif = { workspace = true }
itertools = { workspace = true }
Expand Down
7 changes: 4 additions & 3 deletions build/ci_utils/src/actions/workflow/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use crate::prelude::*;

use crate::env::accessor::RawVariable;

use heck::ToKebabCase;
use convert_case::Case;
use convert_case::Casing;
use std::collections::btree_map::Entry;
use std::collections::BTreeMap;
use std::convert::identity;
Expand Down Expand Up @@ -237,7 +238,7 @@ impl Workflow {

impl Workflow {
pub fn add_job(&mut self, job: Job) -> String {
let key = job.name.to_kebab_case();
let key = job.name.to_case(Case::Kebab);
if self.jobs.insert(key.clone(), job).is_some() {
warn!("Job with name {key} already exists.");
}
Expand Down Expand Up @@ -1060,7 +1061,7 @@ pub fn checkout_repo_step() -> impl IntoIterator<Item = Step> {

pub trait JobArchetype {
fn id_key_base(&self) -> String {
std::any::type_name::<Self>().to_kebab_case()
std::any::type_name::<Self>().to_case(Case::Kebab)
}

fn key(&self, (os, arch): Target) -> String {
Expand Down
11 changes: 0 additions & 11 deletions build/ci_utils/src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ impl Format {
let mut archive = ::tar::Archive::new(tar_stream);
archive.unpack(output_dir)?;
}
// Format::SevenZip => {
// let mut cmd = SevenZip.unpack_from_stdin_cmd(output_dir)?;
// cmd.stdin(Stdio::piped());
// let mut child = cmd.as_std().clone().spawn()?;
// //let child = cmd.spawn_nicer()?;
// let mut stdin =
// child.stdin.ok_or_else(|| anyhow!("Failed to get 7z stdin handle"))?;
// std::io::copy(&mut compressed_data, &mut stdin)?;
// drop(stdin);
// child.wait()?.exit_ok()?;
// }
_ => todo!("Not supported!"),
}
Ok(())
Expand Down
6 changes: 4 additions & 2 deletions build/ci_utils/src/env/accessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub trait TypedVariable: RawVariable {
type Value;

/// The borrowed type of this variable.
type Borrowed: ?Sized = Self::Value;
type Borrowed: ?Sized;

/// Construct a value of this variable by parsing the raw text value.
fn parse(&self, value: &str) -> Result<Self::Value>;
Expand Down Expand Up @@ -210,11 +210,12 @@ impl RawVariable for PathLike {

impl TypedVariable for PathLike {
type Value = Vec<PathBuf>;
type Borrowed = [PathBuf];
fn parse(&self, value: &str) -> Result<Self::Value> {
Ok(std::env::split_paths(value).collect())
}

fn generate(&self, value: &Self::Value) -> Result<String> {
fn generate(&self, value: &Self::Borrowed) -> Result<String> {
std::env::join_paths(value)?
.into_string()
.map_err(|e| anyhow!("Not a valid UTF-8 string: '{}'.", e.to_string_lossy()))
Expand Down Expand Up @@ -247,6 +248,7 @@ impl RawVariable for Separated {

impl TypedVariable for Separated {
type Value = Vec<String>;
type Borrowed = [String];

fn parse(&self, value: &str) -> Result<Self::Value> {
Ok(value.split(self.separator).map(ToString::to_string).collect())
Expand Down
2 changes: 1 addition & 1 deletion build/ci_utils/src/extensions/child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub trait ChildExt {

impl ChildExt for tokio::process::Child {
fn wait_ok(&mut self) -> BoxFuture<Result> {
async move { Ok(self.wait().await?.exit_ok()?) }.boxed()
async move { default_status_checker(self.wait().await?) }.boxed()
}

fn kill_subtree(&self) {
Expand Down
Loading

0 comments on commit 7653280

Please sign in to comment.