Skip to content

Commit

Permalink
Fix "can't leak crate-private type in stub.rs" #662 (#684)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AmateurECE committed May 12, 2022
1 parent 4333e39 commit 7097f93
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions ci/github.sh
Expand Up @@ -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
Expand Down Expand Up @@ -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 "$@"
6 changes: 3 additions & 3 deletions src/offset/sys/stub.rs
Expand Up @@ -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)
}

0 comments on commit 7097f93

Please sign in to comment.