Skip to content

Commit

Permalink
tests: Test size of public types
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Feb 5, 2025
1 parent 18336de commit 306b4a2
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 324 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ jobs:
- uses: taiki-e/install-action@cargo-minimal-versions
- uses: taiki-e/install-action@cargo-careful
if: matrix.rust == 'nightly'
- run: cargo test --workspace --all-features ${EXCLUDE} --tests --no-run
if: matrix.rust != 'nightly'
- run: cargo test --workspace --all-features ${EXCLUDE} --no-run
- run: cargo test --workspace --all-features ${EXCLUDE}
if: matrix.rust == 'nightly'
- run: cargo careful test --workspace --all-features ${EXCLUDE}
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pin-project = "1.0.11"
futures = { package = "futures-util", version = "0.3", default-features = false }
rustversion = "1"
static_assertions = "1"
test-helper = { features = ["git"], git = "https://github.com/taiki-e/test-helper.git", rev = "e8333e1" }
trybuild = { git = "https://github.com/taiki-e/trybuild.git", branch = "dev" } # adjust overwrite behavior

[lints]
Expand All @@ -52,6 +53,7 @@ non_ascii_idents = "warn"
rust_2018_idioms = "warn"
single_use_lifetimes = "warn"
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(careful)',
] }
unnameable_types = "warn"
unreachable_pub = "warn"
Expand Down
4 changes: 4 additions & 0 deletions src/gen/tests/assert_impl.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions src/gen/tests/track_size.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/gen/tests/track_size.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ mod tests;
#[cfg(test)]
#[path = "gen/tests/assert_impl.rs"]
mod assert_impl;
#[cfg(test)]
#[path = "gen/tests/track_size.rs"]
mod track_size;

#[doc(inline)]
pub use futures_async_stream_macro::for_await;
Expand Down Expand Up @@ -340,6 +343,10 @@ mod future {
// SAFETY: see `Send` impl
unsafe impl Sync for ResumeTy {}

// Needed to work around old nightly bug (fixed in nightly-2024-05-24 by https://github.com/rust-lang/rust/pull/125392)
impl core::panic::UnwindSafe for ResumeTy {}
impl core::panic::RefUnwindSafe for ResumeTy {}

/// Wrap a coroutine in a future.
///
/// This function returns a `GenFuture` underneath, but hides it in `impl Trait` to give
Expand Down
5 changes: 2 additions & 3 deletions tools/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ fs-err = "3"
globset = { version = "0.4", default-features = false }
prettyplease = "0.2"
proc-macro2 = { version = "1", default-features = false }
quote = { version = "1", default-features = false }
syn = { version = "2", default-features = false, features = ["parsing", "printing", "full", "visit-mut"] }
test-helper = { features = ["git"], git = "https://github.com/taiki-e/test-helper.git", rev = "295ad29" }
syn = { version = "2", default-features = false, features = ["parsing", "printing", "full"] }
test-helper = { features = ["codegen"], git = "https://github.com/taiki-e/test-helper.git", rev = "e8333e1" }

[lints]
workspace = true
Loading

0 comments on commit 306b4a2

Please sign in to comment.