Skip to content

Commit b61b5ed

Browse files
authored
Merge pull request #28 from frengor/dev
* 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
2 parents f47fb5e + 6acdf24 commit b61b5ed

File tree

17 files changed

+646
-346
lines changed

17 files changed

+646
-346
lines changed

.github/workflows/miri.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ env:
77
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
88

99
jobs:
10-
test-with-miri:
10+
test-with-miri-stable:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
@@ -24,5 +24,19 @@ jobs:
2424
- name: Run tests
2525
# Keep "std" feature always enabled here to avoid needing the no-std related nightly features
2626
run: cargo hack miri test --feature-powerset --skip nightly,derive --verbose -F std,pedantic-debug-assertions
27+
test-with-miri-nightly:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
# From Miri documentation: https://github.com/rust-lang/miri#running-miri-on-ci
32+
- name: Install Miri
33+
run: |
34+
rustup toolchain install nightly --component miri
35+
rustup override set nightly
36+
cargo miri setup
37+
- uses: taiki-e/install-action@cargo-hack
38+
# Always skip "derive" since derive macro tests are skipped on Miri
39+
# Also always keep "pedantic-debug-assertions" enabled to reduce build times
40+
# Note: no need to use --workspace here, since there's no unsafe in rust-cc-derive
2741
- name: Run tests (nightly)
2842
run: cargo hack miri test --feature-powerset --skip derive --verbose -F nightly,pedantic-debug-assertions

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ Therefore, they undergo two tracing passes:
4141
Note that this second phase is correct only if the graph formed by the pointers is not changed between the two phases. Thus,
4242
this is a key requirement of the `Trace` trait and one of the reasons it is marked `unsafe`.
4343

44-
# Writing documentation
44+
## Writing tests
45+
46+
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.
47+
48+
Also, functions marked as `pub(crate)` and used only in unit tests should have the `for_tests` suffix, like `Cc::new_for_tests`.
49+
50+
## Writing documentation
4551

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

Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ edition.workspace = true
1414
members = ["derive"]
1515

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

3939
# Enables weak pointers
40-
weak-ptr = []
40+
weak-ptrs = []
4141

4242
# Enables cleaners
43-
cleaners = ["dep:slotmap", "weak-ptr"]
43+
cleaners = ["dep:slotmap", "weak-ptrs"]
4444

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

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

@@ -64,6 +64,9 @@ name = "bench"
6464
harness = false
6565
required-features = ["std", "derive"]
6666

67+
[lints.rust]
68+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_auto_cfg)'] }
69+
6770
[package.metadata.docs.rs]
6871
all-features = true
6972
rustdoc-args = ["--cfg", "doc_auto_cfg", "--generate-link-to-definition"]

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ impl Finalize for Data {
6363
}
6464
```
6565

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

7368
## The collection algorithm

0 commit comments

Comments
 (0)