From 1663f456b44989c58bbdd9b38344cb57b6d73c1d Mon Sep 17 00:00:00 2001 From: "Ethan D. Twardy" Date: Sun, 1 May 2022 10:24:36 -0500 Subject: [PATCH 1/7] Can't leak crate-private type in stub.rs #662 First attempt to fix this issue for wasm32-unknown-* targets by changing visibility of functions not to leak crate-private types. --- src/offset/sys/stub.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/offset/sys/stub.rs b/src/offset/sys/stub.rs index 9172a85223..616b52fe5e 100644 --- a/src/offset/sys/stub.rs +++ b/src/offset/sys/stub.rs @@ -65,16 +65,16 @@ fn tm_to_time(tm: &Tm) -> i64 { + s } -pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { +pub(super) fn time_to_local_tm(sec: i64, tm: &mut Tm) { // FIXME: Add timezone logic time_to_tm(sec, tm); } -pub fn utc_tm_to_time(tm: &Tm) -> i64 { +pub(super) fn utc_tm_to_time(tm: &Tm) -> i64 { tm_to_time(tm) } -pub fn local_tm_to_time(tm: &Tm) -> i64 { +pub(super) fn local_tm_to_time(tm: &Tm) -> i64 { // FIXME: Add timezone logic tm_to_time(tm) } From be4be9fff862de13b93ba94a84a471af5b3cb7fa Mon Sep 17 00:00:00 2001 From: "Ethan D. Twardy" Date: Mon, 2 May 2022 18:01:15 -0500 Subject: [PATCH 2/7] Add test for wasm_unknown This configuration builds plainly for the wasm32-unknown-unknown. In contrast to the existing wasm_emscripten test, this test ensures chrono builds on the latest ubuntu without wasm-pack. --- .github/workflows/test.yml | 23 +++++++++++++++++++++++ ci/github.sh | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b32c9f47f4..870bbc471b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -149,6 +149,29 @@ jobs: RUST_VERSION: stable WASM: wasm_emscripten + wasm_unknown: + strategy: + matrix: + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-unknown + override: true + + - name: Build and Test + run: bash ci/github.sh + env: + RUST_VERSION: stable + WASM: wasm_unknown + cross-targets: strategy: matrix: diff --git a/ci/github.sh b/ci/github.sh index 081a128b90..6512f9a7ee 100755 --- a/ci/github.sh +++ b/ci/github.sh @@ -36,6 +36,8 @@ meaningful in the github actions feature matrix UI. test_wasm_simple elif [[ ${WASM:-} == wasm_emscripten ]]; then test_wasm_emscripten + elif [[ ${WASM:-} == wasm_unknown ]]; then + test_wasm_unknown elif [[ ${CORE:-} == no_std ]]; then test_core elif [[ ${EXHAUSTIVE_TZ:-} == all_tzs ]]; then @@ -118,4 +120,8 @@ test_wasm_emscripten() { runt cargo build --target wasm32-unknown-emscripten } +test_wasm_unknown() { + runt cargo build --target wasm32-unknown-unknown +} + main "$@" From 1cf381bf6c479a6f97d847df9149184dda156acb Mon Sep 17 00:00:00 2001 From: "Ethan D. Twardy" Date: Wed, 11 May 2022 20:04:11 -0500 Subject: [PATCH 3/7] Revert "Can't leak crate-private type in stub.rs #662" This reverts commit 1663f456b44989c58bbdd9b38344cb57b6d73c1d. This is the commit that fixes #662, but I'm temporarily reverting it to be able to test the CI test on the GitHub pull request. --- src/offset/sys/stub.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/offset/sys/stub.rs b/src/offset/sys/stub.rs index 616b52fe5e..9172a85223 100644 --- a/src/offset/sys/stub.rs +++ b/src/offset/sys/stub.rs @@ -65,16 +65,16 @@ fn tm_to_time(tm: &Tm) -> i64 { + s } -pub(super) fn time_to_local_tm(sec: i64, tm: &mut Tm) { +pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { // FIXME: Add timezone logic time_to_tm(sec, tm); } -pub(super) fn utc_tm_to_time(tm: &Tm) -> i64 { +pub fn utc_tm_to_time(tm: &Tm) -> i64 { tm_to_time(tm) } -pub(super) fn local_tm_to_time(tm: &Tm) -> i64 { +pub fn local_tm_to_time(tm: &Tm) -> i64 { // FIXME: Add timezone logic tm_to_time(tm) } From 47e64777e1ecc3d7d9c40e49c9332520b1cd0756 Mon Sep 17 00:00:00 2001 From: "Ethan D. Twardy" Date: Wed, 11 May 2022 20:06:01 -0500 Subject: [PATCH 4/7] Ensure the default toolchain is used for the wasm_unknown CI test Issue #210 for actions-rs/toolchain: https://github.com/actions-rs/toolchain/issues/210 Indicates that the installed toolchain is not configured to be the default toolchain for GitHub actions. The OP for that issue experienced quite a bit of trouble due to this, it seems. Add configuration to ensure that the current stable toolchain is being used. --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 870bbc471b..708b6e50f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -165,6 +165,7 @@ jobs: toolchain: stable target: wasm32-unknown-unknown override: true + default: true - name: Build and Test run: bash ci/github.sh From 1ec963ea212ef3e54d3fea610ac1300652d19498 Mon Sep 17 00:00:00 2001 From: "Ethan D. Twardy" Date: Sun, 1 May 2022 10:24:36 -0500 Subject: [PATCH 5/7] Can't leak crate-private type in stub.rs #662 First attempt to fix this issue for wasm32-unknown-* targets by changing visibility of functions not to leak crate-private types. --- src/offset/sys/stub.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/offset/sys/stub.rs b/src/offset/sys/stub.rs index 9172a85223..616b52fe5e 100644 --- a/src/offset/sys/stub.rs +++ b/src/offset/sys/stub.rs @@ -65,16 +65,16 @@ fn tm_to_time(tm: &Tm) -> i64 { + s } -pub fn time_to_local_tm(sec: i64, tm: &mut Tm) { +pub(super) fn time_to_local_tm(sec: i64, tm: &mut Tm) { // FIXME: Add timezone logic time_to_tm(sec, tm); } -pub fn utc_tm_to_time(tm: &Tm) -> i64 { +pub(super) fn utc_tm_to_time(tm: &Tm) -> i64 { tm_to_time(tm) } -pub fn local_tm_to_time(tm: &Tm) -> i64 { +pub(super) fn local_tm_to_time(tm: &Tm) -> i64 { // FIXME: Add timezone logic tm_to_time(tm) } From 980a6cda26d2b829e325f00d27b974f3c285e56c Mon Sep 17 00:00:00 2001 From: "Ethan D. Twardy" Date: Thu, 12 May 2022 06:17:39 -0500 Subject: [PATCH 6/7] Ensure installed toolchain is default for wasm_simple CI test This fix is a hunch based on issue #210 of actions-rs/toolchain --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 708b6e50f4..88d8287573 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -102,6 +102,7 @@ jobs: toolchain: stable target: wasm32-unknown-unknown override: true + default: true - uses: Swatinem/rust-cache@v1 - name: Install node From 7235f85429d05e70c4da6359eb022ba806c56531 Mon Sep 17 00:00:00 2001 From: "Ethan D. Twardy" Date: Thu, 12 May 2022 06:48:14 -0500 Subject: [PATCH 7/7] Revert "Ensure installed toolchain is default for wasm_simple CI test" This reverts commit 980a6cda26d2b829e325f00d27b974f3c285e56c. Since this commit didn't have the intended effect on the CI test, I've reverted it. --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 88d8287573..708b6e50f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -102,7 +102,6 @@ jobs: toolchain: stable target: wasm32-unknown-unknown override: true - default: true - uses: Swatinem/rust-cache@v1 - name: Install node