Skip to content

Commit 889dee0

Browse files
authored
chore(core): update rust to 2024 edition (#31156)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> Currently using 2021 edition of rust ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> Updates to 2024 edition to support more features that are coming in other PRs ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #
1 parent 3d73fd3 commit 889dee0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+165
-133
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,13 @@ jobs:
123123
settings:
124124
- host: macos-13
125125
target: x86_64-apple-darwin
126+
setup: |-
127+
rustup target add aarch64-apple-darwin
126128
build: |
127129
pnpm nx run-many --target=build-native -- --target=x86_64-apple-darwin
128130
- host: windows-latest
131+
setup: |-
132+
rustup target add aarch64-pc-windows-msvc
129133
build: pnpm nx run-many --target=build-native -- --target=x86_64-pc-windows-msvc
130134
target: x86_64-pc-windows-msvc
131135
# Windows 32bit (not needed)
@@ -141,6 +145,7 @@ jobs:
141145
npm i -g [email protected] --force &&
142146
pnpm --version &&
143147
pnpm install --frozen-lockfile &&
148+
rustup target add aarch64-unknown-linux-gnu &&
144149
pnpm nx run-many --verbose --target=build-native -- --target=x86_64-unknown-linux-gnu
145150
- host: ubuntu-latest
146151
target: x86_64-unknown-linux-musl
@@ -150,9 +155,12 @@ jobs:
150155
npm i -g [email protected] --force &&
151156
pnpm --version &&
152157
pnpm install --frozen-lockfile &&
158+
rustup target add x86_64-unknown-linux-musl &&
153159
pnpm nx run-many --verbose --target=build-native -- --target=x86_64-unknown-linux-musl
154160
- host: macos-13
155161
target: aarch64-apple-darwin
162+
setup: |-
163+
rustup target add aarch64-apple-darwin
156164
build: |
157165
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
158166
export CC=$(xcrun -f clang);
@@ -168,12 +176,14 @@ jobs:
168176
npm i -g [email protected] --force &&
169177
pnpm --version &&
170178
pnpm install --frozen-lockfile &&
179+
rustup target add aarch64-unknown-linux-gnu &&
171180
pnpm nx run-many --verbose --target=build-native -- --target=aarch64-unknown-linux-gnu
172181
- host: ubuntu-latest
173182
target: armv7-unknown-linux-gnueabihf
174183
setup: |
175184
sudo apt-get update
176185
sudo apt-get install gcc-arm-linux-gnueabihf -y
186+
rustup target add armv7-unknown-linux-gnueabihf
177187
build: |
178188
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=/usr/bin/arm-linux-gnueabihf-gcc pnpm nx run-many --target=build-native -- --target=armv7-unknown-linux-gnueabihf
179189
# Android (not needed)
@@ -197,6 +207,8 @@ jobs:
197207
pnpm nx run-many --verbose --target=build-native -- --target=aarch64-unknown-linux-musl
198208
- host: windows-latest
199209
target: aarch64-pc-windows-msvc
210+
setup: |-
211+
rustup target add aarch64-pc-windows-msvc
200212
build: pnpm nx run-many --target=build-native -- --target=aarch64-pc-windows-msvc
201213
name: stable - ${{ matrix.settings.target }} - node@18
202214
runs-on: ${{ matrix.settings.host }}

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/tools/**/* @FrozenPandaz @vsavkin @AgentEnder @jaysoo @JamesHenry
77
package.json @nrwl/nx-core-reviewers
88
pnpm-lock.yaml @nrwl/nx-core-reviewers
9-
rust-toolchain @nrwl/nx-native-reviewers
9+
rust-toolchain.toml @nrwl/nx-native-reviewers
1010

1111
# Docs Site + Graph
1212
/docs @nrwl/nx-docs-reviewers

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"preinstall": "node ./scripts/preinstall.js",
2424
"test": "nx run-many -t test",
2525
"e2e": "nx run-many -t e2e --projects ./e2e/*",
26-
"build:wasm": "rustup override set nightly-2024-07-19 && rustup target add wasm32-wasip1-threads && WASI_SDK_PATH=\"$(pwd)/wasi-sdk-23.0-x86_64-linux\" CMAKE_BUILD_PARALLEL_LEVEL=2 LIBSQLITE3_FLAGS=\"-DLONGDOUBLE_TYPE=double\" pnpm exec nx run-many -t build-native-wasm && rustup override unset",
26+
"build:wasm": "rustup override set nightly-2025-05-09 && rustup target add wasm32-wasip1-threads && WASI_SDK_PATH=\"$(pwd)/wasi-sdk-23.0-x86_64-linux\" CMAKE_BUILD_PARALLEL_LEVEL=2 LIBSQLITE3_FLAGS=\"-DLONGDOUBLE_TYPE=double\" pnpm exec nx run-many -t build-native-wasm && rustup override unset",
2727
"lint-pnpm-lock": "eslint pnpm-lock.yaml"
2828
},
2929
"devDependencies": {

packages/nx/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = 'nx'
33
version = '0.1.0'
4-
edition = '2021'
4+
edition = '2024'
55

66
[profile.release-wasi]
77
codegen-units = 16
@@ -64,7 +64,7 @@ vt100-ctt = { git = "https://github.com/JamesHenry/vt100-rust", rev = "b15dc3b0f
6464
winapi = { version = "0.3", features = ["fileapi", "psapi", "shellapi"] }
6565

6666
[target.'cfg(all(not(windows), not(target_family = "wasm")))'.dependencies]
67-
mio = "0.8"
67+
mio = "1.0"
6868
nix = { version = "0.30.0", features = ["process", "signal"] }
6969

7070
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

packages/nx/src/native/cache/cache.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ impl NxCache {
179179
) -> anyhow::Result<()> {
180180
trace!(
181181
"applying remote cache results: {:?} ({})",
182-
&hash,
183-
&result.outputs_path
182+
&hash, &result.outputs_path
184183
);
185184
let terminal_output = result.terminal_output.clone().unwrap_or(String::from(""));
186185
let mut size = terminal_output.len() as i64;
@@ -298,8 +297,7 @@ impl NxCache {
298297

299298
trace!(
300299
"Copying Files from Cache {:?} -> {:?}",
301-
&outputs_path,
302-
&self.workspace_root
300+
&outputs_path, &self.workspace_root
303301
);
304302
let sz = _copy(outputs_path, &self.workspace_root);
305303

packages/nx/src/native/cache/expand_outputs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ pub fn get_files_for_outputs(
170170
#[cfg(test)]
171171
mod test {
172172
use super::*;
173-
use assert_fs::prelude::*;
174173
use assert_fs::TempDir;
174+
use assert_fs::prelude::*;
175175
use std::{assert_eq, vec};
176176

177177
fn setup_fs() -> TempDir {

packages/nx/src/native/cache/file_ops.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Result<u64>
9898
#[cfg(test)]
9999
mod test {
100100
use super::*;
101-
use assert_fs::prelude::*;
102101
use assert_fs::TempDir;
102+
use assert_fs::prelude::*;
103103

104104
#[test]
105105
fn should_copy_directories() {
@@ -115,9 +115,10 @@ mod test {
115115
let dest = temp.join("new-parent/child/grand-child/.config");
116116
copy(src.to_string_lossy().into(), dest.to_string_lossy().into()).unwrap();
117117

118-
assert!(temp
119-
.child("new-parent/child/grand-child/.config/file.txt")
120-
.exists());
118+
assert!(
119+
temp.child("new-parent/child/grand-child/.config/file.txt")
120+
.exists()
121+
);
121122
}
122123

123124
#[test]

packages/nx/src/native/cache/http_remote_cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use std::{
77

88
use super::{
99
cache::CachedResult,
10-
errors::{convert_response_to_error, report_request_error, HttpRemoteCacheErrors},
10+
errors::{HttpRemoteCacheErrors, convert_response_to_error, report_request_error},
1111
};
1212
use flate2::Compression;
13-
use reqwest::{header, Client, ClientBuilder, StatusCode};
13+
use reqwest::{Client, ClientBuilder, StatusCode, header};
1414
use tar::{Archive, Builder};
1515
use tracing::trace;
1616

packages/nx/src/native/db/initialize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::native::db::connection::NxDbConnection;
22
use rusqlite::{Connection, OpenFlags};
3-
use std::fs::{remove_file, File};
3+
use std::fs::{File, remove_file};
44
use std::path::{Path, PathBuf};
55
use tracing::{debug, trace};
66

packages/nx/src/native/glob/glob_parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::native::glob::glob_group::GlobGroup;
22
use nom::branch::alt;
33
use nom::bytes::complete::{is_not, tag, take_till, take_until, take_while};
44
use nom::combinator::{eof, map, map_parser};
5-
use nom::error::{context, convert_error, VerboseError};
5+
use nom::error::{VerboseError, context, convert_error};
66
use nom::multi::{many_till, separated_list0};
77
use nom::sequence::{preceded, terminated};
88
use nom::{Finish, IResult};

packages/nx/src/native/hasher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ pub fn hash_file_path<P: AsRef<Path>>(path: P) -> Option<String> {
4646
#[cfg(test)]
4747
mod tests {
4848
use crate::native::hasher::{hash_array, hash_file};
49-
use assert_fs::prelude::*;
5049
use assert_fs::TempDir;
50+
use assert_fs::prelude::*;
5151

5252
///
5353
/// Setup a temporary directory to do testing in

packages/nx/src/native/logger/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::fs::create_dir_all;
66
use std::io::IsTerminal;
77
use tracing::{Event, Level, Subscriber};
88
use tracing_appender::rolling::{RollingFileAppender, Rotation};
9-
use tracing_subscriber::fmt::{format, FmtContext, FormatEvent, FormatFields, FormattedFields};
9+
use tracing_subscriber::fmt::{FmtContext, FormatEvent, FormatFields, FormattedFields, format};
1010
use tracing_subscriber::prelude::*;
1111
use tracing_subscriber::registry::LookupSpan;
1212
use tracing_subscriber::{EnvFilter, Layer};

packages/nx/src/native/nx.wasi-browser.js

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -59,43 +59,45 @@ function __napi_rs_initialize_modules(__napiInstance) {
5959
__napiInstance.exports['__napi_register__get_transformable_outputs_5']?.()
6060
__napiInstance.exports['__napi_register__hash_array_6']?.()
6161
__napiInstance.exports['__napi_register__hash_file_7']?.()
62-
__napiInstance.exports['__napi_register__IS_WASM_8']?.()
63-
__napiInstance.exports['__napi_register__get_binary_target_9']?.()
64-
__napiInstance.exports['__napi_register__ImportResult_struct_10']?.()
65-
__napiInstance.exports['__napi_register__find_imports_11']?.()
66-
__napiInstance.exports['__napi_register__transfer_project_graph_12']?.()
67-
__napiInstance.exports['__napi_register__ExternalNode_struct_13']?.()
68-
__napiInstance.exports['__napi_register__Target_struct_14']?.()
69-
__napiInstance.exports['__napi_register__Project_struct_15']?.()
70-
__napiInstance.exports['__napi_register__ProjectGraph_struct_16']?.()
71-
__napiInstance.exports['__napi_register__HashPlanner_struct_17']?.()
72-
__napiInstance.exports['__napi_register__HashPlanner_impl_21']?.()
73-
__napiInstance.exports['__napi_register__HashDetails_struct_22']?.()
74-
__napiInstance.exports['__napi_register__HasherOptions_struct_23']?.()
75-
__napiInstance.exports['__napi_register__TaskHasher_struct_24']?.()
76-
__napiInstance.exports['__napi_register__TaskHasher_impl_27']?.()
77-
__napiInstance.exports['__napi_register__Task_struct_28']?.()
78-
__napiInstance.exports['__napi_register__TaskTarget_struct_29']?.()
79-
__napiInstance.exports['__napi_register__TaskResult_struct_30']?.()
80-
__napiInstance.exports['__napi_register__TaskGraph_struct_31']?.()
81-
__napiInstance.exports['__napi_register__FileData_struct_32']?.()
82-
__napiInstance.exports['__napi_register__InputsInput_struct_33']?.()
83-
__napiInstance.exports['__napi_register__FileSetInput_struct_34']?.()
84-
__napiInstance.exports['__napi_register__RuntimeInput_struct_35']?.()
85-
__napiInstance.exports['__napi_register__EnvironmentInput_struct_36']?.()
86-
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_37']?.()
87-
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_38']?.()
88-
__napiInstance.exports['__napi_register__NxJson_struct_39']?.()
89-
__napiInstance.exports['__napi_register__FileLock_struct_40']?.()
90-
__napiInstance.exports['__napi_register__FileLock_impl_42']?.()
91-
__napiInstance.exports['__napi_register__WorkspaceContext_struct_43']?.()
92-
__napiInstance.exports['__napi_register__WorkspaceContext_impl_54']?.()
93-
__napiInstance.exports['__napi_register__WorkspaceErrors_55']?.()
94-
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_56']?.()
95-
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_57']?.()
96-
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_58']?.()
97-
__napiInstance.exports['__napi_register__FileMap_struct_59']?.()
98-
__napiInstance.exports['__napi_register____test_only_transfer_file_map_60']?.()
62+
__napiInstance.exports['__napi_register__log_info_8']?.()
63+
__napiInstance.exports['__napi_register__log_error_9']?.()
64+
__napiInstance.exports['__napi_register__IS_WASM_10']?.()
65+
__napiInstance.exports['__napi_register__get_binary_target_11']?.()
66+
__napiInstance.exports['__napi_register__ImportResult_struct_12']?.()
67+
__napiInstance.exports['__napi_register__find_imports_13']?.()
68+
__napiInstance.exports['__napi_register__transfer_project_graph_14']?.()
69+
__napiInstance.exports['__napi_register__ExternalNode_struct_15']?.()
70+
__napiInstance.exports['__napi_register__Target_struct_16']?.()
71+
__napiInstance.exports['__napi_register__Project_struct_17']?.()
72+
__napiInstance.exports['__napi_register__ProjectGraph_struct_18']?.()
73+
__napiInstance.exports['__napi_register__HashPlanner_struct_19']?.()
74+
__napiInstance.exports['__napi_register__HashPlanner_impl_23']?.()
75+
__napiInstance.exports['__napi_register__HashDetails_struct_24']?.()
76+
__napiInstance.exports['__napi_register__HasherOptions_struct_25']?.()
77+
__napiInstance.exports['__napi_register__TaskHasher_struct_26']?.()
78+
__napiInstance.exports['__napi_register__TaskHasher_impl_29']?.()
79+
__napiInstance.exports['__napi_register__Task_struct_30']?.()
80+
__napiInstance.exports['__napi_register__TaskTarget_struct_31']?.()
81+
__napiInstance.exports['__napi_register__TaskResult_struct_32']?.()
82+
__napiInstance.exports['__napi_register__TaskGraph_struct_33']?.()
83+
__napiInstance.exports['__napi_register__FileData_struct_34']?.()
84+
__napiInstance.exports['__napi_register__InputsInput_struct_35']?.()
85+
__napiInstance.exports['__napi_register__FileSetInput_struct_36']?.()
86+
__napiInstance.exports['__napi_register__RuntimeInput_struct_37']?.()
87+
__napiInstance.exports['__napi_register__EnvironmentInput_struct_38']?.()
88+
__napiInstance.exports['__napi_register__ExternalDependenciesInput_struct_39']?.()
89+
__napiInstance.exports['__napi_register__DepsOutputsInput_struct_40']?.()
90+
__napiInstance.exports['__napi_register__NxJson_struct_41']?.()
91+
__napiInstance.exports['__napi_register__FileLock_struct_42']?.()
92+
__napiInstance.exports['__napi_register__FileLock_impl_44']?.()
93+
__napiInstance.exports['__napi_register__WorkspaceContext_struct_45']?.()
94+
__napiInstance.exports['__napi_register__WorkspaceContext_impl_56']?.()
95+
__napiInstance.exports['__napi_register__WorkspaceErrors_57']?.()
96+
__napiInstance.exports['__napi_register__NxWorkspaceFiles_struct_58']?.()
97+
__napiInstance.exports['__napi_register__NxWorkspaceFilesExternals_struct_59']?.()
98+
__napiInstance.exports['__napi_register__UpdatedWorkspaceFiles_struct_60']?.()
99+
__napiInstance.exports['__napi_register__FileMap_struct_61']?.()
100+
__napiInstance.exports['__napi_register____test_only_transfer_file_map_62']?.()
99101
}
100102
export const FileLock = __napiModule.exports.FileLock
101103
export const HashPlanner = __napiModule.exports.HashPlanner
@@ -111,6 +113,8 @@ export const getTransformableOutputs = __napiModule.exports.getTransformableOutp
111113
export const hashArray = __napiModule.exports.hashArray
112114
export const hashFile = __napiModule.exports.hashFile
113115
export const IS_WASM = __napiModule.exports.IS_WASM
116+
export const logError = __napiModule.exports.logError
117+
export const logInfo = __napiModule.exports.logInfo
114118
export const remove = __napiModule.exports.remove
115119
export const testOnlyTransferFileMap = __napiModule.exports.testOnlyTransferFileMap
116120
export const transferProjectGraph = __napiModule.exports.transferProjectGraph

0 commit comments

Comments
 (0)