From 7097f933eb16d4fa5bb94b2a44e7d69c62af755d Mon Sep 17 00:00:00 2001 From: Ethan D Twardy Date: Thu, 12 May 2022 07:45:47 -0500 Subject: [PATCH] Fix "can't leak crate-private type in stub.rs" #662 (#684) First attempt to fix this issue for wasm32-unknown-* targets by changing visibility of functions not to leak crate-private types. Ensure the default toolchain is used for the wasm_unknown CI test. --- .github/workflows/test.yml | 24 ++++++++++++++++++++++++ ci/github.sh | 6 ++++++ src/offset/sys/stub.rs | 6 +++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b32c9f47f4..708b6e50f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -149,6 +149,30 @@ 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 + default: 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 "$@" 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) }