Skip to content

Fix compiler error when objc2 is in dependency tree #1503

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

Merged
merged 1 commit into from
Jun 9, 2025

Conversation

madsmtm
Copy link
Contributor

@madsmtm madsmtm commented May 28, 2025

@simlay is working on upgrading cpal to depend on objc2 in RustAudio/coreaudio-rs#132, but because of an unrelated impl IntoIterator in objc2, compiling librespot fails with the following error:

simlay@m1-mbp-si:~/projects/rust-audio/librespot (dev)$ cargo build
   Compiling librespot-connect v0.6.0-dev (/Users/simlay/projects/rust-audio/librespot/connect)
uerror[E0275]: overflow evaluating the requirement `&_: IntoIterator`
  --> connect/src/shuffle_vec.rs:65:56
   |
65 |         for (i, &rnd_ind) in (1..self.vec.len()).rev().zip(&indices) {
   |                                                        ^^^
   |
   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`librespot_connect`)
   = note: required for `&objc2::rc::retained::Retained<_>` to implement `IntoIterator`
   = note: 126 redundant requirements hidden
   = note: required for `&Retained<Retained<Retained<Retained<Retained<...>>>>>` to implement `IntoIterator`
   = note: the full name for the type has been written to '/Users/simlay/projects/rust-audio/librespot/target/debug/deps/librespot_connect-d7de9da5a372e7ea.long-type-1250449993922365444.txt'
   = note: consider using `--verbose` to print the full type name to the console

For more information about this error, try `rustc --explain E0275`.
error: could not compile `librespot-connect` (lib) due to 1 previous error

This is a type inference bug in rustc that will be fixed with the new trait solver, see rust-lang/rust#136856, but in the meantime we can fix this in librespot.

Copy link
Member

@photovoltex photovoltex left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the "fix" :)

I will wait until we fixed the clippy warnings, with #1504 and then merge it.

@photovoltex photovoltex merged commit 2c425eb into librespot-org:dev Jun 9, 2025
8 of 10 checks passed
@madsmtm madsmtm deleted the fix-objc2 branch June 9, 2025 13: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