Skip to content

Commit e6899b5

Browse files
kpreidcwfitzgerald
authored andcommitted
Add WriteOnly type.
`WriteOnly<'a, T>` is a custom smart pointer which is stricter than `&'a mut [T]` in that it only allows writing data and not reading it. This will be part of the fix for <gfx-rs#8897>. This commit only introduces the public type and does not use it.
1 parent c1f4d0c commit e6899b5

3 files changed

Lines changed: 1185 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,41 @@ jobs:
743743
744744
cargo --locked test --doc
745745
746+
miri:
747+
# runtime is normally 2 minutes
748+
timeout-minutes: 10
749+
750+
name: Miri (limited scope)
751+
runs-on: ubuntu-latest
752+
753+
steps:
754+
- name: Checkout repo
755+
uses: actions/checkout@v6
756+
757+
# Miri is *only* available on nightly.
758+
- name: Install nightly toolchain
759+
760+
run: |
761+
rustup toolchain install nightly --no-self-update --profile=minimal --component miri
762+
rustup override set nightly
763+
cargo -V
764+
765+
- name: Caching
766+
uses: Swatinem/rust-cache@v2
767+
with:
768+
key: miri-${{ env.CACHE_SUFFIX }}
769+
770+
- name: Run Miri on selected tests
771+
shell: bash
772+
run: |
773+
set -e
774+
775+
# Note: this is a *smaller* set of tests than `cargo xtask miri` runs;
776+
# it is ones that are both important and cheap.
777+
# Consider expanding it to include some API tests with the noop backend.
778+
cargo miri test --package=wgpu --no-default-features -- write_only
779+
780+
746781
fmt:
747782
# runtime is normally 15 seconds
748783
timeout-minutes: 2

wgpu/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
#![cfg_attr(not(any(wgpu_core, webgpu)), allow(unused))]
9797

9898
extern crate alloc;
99-
#[cfg(std)]
99+
#[cfg(any(std, test))]
100100
extern crate std;
101101
#[cfg(wgpu_core)]
102102
pub extern crate wgpu_core as wgc;
@@ -116,6 +116,7 @@ mod cmp;
116116
mod dispatch;
117117
mod macros;
118118
pub mod util;
119+
mod write_only;
119120

120121
//
121122
//
@@ -155,6 +156,7 @@ pub use wgt::{
155156
MAXIMUM_SUBGROUP_MAX_SIZE, MINIMUM_SUBGROUP_MIN_SIZE, QUERY_RESOLVE_BUFFER_ALIGNMENT,
156157
QUERY_SET_MAX_QUERIES, QUERY_SIZE, VERTEX_ALIGNMENT,
157158
};
159+
pub use write_only::{WriteOnly, WriteOnlyIter};
158160

159161
#[expect(deprecated)]
160162
pub use wgt::VERTEX_STRIDE_ALIGNMENT;

0 commit comments

Comments
 (0)