Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store StreamWrapper::inner as a raw pointer #394

Merged
merged 1 commit into from
Jan 27, 2024
Merged

Conversation

icmccorm
Copy link
Contributor

@icmccorm icmccorm commented Jan 8, 2024

Fixes #392.

Storing and accessing StreamWrapper as a raw pointer fixes a tree borrows violation and removes the need for implementations of Deref and DerefMut.

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your help!

Since this code deals with unsafe a lot, reviewing it isn't easy and I can imagine that my requests might be tedious. If so, writing down the invariants on the inner field would already help and I might be able to take it from there.

Please note that generally it would be great to have a safety block above each unsafe, but maybe it isn't particularly common in ffi code either. I am definitely open to pushback if my requests are unreasonable, but would hope for a compromise that would help me to have a better feeling about the unsafe usage, other than "it worked before, it should still work, right?".

Please note that this review is my attempt to treat unsafe a little bit like it was treated here, but it is apprentice-level at best 😅.

src/ffi/c.rs Outdated Show resolved Hide resolved
src/ffi/c.rs Outdated Show resolved Hide resolved
src/ffi/c.rs Show resolved Hide resolved
src/ffi/c.rs Show resolved Hide resolved
@icmccorm
Copy link
Contributor Author

icmccorm commented Jan 9, 2024

I'll follow up with better documentation—thanks for pointing me in the right direction!

Since this code deals with unsafe a lot, reviewing it isn't easy

My decision to remove Deref and DerefMut introduced unsafe everywhere that inner needs to be accessed, but the invariants related to inner only apply in certain situations. It can be unsound to mutably borrow inner, pass that borrow as a pointer into a foreign call, and then use the same borrow again, since it may have become invalid during the foreign call. Because of this, I decided it would be best to make accessing inner unsafe in any situation instead of providing implementations of Deref and DerefMut that are not always sound. I'm thinking of adding the following note everywhere that inner is borrowed.

/// SAFETY: The field `StreamWrapper::inner` is a pointer to a cyclic structure, so any mutable 
/// borrows against it can become invalidated by foreign function calls that mutate this 
/// structure. This borrow is safe, since it is not used after the call returns. 

Actually, now that I'm thinking of it, it might be sound to leave the implementation of Deref, but require unsafe for mutable borrows. I'll test that out and follow up with my next changes.

…olation.

Removed Deref and DerefMut implementations for StreamWrapper.
@icmccorm
Copy link
Contributor Author

This should be ready to go, unless you'd like any other changes to documentation. I think Deref has the same potential soundness issues as DerefMut under Tree Borrows, so it's best to remove both traits.

Copy link
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your perseverance, it's much appreciated.

Everything looks good to me, but I am asking for another review just to be even more sure.

If it doesn't happen within a week, maybe you could ping me here so this PR gets merged anyway, after all it does seem to fix a soundness issue.

Copy link
Member

@Nilstrieb Nilstrieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me. Bit of a shame to need all of these unsafe blocks when really the unsafety should be asserted in exactly one place^^, but unfortunately Rust doesn't provide any mechanism to do that :(

@Byron
Copy link
Member

Byron commented Jan 27, 2024

Thanks @Nilstrieb for the additional review, and thanks again to @icmccorm for your contribution!

@Byron Byron merged commit 0a584f4 into rust-lang:main Jan 27, 2024
10 checks passed
renovate bot added a commit to gitext-rs/git-dive that referenced this pull request May 1, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [anyhow](https://togithub.com/dtolnay/anyhow) | dependencies | patch |
`1.0.81` -> `1.0.82` |
| [encoding_rs](https://docs.rs/encoding_rs/)
([source](https://togithub.com/hsivonen/encoding_rs)) | dependencies |
patch | `0.8.33` -> `0.8.34` |
| [flate2](https://togithub.com/rust-lang/flate2-rs) | dependencies |
patch | `1.0.28` -> `1.0.30` |
| [serde](https://serde.rs)
([source](https://togithub.com/serde-rs/serde)) | dependencies | patch |
`1.0.197` -> `1.0.199` |

---

### Release Notes

<details>
<summary>dtolnay/anyhow (anyhow)</summary>

### [`v1.0.82`](https://togithub.com/dtolnay/anyhow/releases/tag/1.0.82)

[Compare
Source](https://togithub.com/dtolnay/anyhow/compare/1.0.81...1.0.82)

-   Documentation improvements

</details>

<details>
<summary>hsivonen/encoding_rs (encoding_rs)</summary>

###
[`v0.8.34`](https://togithub.com/hsivonen/encoding_rs/compare/v0.8.33...v0.8.34)

[Compare
Source](https://togithub.com/hsivonen/encoding_rs/compare/v0.8.33...v0.8.34)

</details>

<details>
<summary>rust-lang/flate2-rs (flate2)</summary>

###
[`v1.0.30`](https://togithub.com/rust-lang/flate2-rs/releases/tag/1.0.30):
- docs.rs pages should build again

[Compare
Source](https://togithub.com/rust-lang/flate2-rs/compare/1.0.29...1.0.30)

#### What's Changed

- Fix typos by [@&#8203;striezel](https://togithub.com/striezel) in
[rust-lang/flate2-rs#406
- Update actions/checkout in GitHub Actions workflows to v4 by
[@&#8203;striezel](https://togithub.com/striezel) in
[rust-lang/flate2-rs#407
- fix CI - `--all-features` wasn't tested and didn't work with arrival
of `zlib-rs` by [@&#8203;Byron](https://togithub.com/Byron) in
[rust-lang/flate2-rs#405

#### New Contributors

- [@&#8203;striezel](https://togithub.com/striezel) made their first
contribution in
[rust-lang/flate2-rs#406

**Full Changelog**:
rust-lang/flate2-rs@1.0.29...1.0.30

###
[`v1.0.29`](https://togithub.com/rust-lang/flate2-rs/releases/tag/1.0.29):
- with new `zlib-rs` feature (~`zlib-ng` in Rust)

[Compare
Source](https://togithub.com/rust-lang/flate2-rs/compare/1.0.28...1.0.29)

With the [new `zlib-rs`](https://togithub.com/memorysafety/zlib-rs)
feature, a new backend is enabled that brings in a SIMD-accelerated Rust
implementation.

#### What's Changed

- Fix build for beta and nightly by
[@&#8203;JakubOnderka](https://togithub.com/JakubOnderka) in
[rust-lang/flate2-rs#388
- Store `StreamWrapper::inner` as a raw pointer by
[@&#8203;icmccorm](https://togithub.com/icmccorm) in
[rust-lang/flate2-rs#394
- Avoid redudant imports by [@&#8203;Byron](https://togithub.com/Byron)
in
[rust-lang/flate2-rs#398
- add `zlib-rs` support via the `libz-rs-sys` C api for `zlib-rs` by
[@&#8203;folkertdev](https://togithub.com/folkertdev) in
[rust-lang/flate2-rs#400
- Add tests to show BufRead can be used after decoding by
[@&#8203;jongiddy](https://togithub.com/jongiddy) in
[rust-lang/flate2-rs#402
- release version 1.0.29: support for zlib-rs by
[@&#8203;folkertdev](https://togithub.com/folkertdev) in
[rust-lang/flate2-rs#403

#### New Contributors

- [@&#8203;JakubOnderka](https://togithub.com/JakubOnderka) made their
first contribution in
[rust-lang/flate2-rs#388
- [@&#8203;icmccorm](https://togithub.com/icmccorm) made their first
contribution in
[rust-lang/flate2-rs#394
- [@&#8203;folkertdev](https://togithub.com/folkertdev) made their first
contribution in
[rust-lang/flate2-rs#400

**Full Changelog**:
rust-lang/flate2-rs@1.0.28...1.0.29

</details>

<details>
<summary>serde-rs/serde (serde)</summary>

###
[`v1.0.199`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.199)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.198...v1.0.199)

- Fix ambiguous associated item when `forward_to_deserialize_any!` is
used on an enum with `Error` variant
([#&#8203;2732](https://togithub.com/serde-rs/serde/issues/2732), thanks
[@&#8203;aatifsyed](https://togithub.com/aatifsyed))

###
[`v1.0.198`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.198)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.197...v1.0.198)

- Support serializing and deserializing `Saturating<T>`
([#&#8203;2709](https://togithub.com/serde-rs/serde/issues/2709), thanks
[@&#8203;jbethune](https://togithub.com/jbethune))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 5am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/gitext-rs/git-dive).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMjEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjMyMS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
bors added a commit to rust-lang/cargo that referenced this pull request May 1, 2024
chore(deps): update compatible

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [annotate-snippets](https://togithub.com/rust-lang/annotate-snippets-rs) | workspace.dependencies | patch | `0.11.1` -> `0.11.2` |
| [anyhow](https://togithub.com/dtolnay/anyhow) | workspace.dependencies | patch | `1.0.81` -> `1.0.82` |
| [base64](https://togithub.com/marshallpierce/rust-base64) | workspace.dependencies | patch | `0.22.0` -> `0.22.1` |
| [color-print](https://gitlab.com/dajoha/color-print) | workspace.dependencies | patch | `0.3.5` -> `0.3.6` |
| [flate2](https://togithub.com/rust-lang/flate2-rs) | workspace.dependencies | patch | `1.0.28` -> `1.0.30` |
| [indexmap](https://togithub.com/indexmap-rs/indexmap) | workspace.dependencies | patch | `2` -> `2.2.6` |
| [jobserver](https://togithub.com/rust-lang/jobserver-rs) | workspace.dependencies | patch | `0.1.28` -> `0.1.31` |
| [libc](https://togithub.com/rust-lang/libc) | workspace.dependencies | patch | `0.2.153` -> `0.2.154` |
| [pathdiff](https://togithub.com/Manishearth/pathdiff) | workspace.dependencies | patch | `0.2` -> `0.2.1` |
| [percent-encoding](https://togithub.com/servo/rust-url) | workspace.dependencies | patch | `2.3` -> `2.3.1` |
| [pulldown-cmark](https://togithub.com/raphlinus/pulldown-cmark) | workspace.dependencies | patch | `0.10.2` -> `0.10.3` |
| [serde](https://serde.rs) ([source](https://togithub.com/serde-rs/serde)) | workspace.dependencies | patch | `1.0.197` -> `1.0.199` |
| [serde_json](https://togithub.com/serde-rs/json) | workspace.dependencies | patch | `1.0.115` -> `1.0.116` |
| [thiserror](https://togithub.com/dtolnay/thiserror) | workspace.dependencies | patch | `1.0.58` -> `1.0.59` |
| [time](https://time-rs.github.io) ([source](https://togithub.com/time-rs/time)) | workspace.dependencies | patch | `0.3` -> `0.3.36` |
| [toml_edit](https://togithub.com/toml-rs/toml) | workspace.dependencies | patch | `0.22.11` -> `0.22.12` |
| [unicode-width](https://togithub.com/unicode-rs/unicode-width) | workspace.dependencies | patch | `0.1.11` -> `0.1.12` |

---

### Release Notes

<details>
<summary>rust-lang/annotate-snippets-rs (annotate-snippets)</summary>

### [`v0.11.2`](https://togithub.com/rust-lang/annotate-snippets-rs/blob/HEAD/CHANGELOG.md#0112---2024-04-27)

[Compare Source](https://togithub.com/rust-lang/annotate-snippets-rs/compare/0.11.1...0.11.2)

##### Added

-   All public types now implement `Debug` [#&#8203;119](https://togithub.com/rust-lang/annotate-snippets-rs/pull/119)

</details>

<details>
<summary>dtolnay/anyhow (anyhow)</summary>

### [`v1.0.82`](https://togithub.com/dtolnay/anyhow/releases/tag/1.0.82)

[Compare Source](https://togithub.com/dtolnay/anyhow/compare/1.0.81...1.0.82)

-   Documentation improvements

</details>

<details>
<summary>marshallpierce/rust-base64 (base64)</summary>

### [`v0.22.1`](https://togithub.com/marshallpierce/rust-base64/blob/HEAD/RELEASE-NOTES.md#0221)

[Compare Source](https://togithub.com/marshallpierce/rust-base64/compare/v0.22.0...v0.22.1)

-   Correct the symbols used for the predefined `alphabet::BIN_HEX`.

</details>

<details>
<summary>dajoha/color-print (color-print)</summary>

### [`v0.3.6`](https://gitlab.com/dajoha/color-print/compare/v0.3.5...v0.3.6)

[Compare Source](https://gitlab.com/dajoha/color-print/compare/v0.3.5...v0.3.6)

</details>

<details>
<summary>rust-lang/flate2-rs (flate2)</summary>

### [`v1.0.30`](https://togithub.com/rust-lang/flate2-rs/releases/tag/1.0.30): - docs.rs pages should build again

[Compare Source](https://togithub.com/rust-lang/flate2-rs/compare/1.0.29...1.0.30)

##### What's Changed

-   Fix typos by [`@&#8203;striezel](https://togithub.com/striezel)` in [rust-lang/flate2-rs#406
-   Update actions/checkout in GitHub Actions workflows to v4 by [`@&#8203;striezel](https://togithub.com/striezel)` in [rust-lang/flate2-rs#407
-   fix CI - `--all-features` wasn't tested and didn't work with arrival of `zlib-rs` by [`@&#8203;Byron](https://togithub.com/Byron)` in [rust-lang/flate2-rs#405

##### New Contributors

-   [`@&#8203;striezel](https://togithub.com/striezel)` made their first contribution in [rust-lang/flate2-rs#406

**Full Changelog**: rust-lang/flate2-rs@1.0.29...1.0.30

### [`v1.0.29`](https://togithub.com/rust-lang/flate2-rs/releases/tag/1.0.29): - with new `zlib-rs` feature (~`zlib-ng` in Rust)

[Compare Source](https://togithub.com/rust-lang/flate2-rs/compare/1.0.28...1.0.29)

With the [new `zlib-rs`](https://togithub.com/memorysafety/zlib-rs) feature, a new backend is enabled that brings in a SIMD-accelerated Rust implementation.

##### What's Changed

-   Fix build for beta and nightly by [`@&#8203;JakubOnderka](https://togithub.com/JakubOnderka)` in [rust-lang/flate2-rs#388
-   Store `StreamWrapper::inner` as a raw pointer by [`@&#8203;icmccorm](https://togithub.com/icmccorm)` in [rust-lang/flate2-rs#394
-   Avoid redudant imports by [`@&#8203;Byron](https://togithub.com/Byron)` in [rust-lang/flate2-rs#398
-   add `zlib-rs` support via the `libz-rs-sys` C api for `zlib-rs` by [`@&#8203;folkertdev](https://togithub.com/folkertdev)` in [rust-lang/flate2-rs#400
-   Add tests to show BufRead can be used after decoding by [`@&#8203;jongiddy](https://togithub.com/jongiddy)` in [rust-lang/flate2-rs#402
-   release version 1.0.29: support for zlib-rs by [`@&#8203;folkertdev](https://togithub.com/folkertdev)` in [rust-lang/flate2-rs#403

##### New Contributors

-   [`@&#8203;JakubOnderka](https://togithub.com/JakubOnderka)` made their first contribution in [rust-lang/flate2-rs#388
-   [`@&#8203;icmccorm](https://togithub.com/icmccorm)` made their first contribution in [rust-lang/flate2-rs#394
-   [`@&#8203;folkertdev](https://togithub.com/folkertdev)` made their first contribution in [rust-lang/flate2-rs#400

**Full Changelog**: rust-lang/flate2-rs@1.0.28...1.0.29

</details>

<details>
<summary>rust-lang/libc (libc)</summary>

### [`v0.2.154`](https://togithub.com/rust-lang/libc/releases/tag/0.2.154)

[Compare Source](https://togithub.com/rust-lang/libc/compare/0.2.153...0.2.154)

#### What's Changed

-   Fix CI on v0.2 by [`@&#8203;JohnTitor](https://togithub.com/JohnTitor)` in [rust-lang/libc#3589
-   \[Backport [#&#8203;3547](https://togithub.com/rust-lang/libc/issues/3547)] Add ioctl FS_IOC\_{G,S}{ETVERSION,ETFLAGS} for CSKY by [`@&#8203;Dirreke](https://togithub.com/Dirreke)` in [rust-lang/libc#3572
-   Add Linux riscv64 HWCAP defines (libc-0.2) by [`@&#8203;Xeonacid](https://togithub.com/Xeonacid)` in [rust-lang/libc#3580
-   Add missing MIPS R6 FS_IOC_\* definitions by [`@&#8203;chenx97](https://togithub.com/chenx97)` in [rust-lang/libc#3591
-   Support posix_spawn on Android by [`@&#8203;pcc](https://togithub.com/pcc)` in [rust-lang/libc#3602
-   \[0.2] Fix libc-tests for loongarch64 by [`@&#8203;heiher](https://togithub.com/heiher)` in [rust-lang/libc#3607
-   visionOS Support by [`@&#8203;agg23](https://togithub.com/agg23)` in [rust-lang/libc#3568
-   \[0.2] linux/musl: Add support for LoongArch64 by [`@&#8203;heiher](https://togithub.com/heiher)` in [rust-lang/libc#3606
-   v0.2: Fix c_char on AIX by [`@&#8203;taiki-e](https://togithub.com/taiki-e)` in [rust-lang/libc#3662
-   solarish adding SO_EXCLBIND constant. by [`@&#8203;devnexen](https://togithub.com/devnexen)` in [rust-lang/libc#3651
-   \[0.2] Add SIG constants to espidf by [`@&#8203;Tevz-Beskovnik](https://togithub.com/Tevz-Beskovnik)` in [rust-lang/libc#3658
-   add all android sysconf constants by [`@&#8203;fkm3](https://togithub.com/fkm3)` in [rust-lang/libc#3656
-   feat: more \_PC_XXX constants for apple targets by [`@&#8203;SteveLauC](https://togithub.com/SteveLauC)` in [rust-lang/libc#3649
-   feat: O_EXEC/O_SEARCH for apple platforms by [`@&#8203;SteveLauC](https://togithub.com/SteveLauC)` in [rust-lang/libc#3668
-   \[0.2] Add constant AT_MINSIGSTKSZ by [`@&#8203;ur4t](https://togithub.com/ur4t)` in [rust-lang/libc#3637
-   Haiku: synchronize with post R1-beta 4 changes in libc by [`@&#8203;nielx](https://togithub.com/nielx)` in [rust-lang/libc#3638
-   adding getentropy/getrandom to dragonflybsd. by [`@&#8203;devnexen](https://togithub.com/devnexen)` in [rust-lang/libc#3618
-   Move strftime, strftime_l, strptime to linux_like by [`@&#8203;pcc](https://togithub.com/pcc)` in [rust-lang/libc#3600
-   update crate version to 0.2.154 by [`@&#8203;Dirreke](https://togithub.com/Dirreke)` in [rust-lang/libc#3573

#### New Contributors

-   [`@&#8203;pcc](https://togithub.com/pcc)` made their first contribution in [rust-lang/libc#3602
-   [`@&#8203;agg23](https://togithub.com/agg23)` made their first contribution in [rust-lang/libc#3568
-   [`@&#8203;Tevz-Beskovnik](https://togithub.com/Tevz-Beskovnik)` made their first contribution in [rust-lang/libc#3658
-   [`@&#8203;ur4t](https://togithub.com/ur4t)` made their first contribution in [rust-lang/libc#3637

**Full Changelog**: rust-lang/libc@0.2.153...0.2.154

</details>

<details>
<summary>raphlinus/pulldown-cmark (pulldown-cmark)</summary>

### [`v0.10.3`](https://togithub.com/pulldown-cmark/pulldown-cmark/releases/tag/v0.10.3)

[Compare Source](https://togithub.com/raphlinus/pulldown-cmark/compare/v0.10.2...v0.10.3)

The main change of this release is the `simd` feature was not being used in the escape functions  since the version 0.10 due to a mistake during the separation of the crate `pulldown-cmark-escape`.

The crate `pulldown-cmark-escape` has been updated to the version 0.10.1.

#### What's Changed

-   fix: fix dead code warning from nightly compiler by [`@&#8203;rhysd](https://togithub.com/rhysd)` in [pulldown-cmark/pulldown-cmark#876
-   Eat all spaces after line break in link title by [`@&#8203;notriddle](https://togithub.com/notriddle)` in [pulldown-cmark/pulldown-cmark#877
-   Mark `Rule` as a block item by [`@&#8203;notriddle](https://togithub.com/notriddle)` in [pulldown-cmark/pulldown-cmark#879

**Full Changelog**: pulldown-cmark/pulldown-cmark@v0.10.2...v0.10.3

</details>

<details>
<summary>serde-rs/serde (serde)</summary>

### [`v1.0.199`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.199)

[Compare Source](https://togithub.com/serde-rs/serde/compare/v1.0.198...v1.0.199)

-   Fix ambiguous associated item when `forward_to_deserialize_any!` is used on an enum with `Error` variant ([#&#8203;2732](https://togithub.com/serde-rs/serde/issues/2732), thanks [`@&#8203;aatifsyed](https://togithub.com/aatifsyed))`

### [`v1.0.198`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.198)

[Compare Source](https://togithub.com/serde-rs/serde/compare/v1.0.197...v1.0.198)

-   Support serializing and deserializing `Saturating<T>` ([#&#8203;2709](https://togithub.com/serde-rs/serde/issues/2709), thanks [`@&#8203;jbethune](https://togithub.com/jbethune))`

</details>

<details>
<summary>serde-rs/json (serde_json)</summary>

### [`v1.0.116`](https://togithub.com/serde-rs/json/releases/tag/v1.0.116)

[Compare Source](https://togithub.com/serde-rs/json/compare/v1.0.115...v1.0.116)

-   Make module structure comprehensible to static analysis ([#&#8203;1124](https://togithub.com/serde-rs/json/issues/1124), thanks [`@&#8203;mleonhard](https://togithub.com/mleonhard))`

</details>

<details>
<summary>dtolnay/thiserror (thiserror)</summary>

### [`v1.0.59`](https://togithub.com/dtolnay/thiserror/releases/tag/1.0.59)

[Compare Source](https://togithub.com/dtolnay/thiserror/compare/1.0.58...1.0.59)

-   Unblock testing of rustc `debug-fmt-detail` option ([#&#8203;297](https://togithub.com/dtolnay/thiserror/issues/297))

</details>

<details>
<summary>time-rs/time (time)</summary>

### [`v0.3.36`](https://togithub.com/time-rs/time/blob/HEAD/CHANGELOG.md#0336-2024-04-10)

[Compare Source](https://togithub.com/time-rs/time/compare/v0.3.35...v0.3.36)

##### # Fixed

-   `FormatItem` can be used as part of an import path. See [#&#8203;675] for details.

[#&#8203;675]: https://togithub.com/time-rs/time/issues/675

### [`v0.3.35`](https://togithub.com/time-rs/time/blob/HEAD/CHANGELOG.md#0335-2024-04-10)

[Compare Source](https://togithub.com/time-rs/time/compare/v0.3.34...v0.3.35)

##### Added

-   `Duration::checked_neg`
-   `ext::InstantExt`, which provides methods for using `time::Duration` with `std::time::Instant`

##### Changed

-   `Instant` is deprecated. It is recommended to use `std::time::Instant` directly, importing
    `time::ext::InstantExt` for interoperability with `time::Duration`.
-   `FormatItem` has been renamed to `BorrowedFormatItem`, avoiding confusion with `OwnedFormatItem`.
    An alias has been added for backwards compatibility.

##### Fixed

-   The weekday is optional when parsing RFC2822.
-   The range of sub-second values in `Duration` is documented correctly. The previous documentation
    contained an off-by-one error.
-   Leap seconds are now correctly handled when parsing ISO 8601.

</details>

<details>
<summary>toml-rs/toml (toml_edit)</summary>

### [`v0.22.12`](https://togithub.com/toml-rs/toml/compare/v0.22.11...v0.22.12)

[Compare Source](https://togithub.com/toml-rs/toml/compare/v0.22.11...v0.22.12)

</details>

<details>
<summary>unicode-rs/unicode-width (unicode-width)</summary>

### [`v0.1.12`](https://togithub.com/unicode-rs/unicode-width/compare/v0.1.11...v0.1.12)

[Compare Source](https://togithub.com/unicode-rs/unicode-width/compare/v0.1.11...v0.1.12)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 5am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/rust-lang/cargo).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMjEuMiIsInVwZGF0ZWRJblZlciI6IjM3LjMzMS4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tree borrows violation occurs when using zlib backend
3 participants