cloudwego / volo

Rust RPC framework with high-performance and strong-extensibility for building micro-services.
https://crates.io/crates/volo
Apache License 2.0
2.13k stars 166 forks source link

fix: Enforce faststr versions to fix new_u8_slice_unchecked not found #450

Closed Xuanwo closed 3 weeks ago

Xuanwo commented 3 weeks ago

Motivation

faststr raises error like the following during upgrade:

error[E0599]: no function or associated item named `new_u8_slice_unchecked` found for struct `FastStr` in the current scope
   --> /home/xuanwo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sonic-rs-0.3.6/src/lazyvalue/value.rs:269:52
    |
269 |             JsonSlice::Raw(r) => unsafe { FastStr::new_u8_slice_unchecked(r) },
    |                                                    ^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `FastStr`
    |
note: if you're trying to build a new `FastStr` consider using one of the following associated functions:
      FastStr::new
      FastStr::new_inline
      FastStr::from_arc_str
      FastStr::from_string
      and 11 others
   --> /home/xuanwo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/faststr-0.2.11/src/lib.rs:30:5
    |
30  | /     pub fn new<T>(text: T) -> Self
31  | |     where
32  | |         T: AsRef<str>,
    | |______________________^
...
41  |       pub const fn new_inline(s: &str) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
59  |       pub fn from_arc_str(s: Arc<str>) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
65  |       pub fn from_string(s: String) -> Self {
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: there is an associated function `from_u8_slice_unchecked` with a similar name
    |
269 |             JsonSlice::Raw(r) => unsafe { FastStr::from_u8_slice_unchecked(r) },
    |                                                    ~~~~~~~~~~~~~~~~~~~~~~~

Solution

It's better to raise the version requirement for faststr, so that users don't need to take actions.

CLAassistant commented 3 weeks ago

CLA assistant check
All committers have signed the CLA.

Xuanwo commented 3 weeks ago

cc @PureWhiteWu for a look, thanks!