Skip to content

Commit

Permalink
Merge pull request #28 from frengor/dev
Browse files Browse the repository at this point in the history
* Update version to 0.4.0
* Improve the ergonomics of weak pointers
  * Remove `Weakable` and `WeakableCc`
  * Add `Weak::new()`
  * Rename `weak-ptr` feature to `weak-ptrs`
* Implement common traits like `Display`, `PartialEq`, `Eq`, `Hash`, etc.
* Code clean up and smaller improvements
  • Loading branch information
frengor authored Jul 29, 2024
2 parents f47fb5e + 6acdf24 commit b61b5ed
Show file tree
Hide file tree
Showing 17 changed files with 646 additions and 346 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/miri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

jobs:
test-with-miri:
test-with-miri-stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -24,5 +24,19 @@ jobs:
- name: Run tests
# Keep "std" feature always enabled here to avoid needing the no-std related nightly features
run: cargo hack miri test --feature-powerset --skip nightly,derive --verbose -F std,pedantic-debug-assertions
test-with-miri-nightly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# From Miri documentation: https://github.com/rust-lang/miri#running-miri-on-ci
- name: Install Miri
run: |
rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup
- uses: taiki-e/install-action@cargo-hack
# Always skip "derive" since derive macro tests are skipped on Miri
# Also always keep "pedantic-debug-assertions" enabled to reduce build times
# Note: no need to use --workspace here, since there's no unsafe in rust-cc-derive
- name: Run tests (nightly)
run: cargo hack miri test --feature-powerset --skip derive --verbose -F nightly,pedantic-debug-assertions
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ Therefore, they undergo two tracing passes:
Note that this second phase is correct only if the graph formed by the pointers is not changed between the two phases. Thus,
this is a key requirement of the `Trace` trait and one of the reasons it is marked `unsafe`.

# Writing documentation
## Writing tests

Every unit test should start with a call to `tests::reset_state()` to make sure errors in other tests don't impact the current one.

Also, functions marked as `pub(crate)` and used only in unit tests should have the `for_tests` suffix, like `Cc::new_for_tests`.

## Writing documentation

Docs are always built with every feature enabled. This makes it easier to write and maintain the documentation.

Expand Down
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ edition.workspace = true
members = ["derive"]

[workspace.package]
version = "0.3.0" # Also update in [dependencies.rust-cc-derive.version]
version = "0.4.0" # Also update in [dependencies.rust-cc-derive.version]
authors = ["fren_gor <goro@frengor.com>"]
repository = "https://github.com/frengor/rust-cc"
categories = ["memory-management", "no-std"]
Expand All @@ -37,10 +37,10 @@ auto-collect = []
finalization = []

# Enables weak pointers
weak-ptr = []
weak-ptrs = []

# Enables cleaners
cleaners = ["dep:slotmap", "weak-ptr"]
cleaners = ["dep:slotmap", "weak-ptrs"]

# Enables support for stdlib, disable for no-std support (requires ELF TLS and nightly)
std = ["slotmap?/std", "thiserror/std"]
Expand All @@ -49,7 +49,7 @@ std = ["slotmap?/std", "thiserror/std"]
pedantic-debug-assertions = []

[dependencies]
rust-cc-derive = { path = "./derive", version = "=0.3.0", optional = true }
rust-cc-derive = { path = "./derive", version = "=0.4.0", optional = true }
slotmap = { version = "1.0", optional = true }
thiserror = { version = "1.0", package = "thiserror-core", default-features = false }

Expand All @@ -64,6 +64,9 @@ name = "bench"
harness = false
required-features = ["std", "derive"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_auto_cfg)'] }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "doc_auto_cfg", "--generate-link-to-definition"]
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ impl Finalize for Data {
}
```

> [!NOTE]
> Finalization adds an overhead to each collection execution. Cleaners provide a faster alternative to finalization.
>
> *When possible*, it's suggested to prefer cleaners and disable finalization.
For more information read [the docs](https://docs.rs/rust-cc/latest/rust_cc/).

## The collection algorithm
Expand Down
Loading

0 comments on commit b61b5ed

Please sign in to comment.