Skip to content

Conversation

@taiki-e
Copy link
Contributor

@taiki-e taiki-e commented Sep 23, 2025

It appears type inferences no longer works due to the addition of several PartialEq implementations around CStr.

https://github.com/bytecodealliance/rustix/actions/runs/17935800005/job/51001634461

error[E0283]: type annotations needed
  --> tests/net/addr.rs:34:20
   |
34 |         cstr!("/").into()
   |                    ^^^^ cannot infer type for type parameter `U`
   |
   = note: cannot satisfy `_: From<&CStr>`
   = note: required for `&CStr` to implement `Into<_>`
error[E0283]: type annotations needed
  --> tests/path/arg.rs:19:32
   |
19 |     assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
   |                                ^^^^^^^^^^^^^^ -------------------------- type must be known at this point
   |                                |
   |                                cannot infer type of the type parameter `Borrowed` declared on the trait `Borrow`
   |
   = note: multiple `impl`s satisfying `Cow<'_, CStr>: Borrow<_>` found in the following crates: `alloc`, `core`:
           - impl<'a, B> Borrow<B> for Cow<'a, B>
             where B: ToOwned, B: ?Sized;
           - impl<T> Borrow<T> for T
             where T: ?Sized;
help: consider specifying the generic argument
   |
19 |     assert_eq!(cstr!("hello"), Borrow::<Borrowed>::borrow(&t.as_cow_c_str().unwrap()));
   |                                      ++++++++++++

```
error[E0283]: type annotations needed
  --> tests/net/addr.rs:34:20
   |
34 |         cstr!("/").into()
   |                    ^^^^ cannot infer type for type parameter `U`
   |
   = note: cannot satisfy `_: From<&CStr>`
   = note: required for `&CStr` to implement `Into<_>`
```

```
error[E0283]: type annotations needed
  --> tests/path/arg.rs:19:32
   |
19 |     assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
   |                                ^^^^^^^^^^^^^^ -------------------------- type must be known at this point
   |                                |
   |                                cannot infer type of the type parameter `Borrowed` declared on the trait `Borrow`
   |
   = note: multiple `impl`s satisfying `Cow<'_, CStr>: Borrow<_>` found in the following crates: `alloc`, `core`:
           - impl<'a, B> Borrow<B> for Cow<'a, B>
             where B: ToOwned, B: ?Sized;
           - impl<T> Borrow<T> for T
             where T: ?Sized;
help: consider specifying the generic argument
   |
19 |     assert_eq!(cstr!("hello"), Borrow::<Borrowed>::borrow(&t.as_cow_c_str().unwrap()));
   |                                      ++++++++++++
```
@ids1024 ids1024 mentioned this pull request Oct 16, 2025
@sunfishcode sunfishcode merged commit 8a2472a into bytecodealliance:main Oct 24, 2025
50 checks passed
@sunfishcode
Copy link
Member

Thanks!

@taiki-e taiki-e deleted the ci branch October 25, 2025 00:53
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.

2 participants