From dbbca4faafc7d96d55c233e6b0adc2f54175c4fb Mon Sep 17 00:00:00 2001 From: CHISEN Kaoru Date: Mon, 26 Jan 2026 23:51:00 +0000 Subject: [PATCH 01/76] fix!: Polonius subset calculation algorithm --- src/bin/core/analyze/polonius_analyzer.rs | 77 ++++++++++++++--------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/src/bin/core/analyze/polonius_analyzer.rs b/src/bin/core/analyze/polonius_analyzer.rs index 016534a2..f8e45c8a 100644 --- a/src/bin/core/analyze/polonius_analyzer.rs +++ b/src/bin/core/analyze/polonius_analyzer.rs @@ -77,17 +77,6 @@ pub fn get_must_live( borrow_map: &BorrowMap, basic_blocks: &[MirBasicBlock], ) -> HashMap> { - // obtain a map that region -> region contained locations - let mut region_locations = HashMap::new(); - for (location_idx, region_idc) in output.origin_live_on_entry().iter() { - for region_idx in region_idc { - region_locations - .entry(*region_idx) - .or_insert_with(HashSet::new) - .insert(*location_idx); - } - } - // obtain a map that borrow index -> local let mut borrow_local = HashMap::new(); for (local, borrow_idc) in borrow_map.local_map().iter() { @@ -96,38 +85,66 @@ pub fn get_must_live( } } - // check all regions' subset that must be satisfied - let mut subsets = HashMap::new(); - for (_, subset) in output.subset().iter() { - for (sup, subs) in subset.iter() { - subsets - .entry(*sup) + // obtain a map that region -> region contained locations + let mut region_locations = HashMap::new(); + for (location_idx, region_idc) in output.origin_live_on_entry().iter() { + for region_idx in region_idc { + region_locations + .entry(*region_idx) .or_insert_with(HashSet::new) - .extend(subs.iter().copied()); + .insert(*location_idx); } } - // obtain a map that region -> locations - // a region must contains the locations + + // obtain a map that region -> locations where region must be live + // For subset relation sup >= sub at point p: + // - if sup is live at p, sup itself must be live at p (for borrows contained in sup) + // - if sup is live at p, sub must also be live at p (for borrows contained in sub) + // IMPORTANT: subset relations only apply from the point where they are established let mut region_must_locations = HashMap::new(); - for (sup, subs) in subsets.iter() { - for sub in subs { - if let Some(locs) = region_locations.get(sub) { + for (location_idx, subset) in output.subset().iter() { + for (sup, subs) in subset.iter() { + // If sup region is live at this point + if region_locations + .get(sup) + .is_some_and(|locs| locs.contains(location_idx)) + { + // sup is must_live at this point (for borrows contained in sup) region_must_locations .entry(*sup) .or_insert_with(HashSet::new) - .extend(locs.iter().copied()); + .insert(*location_idx); + // sub regions are also must_live at this point + for sub in subs { + region_must_locations + .entry(*sub) + .or_insert_with(HashSet::new) + .insert(*location_idx); + } } } } - // obtain a map that local -> locations - // a local must lives in the locations - let mut local_must_locations = HashMap::new(); + + // Build a map from borrow to all regions that ever contain it + let mut borrow_regions = HashMap::new(); for (_location, region_borrows) in output.origin_contains_loan_at().iter() { for (region, borrows) in region_borrows.iter() { for borrow in borrows { - if let Some(locs) = region_must_locations.get(region) - && let Some(local) = borrow_local.get(borrow) - { + borrow_regions + .entry(*borrow) + .or_insert_with(HashSet::new) + .insert(*region); + } + } + } + + // obtain a map that local -> locations + // a local must live where any of its borrow's regions must be live + let mut local_must_locations = HashMap::new(); + for (borrow, regions) in borrow_regions.iter() { + if let Some(local) = borrow_local.get(borrow) { + for region in regions { + if let Some(locs) = region_must_locations.get(region) { local_must_locations .entry(*local) .or_insert_with(HashSet::new) From 93972c89400c05db97a99349d7f8af5087957f25 Mon Sep 17 00:00:00 2001 From: CHISEN Kaoru Date: Tue, 27 Jan 2026 00:17:38 +0000 Subject: [PATCH 02/76] chore: add algorithm check scripts --- algo-tests/Cargo.lock | 7 +++++++ algo-tests/Cargo.toml | 6 ++++++ algo-tests/f1_v1.txt | 25 +++++++++++++++++++++++++ algo-tests/f1_v2.txt | 24 ++++++++++++++++++++++++ algo-tests/f2_v1.txt | 27 +++++++++++++++++++++++++++ algo-tests/f2_v2.txt | 24 ++++++++++++++++++++++++ algo-tests/f3_v1.txt | 31 +++++++++++++++++++++++++++++++ algo-tests/f3_v2.txt | 23 +++++++++++++++++++++++ algo-tests/src/main.rs | 5 +++++ algo-tests/src/vec.rs | 25 +++++++++++++++++++++++++ scripts/algorithm.sh | 20 ++++++++++++++++++++ 11 files changed, 217 insertions(+) create mode 100644 algo-tests/Cargo.lock create mode 100644 algo-tests/Cargo.toml create mode 100644 algo-tests/f1_v1.txt create mode 100644 algo-tests/f1_v2.txt create mode 100644 algo-tests/f2_v1.txt create mode 100644 algo-tests/f2_v2.txt create mode 100644 algo-tests/f3_v1.txt create mode 100644 algo-tests/f3_v2.txt create mode 100644 algo-tests/src/main.rs create mode 100644 algo-tests/src/vec.rs create mode 100755 scripts/algorithm.sh diff --git a/algo-tests/Cargo.lock b/algo-tests/Cargo.lock new file mode 100644 index 00000000..0a77931b --- /dev/null +++ b/algo-tests/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "algo-tests" +version = "0.1.0" diff --git a/algo-tests/Cargo.toml b/algo-tests/Cargo.toml new file mode 100644 index 00000000..b299f8e8 --- /dev/null +++ b/algo-tests/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "algo-tests" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/algo-tests/f1_v1.txt b/algo-tests/f1_v1.txt new file mode 100644 index 00000000..68457e8e --- /dev/null +++ b/algo-tests/f1_v1.txt @@ -0,0 +1,25 @@ + +=== Variable 'v1' (1/1) in function 'vec::f1' === + + 1 | fn f1() { + 2 | let v1: Vec<_> = (0..100).collect(); + l |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + c |  ~~~~~~~~~~ + 3 | let v2: Vec<_> = (0..100).collect(); + l | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 4 | println!("{v1:?} {v2:?}"); + l | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + i |  ~~~ + 5 | println!("finish"); + l | ~~~~~~~~~~~~~~~~~~~~~~~~ + 6 | } + l | ~~ + 7 | + 8 | fn f2() { + +Legend: + ~~~ lifetime (l) + ~~~ immutable borrow (i) + ~~~ mutable borrow (m) + ~~~ move (v) / call (c) + ~~~ outlive (o) / shared mutable (s) diff --git a/algo-tests/f1_v2.txt b/algo-tests/f1_v2.txt new file mode 100644 index 00000000..bdae3cf4 --- /dev/null +++ b/algo-tests/f1_v2.txt @@ -0,0 +1,24 @@ + +=== Variable 'v2' (1/1) in function 'vec::f1' === + + 1 | fn f1() { + 2 | let v1: Vec<_> = (0..100).collect(); + 3 | let v2: Vec<_> = (0..100).collect(); + l |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + c |  ~~~~~~~~~~ + 4 | println!("{v1:?} {v2:?}"); + l | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + i |  ~~~ + 5 | println!("finish"); + l | ~~~~~~~~~~~~~~~~~~~~~~~~ + 6 | } + l | ~~ + 7 | + 8 | fn f2() { + +Legend: + ~~~ lifetime (l) + ~~~ immutable borrow (i) + ~~~ mutable borrow (m) + ~~~ move (v) / call (c) + ~~~ outlive (o) / shared mutable (s) diff --git a/algo-tests/f2_v1.txt b/algo-tests/f2_v1.txt new file mode 100644 index 00000000..b892f9d5 --- /dev/null +++ b/algo-tests/f2_v1.txt @@ -0,0 +1,27 @@ + +=== Variable 'v1' (1/1) in function 'vec::f2' === + + 7 | + 8 | fn f2() { + 9 | let v1: Vec<_> = (0..100).collect(); + l |  ~~~ ~~~~~~~ ~~ + c |  ~~~~~~~~~~ + 10 | println!("{v1:?}"); + l |  ~~~~~~ + i |  ~~~ + 11 | drop(v1); + v |  ~~~ + 12 | let v2: Vec<_> = (0..100).collect(); + 13 | println!("{v2:?}"); + 14 | drop(v2); + 15 | } + l | ~~ + 16 | + 17 | fn f3() { + +Legend: + ~~~ lifetime (l) + ~~~ immutable borrow (i) + ~~~ mutable borrow (m) + ~~~ move (v) / call (c) + ~~~ outlive (o) / shared mutable (s) diff --git a/algo-tests/f2_v2.txt b/algo-tests/f2_v2.txt new file mode 100644 index 00000000..98b5d618 --- /dev/null +++ b/algo-tests/f2_v2.txt @@ -0,0 +1,24 @@ + +=== Variable 'v2' (1/1) in function 'vec::f2' === + + 10 | println!("{v1:?}"); + 11 | drop(v1); + 12 | let v2: Vec<_> = (0..100).collect(); + l |  ~~~ ~~~~~~~ ~~ + c |  ~~~~~~~~~~ + 13 | println!("{v2:?}"); + l |  ~~~~~~ + i |  ~~~ + 14 | drop(v2); + v |  ~~~ + 15 | } + l | ~~ + 16 | + 17 | fn f3() { + +Legend: + ~~~ lifetime (l) + ~~~ immutable borrow (i) + ~~~ mutable borrow (m) + ~~~ move (v) / call (c) + ~~~ outlive (o) / shared mutable (s) diff --git a/algo-tests/f3_v1.txt b/algo-tests/f3_v1.txt new file mode 100644 index 00000000..47c875ea --- /dev/null +++ b/algo-tests/f3_v1.txt @@ -0,0 +1,31 @@ + +=== Variable 'v1' (1/1) in function 'vec::f3' === + + 16 | + 17 | fn f3() { + 18 | let v1: Vec<_> = (0..100).collect(); + l |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + c |  ~~~~~~~~~~ + 19 | let mut r = &v1; + l | ~~~~~~~~~~~~~~~~~~~~~ + i |  ~~~~ + 20 | if 0 < v1.len() { + l | ~~~~~~~~~~~~~~~~~~~~~~ + i |  ~~~ + 21 | let v2: Vec<_> = (0..100).collect(); + l | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 22 | r = &v2; + l | ~~~~~~~~~~~~~~~~~ + 23 | } + l | ~~~~~~ + 24 | println!("{r:?}"); + l | ~~~~~~~~~~~~~~~~~~~~~~~ + 25 | } + l | ~~ + +Legend: + ~~~ lifetime (l) + ~~~ immutable borrow (i) + ~~~ mutable borrow (m) + ~~~ move (v) / call (c) + ~~~ outlive (o) / shared mutable (s) diff --git a/algo-tests/f3_v2.txt b/algo-tests/f3_v2.txt new file mode 100644 index 00000000..aefd515f --- /dev/null +++ b/algo-tests/f3_v2.txt @@ -0,0 +1,23 @@ + +=== Variable 'v2' (1/1) in function 'vec::f3' === + + 19 | let mut r = &v1; + 20 | if 0 < v1.len() { + 21 | let v2: Vec<_> = (0..100).collect(); + l |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + c |  ~~~~~~~~~~ + 22 | r = &v2; + l | ~~~~~~~~~~~~~~~~~ + i |  ~~~~ + 23 | } + l | ~~~~~~ + 24 | println!("{r:?}"); + o |  ~~~~~~ + 25 | } + +Legend: + ~~~ lifetime (l) + ~~~ immutable borrow (i) + ~~~ mutable borrow (m) + ~~~ move (v) / call (c) + ~~~ outlive (o) / shared mutable (s) diff --git a/algo-tests/src/main.rs b/algo-tests/src/main.rs new file mode 100644 index 00000000..ecaab2d2 --- /dev/null +++ b/algo-tests/src/main.rs @@ -0,0 +1,5 @@ +mod vec; + +fn main() { + println!("Hello, world!"); +} diff --git a/algo-tests/src/vec.rs b/algo-tests/src/vec.rs new file mode 100644 index 00000000..11161577 --- /dev/null +++ b/algo-tests/src/vec.rs @@ -0,0 +1,25 @@ +fn f1() { + let v1: Vec<_> = (0..100).collect(); + let v2: Vec<_> = (0..100).collect(); + println!("{v1:?} {v2:?}"); + println!("finish"); +} + +fn f2() { + let v1: Vec<_> = (0..100).collect(); + println!("{v1:?}"); + drop(v1); + let v2: Vec<_> = (0..100).collect(); + println!("{v2:?}"); + drop(v2); +} + +fn f3() { + let v1: Vec<_> = (0..100).collect(); + let mut r = &v1; + if 0 < v1.len() { + let v2: Vec<_> = (0..100).collect(); + r = &v2; + } + println!("{r:?}"); +} diff --git a/scripts/algorithm.sh b/scripts/algorithm.sh new file mode 100755 index 00000000..7b9cd57c --- /dev/null +++ b/scripts/algorithm.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +cd "$(dirname $0)" +cd ../algo-tests + +F1_V1="$(rustowl show f1 v1)" +if [ "$F1_V1" != "$(cat f1_v1.txt)" ]; then + return 1 +fi + +for i in {1..3} +do + for j in {1..2} + do + RES="$(rustowl show f${i} v${j})" + if [ "$RES" != "$(cat f${i}_v${j}.txt)" ]; then + exit 1 + fi + done +done From 31e3cdd8570a80aba457a1366497c164974aa495 Mon Sep 17 00:00:00 2001 From: CHISEN Kaoru Date: Tue, 27 Jan 2026 00:52:14 +0000 Subject: [PATCH 03/76] chore: update algo check script --- scripts/algorithm.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/algorithm.sh b/scripts/algorithm.sh index 7b9cd57c..0b605ea2 100755 --- a/scripts/algorithm.sh +++ b/scripts/algorithm.sh @@ -3,16 +3,12 @@ cd "$(dirname $0)" cd ../algo-tests -F1_V1="$(rustowl show f1 v1)" -if [ "$F1_V1" != "$(cat f1_v1.txt)" ]; then - return 1 -fi - for i in {1..3} do for j in {1..2} do - RES="$(rustowl show f${i} v${j})" + echo "Check f${i} v${j}" + RES="$(rustowl show f${i} v${j} 2> /dev/null)" if [ "$RES" != "$(cat f${i}_v${j}.txt)" ]; then exit 1 fi From d486a4b3584bb2adc61454b907caf696bd27fd60 Mon Sep 17 00:00:00 2001 From: CHISEN Kaoru Date: Tue, 27 Jan 2026 00:55:55 +0000 Subject: [PATCH 04/76] chore: add algorithm test workflow --- .github/workflows/checks.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6769c297..736b3542 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -76,6 +76,9 @@ jobs: - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package + - name: Test algorithm consistency + run: ./scripts/algorithm.sh + vscode: name: VS Code Extension Checks runs-on: ubuntu-latest From b2672dac8d13dc3d20dcc51cf9beb6afc1dc329a Mon Sep 17 00:00:00 2001 From: CHISEN Kaoru Date: Tue, 27 Jan 2026 03:06:46 +0000 Subject: [PATCH 05/76] chore: add echo for test fail --- scripts/algorithm.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/algorithm.sh b/scripts/algorithm.sh index 0b605ea2..6fc827af 100755 --- a/scripts/algorithm.sh +++ b/scripts/algorithm.sh @@ -8,8 +8,10 @@ do for j in {1..2} do echo "Check f${i} v${j}" - RES="$(rustowl show f${i} v${j} 2> /dev/null)" - if [ "$RES" != "$(cat f${i}_v${j}.txt)" ]; then + RESULT="$(rustowl show f${i} v${j} 2> /dev/null)" + ASSERT="$(cat f${i}_v${j}.txt)" + if [ "$RESULT" != "$ASSERT" ]; then + diff -u <(echo "$RESULT") <(echo "$ASSERT") exit 1 fi done From d3f84dbea4ae569240b4c1463ab02338841b59ed Mon Sep 17 00:00:00 2001 From: CHISEN Kaoru Date: Tue, 27 Jan 2026 03:19:29 +0000 Subject: [PATCH 06/76] chore: fix Rust version for algo tests --- .github/workflows/checks.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 736b3542..873d8f3c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -77,6 +77,8 @@ jobs: run: rustowl check ./perf-tests/dummy-package - name: Test algorithm consistency + # it can be different between other Rust versions + if: env.TOOLCHAIN_CHANNEL == "1.93.0" run: ./scripts/algorithm.sh vscode: From 73c90f135c6fcfd6f92cf98a9cf1d4f7e5c8c1c8 Mon Sep 17 00:00:00 2001 From: CHISEN Kaoru Date: Tue, 27 Jan 2026 03:23:45 +0000 Subject: [PATCH 07/76] chore: fix test if --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 873d8f3c..b4295f99 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -78,7 +78,7 @@ jobs: - name: Test algorithm consistency # it can be different between other Rust versions - if: env.TOOLCHAIN_CHANNEL == "1.93.0" + if: ${{ env.TOOLCHAIN_CHANNEL == '1.93.0' }} run: ./scripts/algorithm.sh vscode: From e3dc272190f91d00a44ba3554e88f9f103006633 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Thu, 29 Jan 2026 23:51:44 +0600 Subject: [PATCH 08/76] chore: use insta and rust --- .github/workflows/checks.yml | 5 -- Cargo.lock | 46 ++++++++++++ Cargo.toml | 1 + algo-tests/src/lib.rs | 1 + algo-tests/src/main.rs | 5 -- scripts/algorithm.sh | 18 ----- tests/algorithm.rs | 72 +++++++++++++++++++ .../snapshots/algorithm__f1_v1.snap | 4 ++ .../snapshots/algorithm__f1_v2.snap | 4 ++ .../snapshots/algorithm__f2_v1.snap | 4 ++ .../snapshots/algorithm__f2_v2.snap | 4 ++ .../snapshots/algorithm__f3_v1.snap | 4 ++ .../snapshots/algorithm__f3_v2.snap | 4 ++ 13 files changed, 144 insertions(+), 28 deletions(-) create mode 100644 algo-tests/src/lib.rs delete mode 100644 algo-tests/src/main.rs delete mode 100755 scripts/algorithm.sh create mode 100644 tests/algorithm.rs rename algo-tests/f1_v1.txt => tests/snapshots/algorithm__f1_v1.snap (96%) rename algo-tests/f1_v2.txt => tests/snapshots/algorithm__f1_v2.snap (95%) rename algo-tests/f2_v1.txt => tests/snapshots/algorithm__f2_v1.snap (96%) rename algo-tests/f2_v2.txt => tests/snapshots/algorithm__f2_v2.snap (95%) rename algo-tests/f3_v1.txt => tests/snapshots/algorithm__f3_v1.snap (96%) rename algo-tests/f3_v2.txt => tests/snapshots/algorithm__f3_v2.snap (95%) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index b4295f99..6769c297 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -76,11 +76,6 @@ jobs: - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package - - name: Test algorithm consistency - # it can be different between other Rust versions - if: ${{ env.TOOLCHAIN_CHANNEL == '1.93.0' }} - run: ./scripts/algorithm.sh - vscode: name: VS Code Extension Checks runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index 59872a98..2031ca30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -384,6 +384,18 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "console" +version = "0.15.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +dependencies = [ + "encode_unicode", + "libc", + "once_cell", + "windows-sys 0.59.0", +] + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -587,6 +599,12 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +[[package]] +name = "encode_unicode" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" + [[package]] name = "equivalent" version = "1.0.2" @@ -1058,6 +1076,18 @@ dependencies = [ "generic-array", ] +[[package]] +name = "insta" +version = "1.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "248b42847813a1550dafd15296fd9748c651d0c32194559dbc05d804d54b21e8" +dependencies = [ + "console", + "once_cell", + "similar", + "tempfile", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -1630,6 +1660,7 @@ dependencies = [ "clap_mangen", "criterion", "flate2", + "insta", "log", "num_cpus", "process_alive", @@ -1834,6 +1865,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" +[[package]] +name = "similar" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa" + [[package]] name = "simple_logger" version = "5.1.0" @@ -2528,6 +2565,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.60.2" diff --git a/Cargo.toml b/Cargo.toml index 1e36a76c..5f0cdd19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,6 +74,7 @@ tree-sitter-rust = "0.24" [dev-dependencies] criterion = { version = "0.8", features = ["html_reports"] } +insta = "1.46" [build-dependencies] clap = { version = "4", features = ["derive"] } diff --git a/algo-tests/src/lib.rs b/algo-tests/src/lib.rs new file mode 100644 index 00000000..e06c662e --- /dev/null +++ b/algo-tests/src/lib.rs @@ -0,0 +1 @@ +mod vec; diff --git a/algo-tests/src/main.rs b/algo-tests/src/main.rs deleted file mode 100644 index ecaab2d2..00000000 --- a/algo-tests/src/main.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod vec; - -fn main() { - println!("Hello, world!"); -} diff --git a/scripts/algorithm.sh b/scripts/algorithm.sh deleted file mode 100755 index 6fc827af..00000000 --- a/scripts/algorithm.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -cd "$(dirname $0)" -cd ../algo-tests - -for i in {1..3} -do - for j in {1..2} - do - echo "Check f${i} v${j}" - RESULT="$(rustowl show f${i} v${j} 2> /dev/null)" - ASSERT="$(cat f${i}_v${j}.txt)" - if [ "$RESULT" != "$ASSERT" ]; then - diff -u <(echo "$RESULT") <(echo "$ASSERT") - exit 1 - fi - done -done diff --git a/tests/algorithm.rs b/tests/algorithm.rs new file mode 100644 index 00000000..bdc97c3f --- /dev/null +++ b/tests/algorithm.rs @@ -0,0 +1,72 @@ +use std::process::Command; +use std::sync::Once; + +static BUILD_ONCE: Once = Once::new(); + +fn ensure_rustowl_built() { + BUILD_ONCE.call_once(|| { + let status = Command::new("cargo") + .args(["build"]) + .status() + .expect("Failed to build rustowl"); + assert!(status.success(), "Failed to build rustowl"); + }); +} + +fn get_rustowl_output(function_path: &str, variable: &str) -> String { + ensure_rustowl_built(); + + let output = Command::new("cargo") + .args([ + "run", + "--bin", + "rustowl", + "--", + "show", + "--path", + "algo-tests/src/vec.rs", + function_path, + variable, + ]) + .output() + .expect("Failed to run rustowl"); + + assert!(output.status.success(), "rustowl command failed"); + String::from_utf8(output.stdout).expect("Invalid UTF-8") +} + +#[test] +fn test_f1_v1() { + let output = get_rustowl_output("vec::f1", "v1"); + insta::assert_snapshot!(output); +} + +#[test] +fn test_f1_v2() { + let output = get_rustowl_output("vec::f1", "v2"); + insta::assert_snapshot!(output); +} + +#[test] +fn test_f2_v1() { + let output = get_rustowl_output("vec::f2", "v1"); + insta::assert_snapshot!(output); +} + +#[test] +fn test_f2_v2() { + let output = get_rustowl_output("vec::f2", "v2"); + insta::assert_snapshot!(output); +} + +#[test] +fn test_f3_v1() { + let output = get_rustowl_output("vec::f3", "v1"); + insta::assert_snapshot!(output); +} + +#[test] +fn test_f3_v2() { + let output = get_rustowl_output("vec::f3", "v2"); + insta::assert_snapshot!(output); +} diff --git a/algo-tests/f1_v1.txt b/tests/snapshots/algorithm__f1_v1.snap similarity index 96% rename from algo-tests/f1_v1.txt rename to tests/snapshots/algorithm__f1_v1.snap index 68457e8e..6b6c1dd4 100644 --- a/algo-tests/f1_v1.txt +++ b/tests/snapshots/algorithm__f1_v1.snap @@ -1,3 +1,7 @@ +--- +source: tests/algorithm.rs +expression: output +--- === Variable 'v1' (1/1) in function 'vec::f1' === diff --git a/algo-tests/f1_v2.txt b/tests/snapshots/algorithm__f1_v2.snap similarity index 95% rename from algo-tests/f1_v2.txt rename to tests/snapshots/algorithm__f1_v2.snap index bdae3cf4..9dd23344 100644 --- a/algo-tests/f1_v2.txt +++ b/tests/snapshots/algorithm__f1_v2.snap @@ -1,3 +1,7 @@ +--- +source: tests/algorithm.rs +expression: output +--- === Variable 'v2' (1/1) in function 'vec::f1' === diff --git a/algo-tests/f2_v1.txt b/tests/snapshots/algorithm__f2_v1.snap similarity index 96% rename from algo-tests/f2_v1.txt rename to tests/snapshots/algorithm__f2_v1.snap index b892f9d5..388f3434 100644 --- a/algo-tests/f2_v1.txt +++ b/tests/snapshots/algorithm__f2_v1.snap @@ -1,3 +1,7 @@ +--- +source: tests/algorithm.rs +expression: output +--- === Variable 'v1' (1/1) in function 'vec::f2' === diff --git a/algo-tests/f2_v2.txt b/tests/snapshots/algorithm__f2_v2.snap similarity index 95% rename from algo-tests/f2_v2.txt rename to tests/snapshots/algorithm__f2_v2.snap index 98b5d618..74d9ed5c 100644 --- a/algo-tests/f2_v2.txt +++ b/tests/snapshots/algorithm__f2_v2.snap @@ -1,3 +1,7 @@ +--- +source: tests/algorithm.rs +expression: output +--- === Variable 'v2' (1/1) in function 'vec::f2' === diff --git a/algo-tests/f3_v1.txt b/tests/snapshots/algorithm__f3_v1.snap similarity index 96% rename from algo-tests/f3_v1.txt rename to tests/snapshots/algorithm__f3_v1.snap index 47c875ea..1e691e9b 100644 --- a/algo-tests/f3_v1.txt +++ b/tests/snapshots/algorithm__f3_v1.snap @@ -1,3 +1,7 @@ +--- +source: tests/algorithm.rs +expression: output +--- === Variable 'v1' (1/1) in function 'vec::f3' === diff --git a/algo-tests/f3_v2.txt b/tests/snapshots/algorithm__f3_v2.snap similarity index 95% rename from algo-tests/f3_v2.txt rename to tests/snapshots/algorithm__f3_v2.snap index aefd515f..14fc6662 100644 --- a/algo-tests/f3_v2.txt +++ b/tests/snapshots/algorithm__f3_v2.snap @@ -1,3 +1,7 @@ +--- +source: tests/algorithm.rs +expression: output +--- === Variable 'v2' (1/1) in function 'vec::f3' === From 98c364214b6665fda4cde873d758370d52837cd7 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Fri, 30 Jan 2026 14:26:37 +0600 Subject: [PATCH 09/76] chore: add nextest rin --- .github/workflows/checks.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index bc8f18b4..0d580f29 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -92,6 +92,12 @@ jobs: with: save-if: ${{ github.ref == 'refs/heads/main' }} + - name: Install nextest + uses: taiki-e/install-action@cargo-nextest + + - name: Run tests + run: cargo nextest run --no-fail-fast + - name: Build release run: ./scripts/build/toolchain cargo build --release From e6d783261db0937c6f97ada38274e0295cba67f6 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Fri, 30 Jan 2026 22:18:26 +0600 Subject: [PATCH 10/76] chore: fixes --- .github/workflows/checks.yml | 6 +++--- tests/algorithm.rs | 34 +++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 0d580f29..63dbfddd 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -95,12 +95,12 @@ jobs: - name: Install nextest uses: taiki-e/install-action@cargo-nextest - - name: Run tests - run: cargo nextest run --no-fail-fast - - name: Build release run: ./scripts/build/toolchain cargo build --release + - name: Run tests + run: ./scripts/build/toolchain cargo nextest run --no-fail-fast + - name: Install binary run: ./scripts/build/toolchain cargo install --path . diff --git a/tests/algorithm.rs b/tests/algorithm.rs index bdc97c3f..02f12be0 100644 --- a/tests/algorithm.rs +++ b/tests/algorithm.rs @@ -6,7 +6,7 @@ static BUILD_ONCE: Once = Once::new(); fn ensure_rustowl_built() { BUILD_ONCE.call_once(|| { let status = Command::new("cargo") - .args(["build"]) + .args(["build", "--release"]) .status() .expect("Failed to build rustowl"); assert!(status.success(), "Failed to build rustowl"); @@ -16,20 +16,24 @@ fn ensure_rustowl_built() { fn get_rustowl_output(function_path: &str, variable: &str) -> String { ensure_rustowl_built(); - let output = Command::new("cargo") - .args([ - "run", - "--bin", - "rustowl", - "--", - "show", - "--path", - "algo-tests/src/vec.rs", - function_path, - variable, - ]) - .output() - .expect("Failed to run rustowl"); + let output = Command::new(&format!( + "target{}release{}rustowl", + std::path::MAIN_SEPARATOR, + std::path::MAIN_SEPARATOR + )) + .args([ + "show", + "--path", + &format!( + "algo-tests{}src{}vec.rs", + std::path::MAIN_SEPARATOR, + std::path::MAIN_SEPARATOR + ), + function_path, + variable, + ]) + .output() + .expect("Failed to run rustowl"); assert!(output.status.success(), "rustowl command failed"); String::from_utf8(output.stdout).expect("Invalid UTF-8") From 7698afc145da67266091f9c837f951dab6792519 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Fri, 30 Jan 2026 22:23:16 +0600 Subject: [PATCH 11/76] chore: fixes --- .github/workflows/checks.yml | 9 ++++++++- tests/algorithm.rs | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 63dbfddd..dbba62e6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -75,12 +75,19 @@ jobs: test: name: Build & Test - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} needs: - define-matrix strategy: matrix: toolchain: ${{ fromJSON(needs.define-matrix.outputs.toolchains) }} + os: + - windows-latest + - windows-11-arm + - macos-15-intel + - macos-latest + - ubuntu-latest + - ubuntu-24.04-arm env: TOOLCHAIN_CHANNEL: ${{ matrix.toolchain }} steps: diff --git a/tests/algorithm.rs b/tests/algorithm.rs index 02f12be0..d936e894 100644 --- a/tests/algorithm.rs +++ b/tests/algorithm.rs @@ -16,7 +16,7 @@ fn ensure_rustowl_built() { fn get_rustowl_output(function_path: &str, variable: &str) -> String { ensure_rustowl_built(); - let output = Command::new(&format!( + let output = Command::new(format!( "target{}release{}rustowl", std::path::MAIN_SEPARATOR, std::path::MAIN_SEPARATOR @@ -24,7 +24,7 @@ fn get_rustowl_output(function_path: &str, variable: &str) -> String { .args([ "show", "--path", - &format!( + format!( "algo-tests{}src{}vec.rs", std::path::MAIN_SEPARATOR, std::path::MAIN_SEPARATOR From 787c268b1d53505040fb2dfae834f673dd18a957 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 31 Jan 2026 06:58:04 +0600 Subject: [PATCH 12/76] Update algorithm.rs --- tests/algorithm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/algorithm.rs b/tests/algorithm.rs index d936e894..579d3d49 100644 --- a/tests/algorithm.rs +++ b/tests/algorithm.rs @@ -24,7 +24,7 @@ fn get_rustowl_output(function_path: &str, variable: &str) -> String { .args([ "show", "--path", - format!( + &format!( "algo-tests{}src{}vec.rs", std::path::MAIN_SEPARATOR, std::path::MAIN_SEPARATOR From 39c8de3fe34c1b1e32b0d2adfb6c053b8acbd3c9 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 31 Jan 2026 07:15:31 +0600 Subject: [PATCH 13/76] Update checks.yml --- .github/workflows/checks.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index dbba62e6..11c6c5b1 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -111,6 +111,12 @@ jobs: - name: Install binary run: ./scripts/build/toolchain cargo install --path . + - name: Add cargo bin to PATH (Windows) + shell: pwsh + if: startsWith(matrix.os, 'windows') + run: | + echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package From f641d1a30623c83ef64ce1d4c8a1d91a70b62958 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 31 Jan 2026 07:43:23 +0600 Subject: [PATCH 14/76] Update checks.yml --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 11c6c5b1..3c19a59f 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -115,7 +115,7 @@ jobs: shell: pwsh if: startsWith(matrix.os, 'windows') run: | - echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package From 9065ce1c437ad47f2303fb2e5c15175e4f6e0581 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 31 Jan 2026 08:16:23 +0600 Subject: [PATCH 15/76] Update checks.yml --- .github/workflows/checks.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3c19a59f..3240f8e8 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -78,6 +78,8 @@ jobs: runs-on: ${{ matrix.os }} needs: - define-matrix + defaults: + shell: bash strategy: matrix: toolchain: ${{ fromJSON(needs.define-matrix.outputs.toolchains) }} @@ -111,12 +113,6 @@ jobs: - name: Install binary run: ./scripts/build/toolchain cargo install --path . - - name: Add cargo bin to PATH (Windows) - shell: pwsh - if: startsWith(matrix.os, 'windows') - run: | - echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package From 09fbced8922b3c40fd3571f9e86ea244d9f3193b Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 31 Jan 2026 08:18:37 +0600 Subject: [PATCH 16/76] Update checks.yml --- .github/workflows/checks.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 3240f8e8..5105e85b 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -79,7 +79,8 @@ jobs: needs: - define-matrix defaults: - shell: bash + run: + shell: bash strategy: matrix: toolchain: ${{ fromJSON(needs.define-matrix.outputs.toolchains) }} From a2f1ad66c1ace28e4d4b7be1d02ee1d40c56e0ad Mon Sep 17 00:00:00 2001 From: CHISEN Kaoru Date: Mon, 2 Feb 2026 06:02:58 +0000 Subject: [PATCH 17/76] chore: pin test toolchain version --- .github/workflows/checks.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 5105e85b..230fcdb4 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -109,6 +109,9 @@ jobs: run: ./scripts/build/toolchain cargo build --release - name: Run tests + # MIR is still unstable, so this test can fail in other version of Rust. + # Update thi manually. + if: ${{ matrix.toolchain == '1.93.0' }} run: ./scripts/build/toolchain cargo nextest run --no-fail-fast - name: Install binary From 45665f64416b2f6a327ff6ca52303eefb75f60f7 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Mon, 2 Feb 2026 16:22:40 +0600 Subject: [PATCH 18/76] Update checks.yml --- .github/workflows/checks.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 230fcdb4..68811740 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -105,13 +105,21 @@ jobs: - name: Install nextest uses: taiki-e/install-action@cargo-nextest + # Using lto causes build failure in Windows + - name: Set build profile + run: | + if [[ "${{ matrix.os }}" == windows* ]]; then + echo "build_profile=windows-release" >> $GITHUB_ENV + else + echo "build_profile=release" >> $GITHUB_ENV + fi + - name: Build release - run: ./scripts/build/toolchain cargo build --release + run: ./scripts/build/toolchain cargo build --release --profile=${{ env.build_profile }} - name: Run tests - # MIR is still unstable, so this test can fail in other version of Rust. - # Update thi manually. - if: ${{ matrix.toolchain == '1.93.0' }} + # MIR is still unstable, so this test can fail in other versions of Rust. + if: matrix.toolchain == needs.define-matrix.outputs.latest run: ./scripts/build/toolchain cargo nextest run --no-fail-fast - name: Install binary From b361d8b061d17ac32c421e138986c9ec290118b8 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Mon, 2 Feb 2026 16:24:58 +0600 Subject: [PATCH 19/76] Update checks.yml --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 68811740..936ee52e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -115,7 +115,7 @@ jobs: fi - name: Build release - run: ./scripts/build/toolchain cargo build --release --profile=${{ env.build_profile }} + run: ./scripts/build/toolchain cargo build --profile=${{ env.build_profile }} - name: Run tests # MIR is still unstable, so this test can fail in other versions of Rust. From 9483f619fd163bb91710fbec238a29d12854f1f7 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Mon, 2 Feb 2026 18:05:33 +0600 Subject: [PATCH 20/76] Update checks.yml --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 936ee52e..81cfbe6c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -123,7 +123,7 @@ jobs: run: ./scripts/build/toolchain cargo nextest run --no-fail-fast - name: Install binary - run: ./scripts/build/toolchain cargo install --path . + run: ./scripts/build/toolchain cargo install --path . --profile=${{ env.build_profile }} - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package From bd131ae7b1f8c6735cac4172802e5c84699db299 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 16:45:08 +0600 Subject: [PATCH 21/76] Update print-env.sh --- scripts/build/print-env.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index c5702458..df00e618 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -62,6 +62,19 @@ print_env() { echo "SYSROOT=$sysroot" echo "PATH=$sysroot/bin:$PATH" echo "RUSTC_BOOTSTRAP=rustowlc" + + # Lto fix... + case "$(host_tuple)" in + *-pc-windows-msvc) + echo "CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" + echo "RUSTFLAGS=-Clinker=lld-link" + echo "CC=clang-cl" + echo "CXX=clang-cl" + echo "CFLAGS=/clang:-flto=fat /clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-flto=fat /clang:-fuse-ld=lld-link" + echo "AR=llvm-lib" + ;; + esac } print_env From 9c92c48817d20b7d5754bc9b7ea25a749b2c8f8b Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 16:45:50 +0600 Subject: [PATCH 22/76] Update Cargo.toml --- Cargo.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d9fe9212..3de79a29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -97,7 +97,3 @@ debug = true strip = "none" debug-assertions = true overflow-checks = true - -[profile.windows-release] -inherits = "release" -lto = "off" From 0569c8f1464e6591670a9ad0709785e16064bc85 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 16:47:46 +0600 Subject: [PATCH 23/76] Update build.yml --- .github/workflows/build.yml | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03b59361..94757922 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,15 +38,6 @@ jobs: - name: Checkout uses: actions/checkout@v6 - # Using fat LTO causes failure to link on Windows - - name: Set build profile - run: | - if [[ "${{ matrix.os }}" == windows* ]]; then - echo "build_profile=windows-release" >> $GITHUB_ENV - else - echo "build_profile=release" >> $GITHUB_ENV - fi - # uname on Windows on ARM returns "x86_64" - name: Set ARCH flag for Windows on ARM if: matrix.os == 'windows-11-arm' @@ -73,14 +64,14 @@ jobs: run: | if [[ "${{ env.is_linux }}" == "true" ]]; then ./scripts/build/toolchain cargo install --locked cargo-zigbuild - ./scripts/build/toolchain cargo zigbuild --target ${{ env.host_tuple }}.2.17 --profile=${{ env.build_profile }} + ./scripts/build/toolchain cargo zigbuild --target ${{ env.host_tuple }}.2.17 --release else - ./scripts/build/toolchain cargo build --target ${{ env.host_tuple }} --profile=${{ env.build_profile }} + ./scripts/build/toolchain cargo build --target ${{ env.host_tuple }} --release fi - name: Check the functionality run: | - ./target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowl${{ env.exec_ext }} check ./perf-tests/dummy-package + ./target/${{ env.host_tuple }}/release/rustowl${{ env.exec_ext }} check ./perf-tests/dummy-package - name: Set archive name run: | @@ -94,8 +85,8 @@ jobs: run: | rm -rf rustowl && mkdir -p rustowl/sysroot/${{ env.toolchain }}/bin - cp target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowl${{ env.exec_ext }} ./rustowl/ - cp target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowlc${{ env.exec_ext }} ./rustowl/sysroot/${{ env.toolchain }}/bin + cp target/${{ env.host_tuple }}/release/rustowl${{ env.exec_ext }} ./rustowl/ + cp target/${{ env.host_tuple }}/release/rustowlc${{ env.exec_ext }} ./rustowl/sysroot/${{ env.toolchain }}/bin cp README.md ./rustowl cp LICENSE ./rustowl From d9d0d70d3fd5c04459496c88911dd9cf2262ed85 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 16:48:19 +0600 Subject: [PATCH 24/76] Update checks.yml --- .github/workflows/checks.yml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 81cfbe6c..6522f7ea 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -105,17 +105,8 @@ jobs: - name: Install nextest uses: taiki-e/install-action@cargo-nextest - # Using lto causes build failure in Windows - - name: Set build profile - run: | - if [[ "${{ matrix.os }}" == windows* ]]; then - echo "build_profile=windows-release" >> $GITHUB_ENV - else - echo "build_profile=release" >> $GITHUB_ENV - fi - - name: Build release - run: ./scripts/build/toolchain cargo build --profile=${{ env.build_profile }} + run: ./scripts/build/toolchain cargo build --release - name: Run tests # MIR is still unstable, so this test can fail in other versions of Rust. From 31451118dd91198c66fba7599d8701140fc3effc Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 17:10:50 +0600 Subject: [PATCH 25/76] Update checks.yml --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6522f7ea..d36d6a7c 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -114,7 +114,7 @@ jobs: run: ./scripts/build/toolchain cargo nextest run --no-fail-fast - name: Install binary - run: ./scripts/build/toolchain cargo install --path . --profile=${{ env.build_profile }} + run: ./scripts/build/toolchain cargo install --path . - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package From e2f6f7375966575eab65150d22b008b83680633f Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:11:26 +0600 Subject: [PATCH 26/76] Update print-env.sh --- scripts/build/print-env.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index df00e618..1fa6e7d7 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -63,15 +63,16 @@ print_env() { echo "PATH=$sysroot/bin:$PATH" echo "RUSTC_BOOTSTRAP=rustowlc" - # Lto fix... + # C/C++ lto with Windows lto fix + # TODO: add C/C++ lto to targets other then windows case "$(host_tuple)" in *-pc-windows-msvc) echo "CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-flto=fat /clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-flto=fat /clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-flto=full /clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-flto=full /clang:-fuse-ld=lld-link" echo "AR=llvm-lib" ;; esac From 9cc872a7ccf7ea4faa8f380bf09d56d251b428ff Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:17:51 +0600 Subject: [PATCH 27/76] Update print-env.sh --- scripts/build/print-env.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 1fa6e7d7..15218667 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -12,7 +12,7 @@ fi host_tuple() { if [ -z "$TOOLCHAIN_OS" ]; then # Get OS - case "$(uname -s)" in + uname -s)" in Linux) TOOLCHAIN_OS="unknown-linux-gnu" ;; @@ -63,19 +63,22 @@ print_env() { echo "PATH=$sysroot/bin:$PATH" echo "RUSTC_BOOTSTRAP=rustowlc" - # C/C++ lto with Windows lto fix - # TODO: add C/C++ lto to targets other then windows + # LTO for C/C++ + echo "CFLAGS=-flto=fat" + echo "CXXFLAGS=-flto=fat" + + # Fix for Windows LTO + LTO for C/C++ case "$(host_tuple)" in *-pc-windows-msvc) echo "CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-flto=full /clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-flto=full /clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-flto=fat /clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-flto=fat /clang:-fuse-ld=lld-link" echo "AR=llvm-lib" ;; esac } -print_env +print_env \ No newline at end of file From aab746b3c0760ca1616aaea4473e01f19473d9bc Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:18:25 +0600 Subject: [PATCH 28/76] Update print-env.sh --- scripts/build/print-env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 15218667..88e12c7d 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -11,8 +11,8 @@ fi # print host-tuple host_tuple() { if [ -z "$TOOLCHAIN_OS" ]; then - # Get OS - uname -s)" in + # Get OS + case uname -s)" in Linux) TOOLCHAIN_OS="unknown-linux-gnu" ;; From 3ff77a1119bc315287abf4d5ae5f5ff6c86506e6 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:18:46 +0600 Subject: [PATCH 29/76] Update print-env.sh --- scripts/build/print-env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 88e12c7d..9993c354 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -11,8 +11,8 @@ fi # print host-tuple host_tuple() { if [ -z "$TOOLCHAIN_OS" ]; then - # Get OS - case uname -s)" in + # Get OS + case uname -s)" in Linux) TOOLCHAIN_OS="unknown-linux-gnu" ;; From ce7d1e1eff52bc7ef5c4f0ba9868fe600dab012b Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:19:07 +0600 Subject: [PATCH 30/76] Update print-env.sh --- scripts/build/print-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 9993c354..8fbc34a0 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -12,7 +12,7 @@ fi host_tuple() { if [ -z "$TOOLCHAIN_OS" ]; then # Get OS - case uname -s)" in + case "$(uname -s)" in Linux) TOOLCHAIN_OS="unknown-linux-gnu" ;; From e7547a539da5f96be703d0f3c853480fc05ffb2b Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:20:09 +0600 Subject: [PATCH 31/76] Update print-env.sh --- scripts/build/print-env.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 8fbc34a0..5044313b 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -71,6 +71,7 @@ print_env() { case "$(host_tuple)" in *-pc-windows-msvc) echo "CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" + echo "CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" From fe232c808a7ea4e65c8bc398c64199dfd1327fb9 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:28:35 +0600 Subject: [PATCH 32/76] Update print-env.sh --- scripts/build/print-env.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 5044313b..d6feae89 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -64,8 +64,8 @@ print_env() { echo "RUSTC_BOOTSTRAP=rustowlc" # LTO for C/C++ - echo "CFLAGS=-flto=fat" - echo "CXXFLAGS=-flto=fat" + echo "CFLAGS=-flto=full" + echo "CXXFLAGS=-flto=full" # Fix for Windows LTO + LTO for C/C++ case "$(host_tuple)" in @@ -75,8 +75,8 @@ print_env() { echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-flto=fat /clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-flto=fat /clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-flto=full /clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-flto=full /clang:-fuse-ld=lld-link" echo "AR=llvm-lib" ;; esac From 093f47de056d0d8042f88c9a435492af34f3c253 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:29:03 +0600 Subject: [PATCH 33/76] Update print-env.sh --- scripts/build/print-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index d6feae89..9134ace0 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -82,4 +82,4 @@ print_env() { esac } -print_env \ No newline at end of file +print_env From 137a53c6c4e78eb5f4377093ef3eacb2e8dfa7ad Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:33:37 +0600 Subject: [PATCH 34/76] Update print-env.sh --- scripts/build/print-env.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 9134ace0..880ab65d 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -64,8 +64,8 @@ print_env() { echo "RUSTC_BOOTSTRAP=rustowlc" # LTO for C/C++ - echo "CFLAGS=-flto=full" - echo "CXXFLAGS=-flto=full" + echo "CFLAGS=-flto" + echo "CXXFLAGS=-flto" # Fix for Windows LTO + LTO for C/C++ case "$(host_tuple)" in @@ -75,8 +75,8 @@ print_env() { echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-flto=full /clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-flto=full /clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-flto /clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-flto /clang:-fuse-ld=lld-link" echo "AR=llvm-lib" ;; esac From 508d489c98a98b936188401434a8aaabf76245eb Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 20:59:33 +0600 Subject: [PATCH 35/76] Update Cargo.toml --- Cargo.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3de79a29..7ba07732 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,9 +73,8 @@ clap_complete_nushell = "4" clap_mangen = "0.2" regex = "1" -[target.'cfg(not(target_env = "msvc"))'.dependencies] -tikv-jemalloc-sys = "0.6" -tikv-jemallocator = "0.6" +[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies] +tikv-jemalloc-sys = { version = "0.6", features = ["override_allocator_on_supported_platforms"] } [target.'cfg(target_os = "windows")'.dependencies] zip = "7.2.0" From 43336118f5116bbb16c04d3ef25f4a945b67c9b7 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 21:00:56 +0600 Subject: [PATCH 36/76] Update rustowl.rs --- src/bin/rustowl.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/bin/rustowl.rs b/src/bin/rustowl.rs index 39220cc3..35a8e708 100644 --- a/src/bin/rustowl.rs +++ b/src/bin/rustowl.rs @@ -11,13 +11,8 @@ use tower_lsp::{LspService, Server}; use crate::cli::{Cli, Commands, ToolchainCommands}; -#[cfg(all(not(target_env = "msvc"), not(miri)))] -use tikv_jemallocator::Jemalloc; - -// Use jemalloc by default, but fall back to system allocator for Miri -#[cfg(all(not(target_env = "msvc"), not(miri)))] -#[global_allocator] -static GLOBAL: Jemalloc = Jemalloc; +#[cfg(all(any(target_os = "linux", targey_os = "macos"), not(miri)))] +extern crate tikv_jemalloc_sys as _; fn set_log_level(default: log::LevelFilter) { log::set_max_level( From 62510f6d895bb3db7750d0dd91a948793412e780 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 21:02:24 +0600 Subject: [PATCH 37/76] Update rustowlc.rs --- src/bin/rustowlc.rs | 36 +++--------------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/src/bin/rustowlc.rs b/src/bin/rustowlc.rs index 5f6b8f5d..76bc2d54 100644 --- a/src/bin/rustowlc.rs +++ b/src/bin/rustowlc.rs @@ -26,40 +26,10 @@ pub mod core; use std::process::exit; -fn main() { - // This is cited from [rustc](https://github.com/rust-lang/rust/blob/3014e79f9c8d5510ea7b3a3b70d171d0948b1e96/compiler/rustc/src/main.rs). - // MIT License - #[cfg(not(target_env = "msvc"))] - { - use std::os::raw::{c_int, c_void}; - - use tikv_jemalloc_sys as jemalloc_sys; - - #[used] - static _F1: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::calloc; - #[used] - static _F2: unsafe extern "C" fn(*mut *mut c_void, usize, usize) -> c_int = - jemalloc_sys::posix_memalign; - #[used] - static _F3: unsafe extern "C" fn(usize, usize) -> *mut c_void = jemalloc_sys::aligned_alloc; - #[used] - static _F4: unsafe extern "C" fn(usize) -> *mut c_void = jemalloc_sys::malloc; - #[used] - static _F5: unsafe extern "C" fn(*mut c_void, usize) -> *mut c_void = jemalloc_sys::realloc; - #[used] - static _F6: unsafe extern "C" fn(*mut c_void) = jemalloc_sys::free; - - #[cfg(target_os = "macos")] - { - unsafe extern "C" { - fn _rjem_je_zone_register(); - } - - #[used] - static _F7: unsafe extern "C" fn() = _rjem_je_zone_register; - } - } +#[cfg(any(target_os ="linux", target_os = "macos"))] +use tikv_jemalloc_sys as _; +fn main() { simple_logger::SimpleLogger::new() .env() .with_colors(true) From af71b9ec19fd1e5b96ae50d23a3af17a0f191ce1 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 21:02:48 +0600 Subject: [PATCH 38/76] Update rustowl.rs --- src/bin/rustowl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/rustowl.rs b/src/bin/rustowl.rs index 35a8e708..89208169 100644 --- a/src/bin/rustowl.rs +++ b/src/bin/rustowl.rs @@ -12,7 +12,7 @@ use tower_lsp::{LspService, Server}; use crate::cli::{Cli, Commands, ToolchainCommands}; #[cfg(all(any(target_os = "linux", targey_os = "macos"), not(miri)))] -extern crate tikv_jemalloc_sys as _; +use tikv_jemalloc_sys as _; fn set_log_level(default: log::LevelFilter) { log::set_max_level( From 73e57d414dcc5a748ee1a4cf34ee465743ccabf8 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 21:03:06 +0600 Subject: [PATCH 39/76] Update rustowl.rs --- src/bin/rustowl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/rustowl.rs b/src/bin/rustowl.rs index 89208169..017af886 100644 --- a/src/bin/rustowl.rs +++ b/src/bin/rustowl.rs @@ -11,7 +11,7 @@ use tower_lsp::{LspService, Server}; use crate::cli::{Cli, Commands, ToolchainCommands}; -#[cfg(all(any(target_os = "linux", targey_os = "macos"), not(miri)))] +#[cfg(all(any(target_os = "linux", target_os = "macos"), not(miri)))] use tikv_jemalloc_sys as _; fn set_log_level(default: log::LevelFilter) { From 47d0665034017d3cdf11898b1a1681c4f7c1e345 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 21:10:50 +0600 Subject: [PATCH 40/76] Update rustowlc.rs --- src/bin/rustowlc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/rustowlc.rs b/src/bin/rustowlc.rs index 76bc2d54..4ed345e9 100644 --- a/src/bin/rustowlc.rs +++ b/src/bin/rustowlc.rs @@ -26,7 +26,7 @@ pub mod core; use std::process::exit; -#[cfg(any(target_os ="linux", target_os = "macos"))] +#[cfg(any(target_os = "linux", target_os = "macos"))] use tikv_jemalloc_sys as _; fn main() { From 6093b95e25eab2e9a9dad4043e4eb6599395c9e9 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Tue, 3 Feb 2026 21:49:53 +0600 Subject: [PATCH 41/76] Update print-env.sh --- scripts/build/print-env.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 880ab65d..3a6a5f0e 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -63,9 +63,7 @@ print_env() { echo "PATH=$sysroot/bin:$PATH" echo "RUSTC_BOOTSTRAP=rustowlc" - # LTO for C/C++ - echo "CFLAGS=-flto" - echo "CXXFLAGS=-flto" + # TODO(MuntasirSZN): enable fat lto `-flto` option via CFLAGS and CXXFLAGS (fails now with symbols not found) This flag in Windows becomes /clang:-flto # Fix for Windows LTO + LTO for C/C++ case "$(host_tuple)" in @@ -75,8 +73,8 @@ print_env() { echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-flto /clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-flto /clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-fuse-ld=lld-link" echo "AR=llvm-lib" ;; esac From aedb4c625a7408b425b6ce99e720a20b60fbed61 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Tue, 3 Feb 2026 22:28:00 +0600 Subject: [PATCH 42/76] loclfile --- Cargo.lock | 92 ++++++++++++++++++++++++------------------------------ 1 file changed, 40 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 588de79d..9680c04e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -184,9 +184,9 @@ checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" [[package]] name = "bytes" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "bzip2" @@ -238,9 +238,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.54" +version = "1.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583" +checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" dependencies = [ "find-msvc-tools", "jobserver", @@ -305,9 +305,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.56" +version = "4.5.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75ca66430e33a14957acc24c5077b503e7d374151b2b4b3a10c83b4ceb4be0e" +checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a" dependencies = [ "clap_builder", "clap_derive", @@ -315,9 +315,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.56" +version = "4.5.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793207c7fa6300a0608d1080b858e5fdbe713cdc1c8db9fb17777d8a13e63df0" +checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238" dependencies = [ "anstream", "anstyle", @@ -671,15 +671,15 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "flate2" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", "miniz_oxide", @@ -957,14 +957,13 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ "base64", "bytes", "futures-channel", - "futures-core", "futures-util", "http", "http-body", @@ -1104,9 +1103,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.46.1" +version = "1.46.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248b42847813a1550dafd15296fd9748c651d0c32194559dbc05d804d54b21e8" +checksum = "e82db8c87c7f1ccecb34ce0c24399b8a73081427f3c7c50a5d597925356115e4" dependencies = [ "console", "once_cell", @@ -1647,9 +1646,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -1659,9 +1658,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -1670,9 +1669,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" [[package]] name = "reqwest" @@ -1851,7 +1850,6 @@ dependencies = [ "tar", "tempfile", "tikv-jemalloc-sys", - "tikv-jemallocator", "tokio", "tokio-util", "tower-lsp", @@ -2043,9 +2041,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" @@ -2120,9 +2118,9 @@ dependencies = [ [[package]] name = "system-configuration" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" dependencies = [ "bitflags 2.10.0", "core-foundation 0.9.4", @@ -2213,16 +2211,6 @@ dependencies = [ "libc", ] -[[package]] -name = "tikv-jemallocator" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0359b4327f954e0567e69fb191cf1436617748813819c94b8cd4a431422d053a" -dependencies = [ - "libc", - "tikv-jemalloc-sys", -] - [[package]] name = "time" version = "0.3.46" @@ -2468,9 +2456,9 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.26.3" +version = "0.26.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "974d205cc395652cfa8b37daa053fe56eebd429acf8dc055503fee648dae981e" +checksum = "12987371f54efc9b9306a20dc87ed5aaee9f320c8a8b115e28515c412b2efe39" dependencies = [ "cc", "regex", @@ -2482,9 +2470,9 @@ dependencies = [ [[package]] name = "tree-sitter-highlight" -version = "0.26.3" +version = "0.26.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0636662a03005d9289649e0b4a89ff37b75df5033e8d4a16398740ae6496d2" +checksum = "2b688407049ea1b55a7e872f138947d22389118b9c4d09b459cb34ca205e41c0" dependencies = [ "regex", "streaming-iterator", @@ -2494,9 +2482,9 @@ dependencies = [ [[package]] name = "tree-sitter-language" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae62f7eae5eb549c71b76658648b72cc6111f2d87d24a1e31fa907f4943e3ce" +checksum = "009994f150cc0cd50ff54917d5bc8bffe8cad10ca10d81c34da2ec421ae61782" [[package]] name = "tree-sitter-rust" @@ -3046,18 +3034,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.35" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdea86ddd5568519879b8187e1cf04e24fce28f7fe046ceecbce472ff19a2572" +checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.35" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c15e1b46eff7c6c91195752e0eeed8ef040e391cdece7c25376957d5f15df22" +checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0" dependencies = [ "proc-macro2", "quote", @@ -3168,15 +3156,15 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.5.5" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3" +checksum = "a7948af682ccbc3342b6e9420e8c51c1fe5d7bf7756002b4a3c6cabfe96a7e3c" [[package]] name = "zmij" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439" +checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445" [[package]] name = "zopfli" From dedd4db7a1552432b53a88661b7d0a742f24b1c4 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Wed, 4 Feb 2026 09:48:45 +0600 Subject: [PATCH 43/76] Update rustowlc.rs --- src/bin/rustowlc.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bin/rustowlc.rs b/src/bin/rustowlc.rs index 4ed345e9..f8b7d137 100644 --- a/src/bin/rustowlc.rs +++ b/src/bin/rustowlc.rs @@ -26,6 +26,9 @@ pub mod core; use std::process::exit; +// Cited from rustc +// https://github.com/rust-lang/rust/pull/148925 +// MIT License #[cfg(any(target_os = "linux", target_os = "macos"))] use tikv_jemalloc_sys as _; From 6f6cfde7a37b747f7867b546a065183b5d20ee40 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Wed, 4 Feb 2026 09:49:22 +0600 Subject: [PATCH 44/76] Update rustowl.rs --- src/bin/rustowl.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bin/rustowl.rs b/src/bin/rustowl.rs index 017af886..b9a6a167 100644 --- a/src/bin/rustowl.rs +++ b/src/bin/rustowl.rs @@ -11,6 +11,9 @@ use tower_lsp::{LspService, Server}; use crate::cli::{Cli, Commands, ToolchainCommands}; +// Cited from rustc +// https://github.com/rust-lang/rust/pull/148925 +// MIT License #[cfg(all(any(target_os = "linux", target_os = "macos"), not(miri)))] use tikv_jemalloc_sys as _; From 0f8e904d5d0584bfd71e11362b95a6c89c5a8a45 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Wed, 4 Feb 2026 17:46:17 +0600 Subject: [PATCH 45/76] last try with thin lto, that doesnt work, well no lto for windows --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7ba07732..7f00beda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ zip = "7.2.0" [profile.release] opt-level = 3 strip = "debuginfo" -lto = "fat" +lto = "thin" codegen-units = 1 [profile.release.package."*"] From f6b9fa19e14257d0eea433607542ef8bb29a41d7 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Wed, 4 Feb 2026 20:02:39 +0600 Subject: [PATCH 46/76] Update checks.yml --- .github/workflows/checks.yml | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d36d6a7c..80131203 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -21,7 +21,7 @@ jobs: - id: toolchains run: | TOOLCHAINS='["1.89.0", "1.90.0", "1.91.1", "1.92.0", "1.93.0"]' - echo "toolchains=$TOOLCHAINS" >> $GITHUB_OUTPUT + echo "toolchains=$TOOLCHAINS" >> "$GITHUB_OUTPUT" echo "latest=$(jq -r '.[-1]' <<< "$TOOLCHAINS")" >> "$GITHUB_OUTPUT" lint: @@ -46,7 +46,7 @@ jobs: uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ needs.define-matrix.outputs.latest }} - components: clippy,llvm-tools,rust-src,rustc-dev + components: clippy, llvm-tools, rust-src, rustc-dev - name: Cache dependencies uses: Swatinem/rust-cache@v2 @@ -78,9 +78,11 @@ jobs: runs-on: ${{ matrix.os }} needs: - define-matrix + defaults: - run: - shell: bash + run: + shell: bash + strategy: matrix: toolchain: ${{ fromJSON(needs.define-matrix.outputs.toolchains) }} @@ -91,12 +93,34 @@ jobs: - macos-latest - ubuntu-latest - ubuntu-24.04-arm + env: TOOLCHAIN_CHANNEL: ${{ matrix.toolchain }} + steps: - name: Checkout uses: actions/checkout@v6 + - name: Setup MSYS2 (Windows) + if: runner.os == 'Windows' + uses: msys2/setup-msys2@v2 + with: + update: true + msystem: ${{ runner.arch == 'ARM64' && 'CLANGARM64' || 'UCRT64' }} + install: > + clang + lld + nasm + + - name: Expose MSYS2 toolchain to PATH + if: runner.os == 'Windows' + run: | + if [[ "$RUNNER_ARCH" == "ARM64" ]]; then + echo "C:/msys64/clangarm64/bin" >> "$GITHUB_PATH" + else + echo "C:/msys64/ucrt64/bin" >> "$GITHUB_PATH" + fi + - name: Cache dependencies uses: Swatinem/rust-cache@v2 with: @@ -148,4 +172,4 @@ jobs: - name: Run tests run: xvfb-run -a pnpm run test - working-directory: ./vscode + working-directory: ./vscode \ No newline at end of file From 2af212bb043ca6b677a3fdbc41e3f1510414fe01 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Thu, 5 Feb 2026 07:04:50 +0600 Subject: [PATCH 47/76] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7f00beda..7ba07732 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,7 +82,7 @@ zip = "7.2.0" [profile.release] opt-level = 3 strip = "debuginfo" -lto = "thin" +lto = "fat" codegen-units = 1 [profile.release.package."*"] From f226b8e8a5f74cdbd50b8953ad20e41de92d4404 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Thu, 5 Feb 2026 07:08:01 +0600 Subject: [PATCH 48/76] Update print-env.sh --- scripts/build/print-env.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 3a6a5f0e..60594cec 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -63,18 +63,20 @@ print_env() { echo "PATH=$sysroot/bin:$PATH" echo "RUSTC_BOOTSTRAP=rustowlc" - # TODO(MuntasirSZN): enable fat lto `-flto` option via CFLAGS and CXXFLAGS (fails now with symbols not found) This flag in Windows becomes /clang:-flto + echo "CFLAGS=-flto" + echo "CXXFLAGS=-flto" + echo "RUSTFLAGS=-Clinker-plugin-lto -Clinker=clang -Clink-arg=-fuse-ld=lld" # Fix for Windows LTO + LTO for C/C++ case "$(host_tuple)" in *-pc-windows-msvc) echo "CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" echo "CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" - echo "RUSTFLAGS=-Clinker=lld-link" + echo "RUSTFLAGS=-Clinker-plugin-lto -Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-flto /clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-flto /clang:-fuse-ld=lld-link" echo "AR=llvm-lib" ;; esac From 552734699d92f775f6cf7f17625c3261f2392b02 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Thu, 5 Feb 2026 08:46:20 +0600 Subject: [PATCH 49/76] finale try 1 --- .cargo/config.toml | 2 ++ .github/workflows/checks.yml | 29 +++++++++-------------------- .github/workflows/security.yml | 9 +++++++++ 3 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..c26ad941 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +AWS_LC_SYS_PREBUILT_NASM = 1 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 80131203..972291c4 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -46,7 +46,7 @@ jobs: uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ needs.define-matrix.outputs.latest }} - components: clippy, llvm-tools, rust-src, rustc-dev + components: clippy,llvm-tools,rust-src,rustc-dev - name: Cache dependencies uses: Swatinem/rust-cache@v2 @@ -101,25 +101,14 @@ jobs: - name: Checkout uses: actions/checkout@v6 - - name: Setup MSYS2 (Windows) - if: runner.os == 'Windows' - uses: msys2/setup-msys2@v2 + - name: Get rust LLVM version + id: llvm-ver + run: echo "llvm_ver=$(rustc -vV | grep 'LLVM version' | cut -d ' ' -f 3)" >> "$GITHUB_ENV" + + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v2 with: - update: true - msystem: ${{ runner.arch == 'ARM64' && 'CLANGARM64' || 'UCRT64' }} - install: > - clang - lld - nasm - - - name: Expose MSYS2 toolchain to PATH - if: runner.os == 'Windows' - run: | - if [[ "$RUNNER_ARCH" == "ARM64" ]]; then - echo "C:/msys64/clangarm64/bin" >> "$GITHUB_PATH" - else - echo "C:/msys64/ucrt64/bin" >> "$GITHUB_PATH" - fi + version: ${{ env.llvm_ver }} - name: Cache dependencies uses: Swatinem/rust-cache@v2 @@ -172,4 +161,4 @@ jobs: - name: Run tests run: xvfb-run -a pnpm run test - working-directory: ./vscode \ No newline at end of file + working-directory: ./vscode diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index a9506aa7..427f0642 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -36,6 +36,15 @@ jobs: # Automatically reads from rust-toolchain.toml cache: false + - name: Get rust LLVM version + id: llvm-ver + run: echo "llvm_ver=$(rustc -vV | grep 'LLVM version' | cut -d ' ' -f 3)" >> "$GITHUB_ENV" + + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v2 + with: + version: ${{ env.llvm_ver }} + - name: Install system dependencies (Linux) if: matrix.runner_os == 'Linux' run: | From 9965e023ba021c237be0c5044b94597ccb21c84b Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Thu, 5 Feb 2026 10:17:32 +0600 Subject: [PATCH 50/76] Update config.toml --- .cargo/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index c26ad941..169d291b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,2 @@ [env] -AWS_LC_SYS_PREBUILT_NASM = 1 +AWS_LC_SYS_PREBUILT_NASM = "1" From 7a98011a99129d8d66b2228fea8207f2276b5233 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Thu, 5 Feb 2026 10:46:15 +0600 Subject: [PATCH 51/76] fix? --- .github/actions/setup-rust-llvm/action.yml | 86 ++++++++++++++++++++++ .github/workflows/checks.yml | 13 ++-- .github/workflows/security.yml | 9 +-- 3 files changed, 93 insertions(+), 15 deletions(-) create mode 100644 .github/actions/setup-rust-llvm/action.yml diff --git a/.github/actions/setup-rust-llvm/action.yml b/.github/actions/setup-rust-llvm/action.yml new file mode 100644 index 00000000..72cf1fe0 --- /dev/null +++ b/.github/actions/setup-rust-llvm/action.yml @@ -0,0 +1,86 @@ +name: setup-rust-llvm +description: > + Install LLVM/Clang matching Rust's LLVM version with controlled fallbacks. + Designed for cross-language LTO correctness. + +outputs: + llvm-version: + description: LLVM version selected + value: ${{ steps.export.outputs.llvm_version }} + +runs: + using: composite + steps: + - name: Detect Rust LLVM version + id: detect + shell: bash + run: | + set -euo pipefail + + LLVM_FULL=$(rustc -vV | sed -n 's/^LLVM version: //p') + LLVM_MAJOR=${LLVM_FULL%%.*} + LLVM_MINOR=$(echo "$LLVM_FULL" | cut -d. -f2) + + echo "LLVM_FULL=$LLVM_FULL" >> "$GITHUB_ENV" + echo "LLVM_MAJOR=$LLVM_MAJOR" >> "$GITHUB_ENV" + echo "LLVM_MINOR=$LLVM_MINOR" >> "$GITHUB_ENV" + + - name: Install exact LLVM match + id: llvm_exact + uses: KyleMayes/install-llvm-action@v2 + with: + version: ${{ env.LLVM_FULL }} + env: true + continue-on-error: true + + - name: Resolve LLVM minor fallback + id: resolve + if: steps.llvm_exact.outcome == 'failure' + shell: bash + run: | + set -euo pipefail + + TAGS=$(curl -fsSL https://api.github.com/repos/llvm/llvm-project/tags \ + | jq -r '.[].name' \ + | grep "^llvmorg-${LLVM_MAJOR}\.${LLVM_MINOR}\.") + + FALLBACK=$(echo "$TAGS" | sed 's/^llvmorg-//' | sort -V | tail -n1) + + if [[ -z "$FALLBACK" ]]; then + echo "::error::No LLVM fallback found for ${LLVM_MAJOR}.${LLVM_MINOR}" + exit 1 + fi + + echo "LLVM_FALLBACK=$FALLBACK" >> "$GITHUB_ENV" + + - name: Install LLVM fallback + if: steps.llvm_exact.outcome == 'failure' + uses: KyleMayes/install-llvm-action@v2 + with: + version: ${{ env.LLVM_FALLBACK }} + + - name: Verify LLVM compatibility + id: verify + shell: bash + run: | + set -euo pipefail + + RUST_LLVM=$(rustc -vV | sed -n 's/^LLVM version: //p') + CLANG_LLVM=$(clang --version | sed -n 's/.*LLVM version \([0-9.]*\).*/\1/p') + + echo "Rust LLVM : $RUST_LLVM" + echo "Clang LLVM : $CLANG_LLVM" + + if [[ "$RUST_LLVM" != "$CLANG_LLVM" ]]; then + echo "::warning::LLVM mismatch — cross-language LTO might not work!" + echo "LLVM_SELECTED=$CLANG_LLVM" >> "$GITHUB_ENV" + else + echo "LLVM_SELECTED=$RUST_LLVM" >> "$GITHUB_ENV" + fi + + - name: Export outputs + id: export + shell: bash + run: | + echo "llvm_version=${LLVM_SELECTED}" >> "$GITHUB_OUTPUT" + diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 972291c4..20bace3d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -101,14 +101,13 @@ jobs: - name: Checkout uses: actions/checkout@v6 - - name: Get rust LLVM version - id: llvm-ver - run: echo "llvm_ver=$(rustc -vV | grep 'LLVM version' | cut -d ' ' -f 3)" >> "$GITHUB_ENV" - - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master with: - version: ${{ env.llvm_ver }} + toolchain: ${{ matrix.toolchain }} + components: rust-src,rustc-dev,llvm-tools + - name: Install LLVM and Clang + uses: ./.github/actions/setup-rust-llvm - name: Cache dependencies uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 427f0642..8ede28dd 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -33,17 +33,10 @@ jobs: uses: actions-rust-lang/setup-rust-toolchain@v1 with: components: miri,rust-src,llvm-tools-preview,rustc-dev - # Automatically reads from rust-toolchain.toml cache: false - - name: Get rust LLVM version - id: llvm-ver - run: echo "llvm_ver=$(rustc -vV | grep 'LLVM version' | cut -d ' ' -f 3)" >> "$GITHUB_ENV" - - name: Install LLVM and Clang - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.llvm_ver }} + uses: ./.github/actions/setup-rust-llvm - name: Install system dependencies (Linux) if: matrix.runner_os == 'Linux' From 3f8ce78640cb09b5dffc20b5652272cd38a8e439 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Thu, 5 Feb 2026 11:34:15 +0600 Subject: [PATCH 52/76] trying --- .github/actions/setup-rust-llvm/action.yml | 96 +++++++++++++++------- .github/workflows/checks.yml | 10 ++- 2 files changed, 74 insertions(+), 32 deletions(-) diff --git a/.github/actions/setup-rust-llvm/action.yml b/.github/actions/setup-rust-llvm/action.yml index 72cf1fe0..c638864d 100644 --- a/.github/actions/setup-rust-llvm/action.yml +++ b/.github/actions/setup-rust-llvm/action.yml @@ -1,6 +1,6 @@ name: setup-rust-llvm description: > - Install LLVM/Clang matching Rust's LLVM version with controlled fallbacks. + Install LLVM/Clang matching Rust's LLVM version with forward-patch fallback. Designed for cross-language LTO correctness. outputs: @@ -11,6 +11,9 @@ outputs: runs: using: composite steps: + # ------------------------------------------------------------ + # Detect Rust LLVM version + # ------------------------------------------------------------ - name: Detect Rust LLVM version id: detect shell: bash @@ -18,49 +21,84 @@ runs: set -euo pipefail LLVM_FULL=$(rustc -vV | sed -n 's/^LLVM version: //p') - LLVM_MAJOR=${LLVM_FULL%%.*} + LLVM_MAJOR=$(echo "$LLVM_FULL" | cut -d. -f1) LLVM_MINOR=$(echo "$LLVM_FULL" | cut -d. -f2) + LLVM_PATCH=$(echo "$LLVM_FULL" | cut -d. -f3) - echo "LLVM_FULL=$LLVM_FULL" >> "$GITHUB_ENV" + echo "LLVM_FULL=$LLVM_FULL" >> "$GITHUB_ENV" echo "LLVM_MAJOR=$LLVM_MAJOR" >> "$GITHUB_ENV" echo "LLVM_MINOR=$LLVM_MINOR" >> "$GITHUB_ENV" + echo "LLVM_PATCH=$LLVM_PATCH" >> "$GITHUB_ENV" - - name: Install exact LLVM match - id: llvm_exact - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_FULL }} - env: true - continue-on-error: true - - - name: Resolve LLVM minor fallback - id: resolve - if: steps.llvm_exact.outcome == 'failure' + # ------------------------------------------------------------ + # Fetch all available patches for this major.minor + # ------------------------------------------------------------ + - name: Fetch LLVM patch candidates + id: patches shell: bash run: | set -euo pipefail - TAGS=$(curl -fsSL https://api.github.com/repos/llvm/llvm-project/tags \ + curl -fsSL https://api.github.com/repos/llvm/llvm-project/tags \ | jq -r '.[].name' \ - | grep "^llvmorg-${LLVM_MAJOR}\.${LLVM_MINOR}\.") + | sed 's/^llvmorg-//' \ + | grep "^${LLVM_MAJOR}\.${LLVM_MINOR}\." \ + | sort -V \ + > llvm_patches.txt - FALLBACK=$(echo "$TAGS" | sed 's/^llvmorg-//' | sort -V | tail -n1) + if [[ ! -s llvm_patches.txt ]]; then + echo "::error::No LLVM releases found for ${LLVM_MAJOR}.${LLVM_MINOR}" + exit 1 + fi - if [[ -z "$FALLBACK" ]]; then - echo "::error::No LLVM fallback found for ${LLVM_MAJOR}.${LLVM_MINOR}" + # ------------------------------------------------------------ + # Try patches >= Rust patch, in ascending order + # ------------------------------------------------------------ + - name: Probe LLVM versions + id: probe + shell: bash + run: | + set -euo pipefail + + SELECTED="" + + while read -r VER; do + PATCH=$(echo "$VER" | cut -d. -f3) + + if (( PATCH < LLVM_PATCH )); then + continue + fi + + echo "::group::Trying LLVM $VER" + if llvm_ver="$VER" \ + && echo "LLVM_TRY=$VER" >> "$GITHUB_ENV"; then + echo "::endgroup::" + SELECTED="$VER" + break + fi + echo "::endgroup::" + done < llvm_patches.txt + + if [[ -z "$SELECTED" ]]; then + echo "::error::No usable LLVM binary found for ${LLVM_MAJOR}.${LLVM_MINOR}.x" exit 1 fi - echo "LLVM_FALLBACK=$FALLBACK" >> "$GITHUB_ENV" + echo "LLVM_SELECTED=$SELECTED" >> "$GITHUB_ENV" - - name: Install LLVM fallback - if: steps.llvm_exact.outcome == 'failure' + # ------------------------------------------------------------ + # Install selected LLVM + # ------------------------------------------------------------ + - name: Install LLVM uses: KyleMayes/install-llvm-action@v2 with: - version: ${{ env.LLVM_FALLBACK }} + version: ${{ env.LLVM_SELECTED }} + env: true + # ------------------------------------------------------------ + # Verify LLVM compatibility + # ------------------------------------------------------------ - name: Verify LLVM compatibility - id: verify shell: bash run: | set -euo pipefail @@ -71,13 +109,13 @@ runs: echo "Rust LLVM : $RUST_LLVM" echo "Clang LLVM : $CLANG_LLVM" - if [[ "$RUST_LLVM" != "$CLANG_LLVM" ]]; then - echo "::warning::LLVM mismatch — cross-language LTO might not work!" - echo "LLVM_SELECTED=$CLANG_LLVM" >> "$GITHUB_ENV" - else - echo "LLVM_SELECTED=$RUST_LLVM" >> "$GITHUB_ENV" + if [[ "$CLANG_LLVM" != "$LLVM_SELECTED" ]]; then + echo "::warning::Installed LLVM does not match selected version" fi + # ------------------------------------------------------------ + # Export outputs + # ------------------------------------------------------------ - name: Export outputs id: export shell: bash diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 20bace3d..274235d6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -44,10 +44,14 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + id: toolchain with: toolchain: ${{ needs.define-matrix.outputs.latest }} components: clippy,llvm-tools,rust-src,rustc-dev + - name: Force toolchain + run: echo "RUSTUP_TOOLCHAIN=${{ steps.toolchain.outputs.name }}" >> "$GITHUB_ENV" + - name: Cache dependencies uses: Swatinem/rust-cache@v2 with: @@ -118,15 +122,15 @@ jobs: uses: taiki-e/install-action@cargo-nextest - name: Build release - run: ./scripts/build/toolchain cargo build --release + run: cargo build --release - name: Run tests # MIR is still unstable, so this test can fail in other versions of Rust. if: matrix.toolchain == needs.define-matrix.outputs.latest - run: ./scripts/build/toolchain cargo nextest run --no-fail-fast + run: cargo nextest run --no-fail-fast - name: Install binary - run: ./scripts/build/toolchain cargo install --path . + run: cargo install --path . - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package From f9620e80bec396f3e4857304612ded960cc386e2 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Thu, 5 Feb 2026 11:40:53 +0600 Subject: [PATCH 53/76] try2 --- .github/workflows/checks.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 274235d6..1eff14aa 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -49,9 +49,6 @@ jobs: toolchain: ${{ needs.define-matrix.outputs.latest }} components: clippy,llvm-tools,rust-src,rustc-dev - - name: Force toolchain - run: echo "RUSTUP_TOOLCHAIN=${{ steps.toolchain.outputs.name }}" >> "$GITHUB_ENV" - - name: Cache dependencies uses: Swatinem/rust-cache@v2 with: @@ -110,6 +107,10 @@ jobs: with: toolchain: ${{ matrix.toolchain }} components: rust-src,rustc-dev,llvm-tools + + - name: Force toolchain + run: echo "RUSTUP_TOOLCHAIN=${{ steps.toolchain.outputs.name }}" >> "$GITHUB_ENV" + - name: Install LLVM and Clang uses: ./.github/actions/setup-rust-llvm From 5d440746b7b66ff48b86037ce14a98d31675a53b Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Thu, 5 Feb 2026 12:25:38 +0600 Subject: [PATCH 54/76] no cross lang lto --- .github/actions/setup-rust-llvm/action.yml | 124 --------------------- .github/workflows/checks.yml | 18 +-- .github/workflows/security.yml | 3 - scripts/build/print-env.sh | 10 +- 4 files changed, 6 insertions(+), 149 deletions(-) delete mode 100644 .github/actions/setup-rust-llvm/action.yml diff --git a/.github/actions/setup-rust-llvm/action.yml b/.github/actions/setup-rust-llvm/action.yml deleted file mode 100644 index c638864d..00000000 --- a/.github/actions/setup-rust-llvm/action.yml +++ /dev/null @@ -1,124 +0,0 @@ -name: setup-rust-llvm -description: > - Install LLVM/Clang matching Rust's LLVM version with forward-patch fallback. - Designed for cross-language LTO correctness. - -outputs: - llvm-version: - description: LLVM version selected - value: ${{ steps.export.outputs.llvm_version }} - -runs: - using: composite - steps: - # ------------------------------------------------------------ - # Detect Rust LLVM version - # ------------------------------------------------------------ - - name: Detect Rust LLVM version - id: detect - shell: bash - run: | - set -euo pipefail - - LLVM_FULL=$(rustc -vV | sed -n 's/^LLVM version: //p') - LLVM_MAJOR=$(echo "$LLVM_FULL" | cut -d. -f1) - LLVM_MINOR=$(echo "$LLVM_FULL" | cut -d. -f2) - LLVM_PATCH=$(echo "$LLVM_FULL" | cut -d. -f3) - - echo "LLVM_FULL=$LLVM_FULL" >> "$GITHUB_ENV" - echo "LLVM_MAJOR=$LLVM_MAJOR" >> "$GITHUB_ENV" - echo "LLVM_MINOR=$LLVM_MINOR" >> "$GITHUB_ENV" - echo "LLVM_PATCH=$LLVM_PATCH" >> "$GITHUB_ENV" - - # ------------------------------------------------------------ - # Fetch all available patches for this major.minor - # ------------------------------------------------------------ - - name: Fetch LLVM patch candidates - id: patches - shell: bash - run: | - set -euo pipefail - - curl -fsSL https://api.github.com/repos/llvm/llvm-project/tags \ - | jq -r '.[].name' \ - | sed 's/^llvmorg-//' \ - | grep "^${LLVM_MAJOR}\.${LLVM_MINOR}\." \ - | sort -V \ - > llvm_patches.txt - - if [[ ! -s llvm_patches.txt ]]; then - echo "::error::No LLVM releases found for ${LLVM_MAJOR}.${LLVM_MINOR}" - exit 1 - fi - - # ------------------------------------------------------------ - # Try patches >= Rust patch, in ascending order - # ------------------------------------------------------------ - - name: Probe LLVM versions - id: probe - shell: bash - run: | - set -euo pipefail - - SELECTED="" - - while read -r VER; do - PATCH=$(echo "$VER" | cut -d. -f3) - - if (( PATCH < LLVM_PATCH )); then - continue - fi - - echo "::group::Trying LLVM $VER" - if llvm_ver="$VER" \ - && echo "LLVM_TRY=$VER" >> "$GITHUB_ENV"; then - echo "::endgroup::" - SELECTED="$VER" - break - fi - echo "::endgroup::" - done < llvm_patches.txt - - if [[ -z "$SELECTED" ]]; then - echo "::error::No usable LLVM binary found for ${LLVM_MAJOR}.${LLVM_MINOR}.x" - exit 1 - fi - - echo "LLVM_SELECTED=$SELECTED" >> "$GITHUB_ENV" - - # ------------------------------------------------------------ - # Install selected LLVM - # ------------------------------------------------------------ - - name: Install LLVM - uses: KyleMayes/install-llvm-action@v2 - with: - version: ${{ env.LLVM_SELECTED }} - env: true - - # ------------------------------------------------------------ - # Verify LLVM compatibility - # ------------------------------------------------------------ - - name: Verify LLVM compatibility - shell: bash - run: | - set -euo pipefail - - RUST_LLVM=$(rustc -vV | sed -n 's/^LLVM version: //p') - CLANG_LLVM=$(clang --version | sed -n 's/.*LLVM version \([0-9.]*\).*/\1/p') - - echo "Rust LLVM : $RUST_LLVM" - echo "Clang LLVM : $CLANG_LLVM" - - if [[ "$CLANG_LLVM" != "$LLVM_SELECTED" ]]; then - echo "::warning::Installed LLVM does not match selected version" - fi - - # ------------------------------------------------------------ - # Export outputs - # ------------------------------------------------------------ - - name: Export outputs - id: export - shell: bash - run: | - echo "llvm_version=${LLVM_SELECTED}" >> "$GITHUB_OUTPUT" - diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 1eff14aa..acb1adc9 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -102,18 +102,6 @@ jobs: - name: Checkout uses: actions/checkout@v6 - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: ${{ matrix.toolchain }} - components: rust-src,rustc-dev,llvm-tools - - - name: Force toolchain - run: echo "RUSTUP_TOOLCHAIN=${{ steps.toolchain.outputs.name }}" >> "$GITHUB_ENV" - - - name: Install LLVM and Clang - uses: ./.github/actions/setup-rust-llvm - - name: Cache dependencies uses: Swatinem/rust-cache@v2 with: @@ -123,15 +111,15 @@ jobs: uses: taiki-e/install-action@cargo-nextest - name: Build release - run: cargo build --release + run: ./scripts/build/toolchain cargo build --release - name: Run tests # MIR is still unstable, so this test can fail in other versions of Rust. if: matrix.toolchain == needs.define-matrix.outputs.latest - run: cargo nextest run --no-fail-fast + run: ./scripts/build/toolchain cargo nextest run --no-fail-fast - name: Install binary - run: cargo install --path . + run: ./scripts/build/toolchain cargo install --path . - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 8ede28dd..379a7e40 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -35,9 +35,6 @@ jobs: components: miri,rust-src,llvm-tools-preview,rustc-dev cache: false - - name: Install LLVM and Clang - uses: ./.github/actions/setup-rust-llvm - - name: Install system dependencies (Linux) if: matrix.runner_os == 'Linux' run: | diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 60594cec..9da2cb7a 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -63,20 +63,16 @@ print_env() { echo "PATH=$sysroot/bin:$PATH" echo "RUSTC_BOOTSTRAP=rustowlc" - echo "CFLAGS=-flto" - echo "CXXFLAGS=-flto" - echo "RUSTFLAGS=-Clinker-plugin-lto -Clinker=clang -Clink-arg=-fuse-ld=lld" - # Fix for Windows LTO + LTO for C/C++ case "$(host_tuple)" in *-pc-windows-msvc) echo "CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" echo "CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" - echo "RUSTFLAGS=-Clinker-plugin-lto -Clinker=lld-link" + echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-flto /clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-flto /clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-fuse-ld=lld-link" echo "AR=llvm-lib" ;; esac From f3707f03192927fb1826df24bd07e776868dde10 Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Thu, 5 Feb 2026 12:28:46 +0600 Subject: [PATCH 55/76] nothing special --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index acb1adc9..628b7c16 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -20,6 +20,7 @@ jobs: steps: - id: toolchains run: | + # Last 5 stable versions only TOOLCHAINS='["1.89.0", "1.90.0", "1.91.1", "1.92.0", "1.93.0"]' echo "toolchains=$TOOLCHAINS" >> "$GITHUB_OUTPUT" echo "latest=$(jq -r '.[-1]' <<< "$TOOLCHAINS")" >> "$GITHUB_OUTPUT" @@ -44,7 +45,6 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - id: toolchain with: toolchain: ${{ needs.define-matrix.outputs.latest }} components: clippy,llvm-tools,rust-src,rustc-dev From cab4790254b402c1e44f3bc9f5e181c7cd7fd40b Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Thu, 5 Feb 2026 12:30:36 +0600 Subject: [PATCH 56/76] format --- src/bin/rustowl.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/rustowl.rs b/src/bin/rustowl.rs index b9a6a167..2cbf99cc 100644 --- a/src/bin/rustowl.rs +++ b/src/bin/rustowl.rs @@ -11,8 +11,8 @@ use tower_lsp::{LspService, Server}; use crate::cli::{Cli, Commands, ToolchainCommands}; -// Cited from rustc -// https://github.com/rust-lang/rust/pull/148925 +// Cited from rustc +// https://github.com/rust-lang/rust/pull/148925 // MIT License #[cfg(all(any(target_os = "linux", target_os = "macos"), not(miri)))] use tikv_jemalloc_sys as _; From f186ef6fcfc77fe6a9689d71472673475883f554 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 7 Feb 2026 07:44:02 +0600 Subject: [PATCH 57/76] Update print-env.sh --- scripts/build/print-env.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 9da2cb7a..b8be51f7 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -71,9 +71,10 @@ print_env() { echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-O3 /clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-O3 /clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" echo "AR=llvm-lib" + echo "LDFLAGS=/DEBUG:NONE" ;; esac } From 1320a4daddd14e023fe7ab980cabd2ae1e1ca745 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 7 Feb 2026 08:33:45 +0600 Subject: [PATCH 58/76] remove O3 flag as aws lc rs cpu jitter entropy must not be optimized --- scripts/build/print-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index b8be51f7..d6f2997a 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -71,7 +71,7 @@ print_env() { echo "RUSTFLAGS=-Clinker=lld-link" echo "CC=clang-cl" echo "CXX=clang-cl" - echo "CFLAGS=/clang:-O3 /clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" + echo "CFLAGS=/clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" echo "CXXFLAGS=/clang:-O3 /clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" echo "AR=llvm-lib" echo "LDFLAGS=/DEBUG:NONE" From a948afe54743a93b7dbdf8f5b8275bff100b1937 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 7 Feb 2026 08:34:04 +0600 Subject: [PATCH 59/76] Update print-env.sh --- scripts/build/print-env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index d6f2997a..5cc746da 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -72,7 +72,7 @@ print_env() { echo "CC=clang-cl" echo "CXX=clang-cl" echo "CFLAGS=/clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-O3 /clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" + echo "CXXFLAGS=/clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" echo "AR=llvm-lib" echo "LDFLAGS=/DEBUG:NONE" ;; From 5949b6fe5990363cf8777b83d4cb543cc28d0d32 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sat, 7 Feb 2026 18:35:24 +0600 Subject: [PATCH 60/76] Delete config.toml --- .cargo/config.toml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 169d291b..00000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,2 +0,0 @@ -[env] -AWS_LC_SYS_PREBUILT_NASM = "1" From cc32cd1ecf93461d2eec2d2f625e2ea8274ba08c Mon Sep 17 00:00:00 2001 From: MuntasirSZN Date: Sat, 7 Feb 2026 19:57:42 +0600 Subject: [PATCH 61/76] fixes --- .cargo/config.toml | 2 + .github/workflows/checks.yml | 5 + Cargo.lock | 234 +++++++++++++++++++++++++++++++---- 3 files changed, 219 insertions(+), 22 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..169d291b --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[env] +AWS_LC_SYS_PREBUILT_NASM = "1" diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 628b7c16..1d807601 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -110,6 +110,11 @@ jobs: - name: Install nextest uses: taiki-e/install-action@cargo-nextest + # uname on Windows on ARM returns "x86_64" + - name: Set ARCH flag for Windows on ARM + if: matrix.os == 'windows-11-arm' + run: echo "TOOLCHAIN_ARCH=aarch64" >> $GITHUB_ENV + - name: Build release run: ./scripts/build/toolchain cargo build --release diff --git a/Cargo.lock b/Cargo.lock index be80eb66..7ab0e8a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -93,6 +93,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "anyhow" +version = "1.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea" + [[package]] name = "async-trait" version = "0.1.89" @@ -420,9 +426,9 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" [[package]] name = "core-foundation" @@ -485,9 +491,9 @@ dependencies = [ [[package]] name = "criterion" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d883447757bb0ee46f233e9dc22eb84d93a9508c9b868687b274fc431d886bf" +checksum = "950046b2aa2492f9a536f5f4f9a3de7b9e2476e575e05bd6c333371add4d98f3" dependencies = [ "alloca", "anes", @@ -510,9 +516,9 @@ dependencies = [ [[package]] name = "criterion-plot" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed943f81ea2faa8dcecbbfa50164acf95d555afec96a27871663b300e387b2e4" +checksum = "d8d80a2f4f5b554395e47b5d8305bc3d27813bacb73493eb1001e8f76dae29ea" dependencies = [ "cast", "itertools", @@ -692,6 +698,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "form_urlencoded" version = "1.2.2" @@ -821,6 +833,21 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasip3", + "wasm-bindgen", +] + [[package]] name = "h2" version = "0.4.13" @@ -857,6 +884,15 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + [[package]] name = "hashbrown" version = "0.16.1" @@ -1061,6 +1097,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "idna" version = "1.1.0" @@ -1090,6 +1132,8 @@ checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", "hashbrown 0.16.1", + "serde", + "serde_core", ] [[package]] @@ -1192,6 +1236,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libbz2-rs-sys" version = "0.2.2" @@ -1273,9 +1323,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "mime" @@ -1487,6 +1537,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "proc-macro2" version = "1.0.106" @@ -1675,9 +1735,9 @@ checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" [[package]] name = "reqwest" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e9018c9d814e5f30cc16a0f03271aeab3571e609612d9fe78c1aa8d11c2f62" +checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" dependencies = [ "base64", "bytes", @@ -2213,9 +2273,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.46" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", @@ -2237,9 +2297,9 @@ checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.26" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc610bac2dcee56805c99642447d4c5dbde4d01f752ffea0199aee1f601dc4" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", @@ -2520,6 +2580,12 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "untrusted" version = "0.9.0" @@ -2602,6 +2668,15 @@ dependencies = [ "wit-bindgen", ] +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen", +] + [[package]] name = "wasm-bindgen" version = "0.2.108" @@ -2661,6 +2736,40 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.10.0", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + [[package]] name = "web-sys" version = "0.3.85" @@ -2992,6 +3101,88 @@ name = "wit-bindgen" version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.10.0", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] [[package]] name = "writeable" @@ -3034,18 +3225,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.38" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57cf3aa6855b23711ee9852dfc97dfaa51c45feaba5b645d0c777414d494a961" +checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.38" +version = "0.8.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a616990af1a287837c4fe6596ad77ef57948f787e46ce28e166facc0cc1cb75" +checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" dependencies = [ "proc-macro2", "quote", @@ -3128,9 +3319,9 @@ dependencies = [ [[package]] name = "zip" -version = "7.2.0" +version = "7.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42e33efc22a0650c311c2ef19115ce232583abbe80850bc8b66509ebef02de0" +checksum = "cc12baa6db2b15a140161ce53d72209dacea594230798c24774139b54ecaa980" dependencies = [ "aes", "bzip2", @@ -3138,8 +3329,7 @@ dependencies = [ "crc32fast", "deflate64", "flate2", - "generic-array", - "getrandom 0.3.4", + "getrandom 0.4.1", "hmac", "indexmap", "lzma-rust2", From 32afe33b6c41259fd10bf4ba8e53a6855689279c Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:38:41 +0600 Subject: [PATCH 62/76] Update print-env.sh --- scripts/build/print-env.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/scripts/build/print-env.sh b/scripts/build/print-env.sh index 5cc746da..c5702458 100755 --- a/scripts/build/print-env.sh +++ b/scripts/build/print-env.sh @@ -62,21 +62,6 @@ print_env() { echo "SYSROOT=$sysroot" echo "PATH=$sysroot/bin:$PATH" echo "RUSTC_BOOTSTRAP=rustowlc" - - - case "$(host_tuple)" in - *-pc-windows-msvc) - echo "CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" - echo "CARGO_TARGET_AARCH64_PC_WINDOWS_MSVC_LINKER=lld-link.exe" - echo "RUSTFLAGS=-Clinker=lld-link" - echo "CC=clang-cl" - echo "CXX=clang-cl" - echo "CFLAGS=/clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" - echo "CXXFLAGS=/clang:-g0 /clang:-flto /clang:-fuse-ld=lld-link" - echo "AR=llvm-lib" - echo "LDFLAGS=/DEBUG:NONE" - ;; - esac } print_env From a6ef7f02c7a9f2a4997f389bb1701e7040be6fdf Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:39:24 +0600 Subject: [PATCH 63/76] Update Cargo.toml --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 7ba07732..8f26e40b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,3 +96,7 @@ debug = true strip = "none" debug-assertions = true overflow-checks = true + +[profile.windows-release] +inherits = "release" +lto = "off" \ No newline at end of file From dc5e9f3d8a56c40ac6a18d93c3cb2c10f82f38a1 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:39:52 +0600 Subject: [PATCH 64/76] Update Cargo.toml --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8f26e40b..3dad227a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -97,6 +97,6 @@ strip = "none" debug-assertions = true overflow-checks = true -[profile.windows-release] -inherits = "release" +[profile.windows-release] +inherits = "release" lto = "off" \ No newline at end of file From 5ea90ffa735bed018cb9f9d3a979999595178773 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:40:08 +0600 Subject: [PATCH 65/76] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 3dad227a..450e4ce5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -99,4 +99,4 @@ overflow-checks = true [profile.windows-release] inherits = "release" -lto = "off" \ No newline at end of file +lto = "off" From e5f00b98316e52641744b4681127a9782c93b4be Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:41:34 +0600 Subject: [PATCH 66/76] Update build.yml --- .github/workflows/build.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 94757922..1ccfc343 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,15 @@ jobs: - name: Checkout uses: actions/checkout@v6 + # Using fat LTO causes failure to link on Windows + - name: Set build profile + run: | + if [[ "${{ matrix.os }}" == windows* ]]; then + echo "build_profile=windows-release" >> $GITHUB_ENV + else + echo "build_profile=release" >> $GITHUB_ENV + fi + # uname on Windows on ARM returns "x86_64" - name: Set ARCH flag for Windows on ARM if: matrix.os == 'windows-11-arm' From 06fc5533c12aeb905488aea8e8d976d31b55659c Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:42:12 +0600 Subject: [PATCH 67/76] Update build.yml --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ccfc343..41c8b349 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,13 +39,13 @@ jobs: uses: actions/checkout@v6 # Using fat LTO causes failure to link on Windows - - name: Set build profile - run: | - if [[ "${{ matrix.os }}" == windows* ]]; then - echo "build_profile=windows-release" >> $GITHUB_ENV - else - echo "build_profile=release" >> $GITHUB_ENV - fi + - name: Set build profile + run: | + if [[ "${{ matrix.os }}" == windows* ]]; then + echo "build_profile=windows-release" >> $GITHUB_ENV + else + echo "build_profile=release" >> $GITHUB_ENV + fi # uname on Windows on ARM returns "x86_64" - name: Set ARCH flag for Windows on ARM From d04a4f1c321fce8c7d7dfacc2e230d3f45e5d709 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:42:33 +0600 Subject: [PATCH 68/76] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41c8b349..5a37d326 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: - name: Checkout uses: actions/checkout@v6 - # Using fat LTO causes failure to link on Windows + # Using fat LTO causes failure to link on Windows - name: Set build profile run: | if [[ "${{ matrix.os }}" == windows* ]]; then From 8e3e9e62e1ba02b25ab28f98adada95db00243c3 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:45:13 +0600 Subject: [PATCH 69/76] Update build.yml --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5a37d326..03b59361 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -73,14 +73,14 @@ jobs: run: | if [[ "${{ env.is_linux }}" == "true" ]]; then ./scripts/build/toolchain cargo install --locked cargo-zigbuild - ./scripts/build/toolchain cargo zigbuild --target ${{ env.host_tuple }}.2.17 --release + ./scripts/build/toolchain cargo zigbuild --target ${{ env.host_tuple }}.2.17 --profile=${{ env.build_profile }} else - ./scripts/build/toolchain cargo build --target ${{ env.host_tuple }} --release + ./scripts/build/toolchain cargo build --target ${{ env.host_tuple }} --profile=${{ env.build_profile }} fi - name: Check the functionality run: | - ./target/${{ env.host_tuple }}/release/rustowl${{ env.exec_ext }} check ./perf-tests/dummy-package + ./target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowl${{ env.exec_ext }} check ./perf-tests/dummy-package - name: Set archive name run: | @@ -94,8 +94,8 @@ jobs: run: | rm -rf rustowl && mkdir -p rustowl/sysroot/${{ env.toolchain }}/bin - cp target/${{ env.host_tuple }}/release/rustowl${{ env.exec_ext }} ./rustowl/ - cp target/${{ env.host_tuple }}/release/rustowlc${{ env.exec_ext }} ./rustowl/sysroot/${{ env.toolchain }}/bin + cp target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowl${{ env.exec_ext }} ./rustowl/ + cp target/${{ env.host_tuple }}/${{ env.build_profile }}/rustowlc${{ env.exec_ext }} ./rustowl/sysroot/${{ env.toolchain }}/bin cp README.md ./rustowl cp LICENSE ./rustowl From 297d1701da41588cc90cbcfddaeb1b9a7bca4101 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:47:13 +0600 Subject: [PATCH 70/76] Update checks.yml --- .github/workflows/checks.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 1d807601..1126c418 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -102,6 +102,15 @@ jobs: - name: Checkout uses: actions/checkout@v6 + # Using fat LTO causes failure to link on Windows + - name: Set build profile + run: | + if [[ "${{ matrix.os }}" == windows* ]]; then + echo "build_profile=windows-release" >> $GITHUB_ENV + else + echo "build_profile=release" >> $GITHUB_ENV + fi + - name: Cache dependencies uses: Swatinem/rust-cache@v2 with: @@ -116,15 +125,15 @@ jobs: run: echo "TOOLCHAIN_ARCH=aarch64" >> $GITHUB_ENV - name: Build release - run: ./scripts/build/toolchain cargo build --release + run: ./scripts/build/toolchain cargo build --profile=${{ env.build_profile }} - name: Run tests # MIR is still unstable, so this test can fail in other versions of Rust. if: matrix.toolchain == needs.define-matrix.outputs.latest - run: ./scripts/build/toolchain cargo nextest run --no-fail-fast + run: ./scripts/build/toolchain cargo nextest run --no-fail-fast --profile=${{ env.build_profile }} - name: Install binary - run: ./scripts/build/toolchain cargo install --path . + run: ./scripts/build/toolchain cargo install --path . --profile=${{ env.build_profile }} - name: Test rustowl check run: rustowl check ./perf-tests/dummy-package From 69b72ecee051f89052f33be0eb6e921cec140340 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:52:20 +0600 Subject: [PATCH 71/76] Update algorithm.rs --- tests/algorithm.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/algorithm.rs b/tests/algorithm.rs index 579d3d49..81f31380 100644 --- a/tests/algorithm.rs +++ b/tests/algorithm.rs @@ -5,10 +5,13 @@ static BUILD_ONCE: Once = Once::new(); fn ensure_rustowl_built() { BUILD_ONCE.call_once(|| { - let status = Command::new("cargo") - .args(["build", "--release"]) - .status() - .expect("Failed to build rustowl"); + let mut cmd = Command::new("cargo"); + if cfg!(windows) { + cmd.args(["build", "--profile", "windows_release"]); + } else { + cmd.args(["build", "--release"]); + } + let status = cmd.status().expect("Failed to build rustowl"); assert!(status.success(), "Failed to build rustowl"); }); } @@ -16,10 +19,19 @@ fn ensure_rustowl_built() { fn get_rustowl_output(function_path: &str, variable: &str) -> String { ensure_rustowl_built(); + let exe_name = if cfg!(windows) { "rustowl.exe" } else { "rustowl" }; + let profile_dir = if cfg!(windows) { + "windows_release" + } else { + "release" + }; + let output = Command::new(format!( - "target{}release{}rustowl", + "target{}{}{}{}", + std::path::MAIN_SEPARATOR, + profile_dir, std::path::MAIN_SEPARATOR, - std::path::MAIN_SEPARATOR + exe_name )) .args([ "show", From 3b2713c647f136caf55cd6500e0d5d10dd069c81 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 18:53:06 +0600 Subject: [PATCH 72/76] format --- tests/algorithm.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/algorithm.rs b/tests/algorithm.rs index 81f31380..3fe871d9 100644 --- a/tests/algorithm.rs +++ b/tests/algorithm.rs @@ -19,7 +19,11 @@ fn ensure_rustowl_built() { fn get_rustowl_output(function_path: &str, variable: &str) -> String { ensure_rustowl_built(); - let exe_name = if cfg!(windows) { "rustowl.exe" } else { "rustowl" }; + let exe_name = if cfg!(windows) { + "rustowl.exe" + } else { + "rustowl" + }; let profile_dir = if cfg!(windows) { "windows_release" } else { From a8ce3afcba8f8c3fb793bccc5e3e5358b0dce46c Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 20:58:17 +0600 Subject: [PATCH 73/76] Update checks.yml --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 1126c418..9b723594 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -130,7 +130,7 @@ jobs: - name: Run tests # MIR is still unstable, so this test can fail in other versions of Rust. if: matrix.toolchain == needs.define-matrix.outputs.latest - run: ./scripts/build/toolchain cargo nextest run --no-fail-fast --profile=${{ env.build_profile }} + run: ./scripts/build/toolchain cargo nextest run --no-fail-fast - name: Install binary run: ./scripts/build/toolchain cargo install --path . --profile=${{ env.build_profile }} From addeec8bbd4157791ad7fb75cf9518ccf293d3c6 Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Sun, 8 Feb 2026 21:20:21 +0600 Subject: [PATCH 74/76] Update algorithm.rs --- tests/algorithm.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/algorithm.rs b/tests/algorithm.rs index 3fe871d9..e7ebe48e 100644 --- a/tests/algorithm.rs +++ b/tests/algorithm.rs @@ -7,7 +7,7 @@ fn ensure_rustowl_built() { BUILD_ONCE.call_once(|| { let mut cmd = Command::new("cargo"); if cfg!(windows) { - cmd.args(["build", "--profile", "windows_release"]); + cmd.args(["build", "--profile", "windows-release"]); } else { cmd.args(["build", "--release"]); } @@ -25,7 +25,7 @@ fn get_rustowl_output(function_path: &str, variable: &str) -> String { "rustowl" }; let profile_dir = if cfg!(windows) { - "windows_release" + "windows-release" } else { "release" }; From c2446537afdb7991b5bc9197d8e5ce913fa778ee Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Mon, 9 Feb 2026 07:42:07 +0600 Subject: [PATCH 75/76] why its still failing? --- tests/algorithm.rs | 50 +++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/tests/algorithm.rs b/tests/algorithm.rs index e7ebe48e..7dbf441a 100644 --- a/tests/algorithm.rs +++ b/tests/algorithm.rs @@ -11,8 +11,15 @@ fn ensure_rustowl_built() { } else { cmd.args(["build", "--release"]); } - let status = cmd.status().expect("Failed to build rustowl"); - assert!(status.success(), "Failed to build rustowl"); + let output = cmd + .output() + .unwrap_or_else(|e| panic!("Failed to execute cargo build: {e}")); + assert!( + output.status.success(), + "Failed to build rustowl.\nstdout: {}\nstderr: {}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); }); } @@ -30,28 +37,35 @@ fn get_rustowl_output(function_path: &str, variable: &str) -> String { "release" }; - let output = Command::new(format!( + let rustowl_path = format!( "target{}{}{}{}", std::path::MAIN_SEPARATOR, profile_dir, std::path::MAIN_SEPARATOR, exe_name - )) - .args([ - "show", - "--path", - &format!( - "algo-tests{}src{}vec.rs", - std::path::MAIN_SEPARATOR, - std::path::MAIN_SEPARATOR - ), - function_path, - variable, - ]) - .output() - .expect("Failed to run rustowl"); + ); - assert!(output.status.success(), "rustowl command failed"); + let output = Command::new(&rustowl_path) + .args([ + "show", + "--path", + &format!( + "algo-tests{}src{}vec.rs", + std::path::MAIN_SEPARATOR, + std::path::MAIN_SEPARATOR + ), + function_path, + variable, + ]) + .output() + .unwrap_or_else(|e| panic!("Failed to execute {rustowl_path}: {e}")); + + assert!( + output.status.success(), + "{rustowl_path} command failed.\nstdout: {}\nstderr: {}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); String::from_utf8(output.stdout).expect("Invalid UTF-8") } From 2aba58a1ae49b3cace336fb50b301618e0db950c Mon Sep 17 00:00:00 2001 From: Muntasir Mahmud Date: Mon, 9 Feb 2026 08:53:13 +0600 Subject: [PATCH 76/76] Create .config/nextest.toml --- .config/nextest.toml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .config/nextest.toml diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 00000000..952d0e8b --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,6 @@ +[test-groups.serial-algorithm] +max-threads = 1 + +[[profile.default.overrides]] +filter = "test(::test_f[0-9])" +test-group = "serial-algorithm"