Skip to content

wierd interaction due to two twitch_types crates used #256

Description

@Emilgardis

Due to how we currently have twitch_types used in twitch_api2 and twitch_oauth2, there's a wierd interaction happening due to the two twitch_api crates used are not the same due to pathing.

To circumvent the issue, users that have specified twitch_api2 as a path or git dependency will need to do the following:

[dependencies]
twitch_api = { git = "https://github.com/twitch-rs/twitch_api/" }

# workaround for https://github.com/twitch-rs/twitch_api/issues/256
[patch.crates-io.twitch_types]
git = "https://github.com/twitch-rs/twitch_api"

this issue manifests as

error[E0277]: the trait bound `&twitch_types::basic::UserIdRef: IntoCow<'_, UserIdRef>` is not satisfied
   --> /Users/emil/.cargo/git/checkouts/twitch_api-e5fea103d3f2733c/e9ed7c5/src/helix/client/client_ext.rs:302:70
    |
302 |         let req = helix::streams::GetFollowedStreamsRequest::user_id(user_id);
    |                   -------------------------------------------------- ^^^^^^^ the trait `IntoCow<'_, UserIdRef>` is not implemented for `&twitch_types::basic::UserIdRef`
    |                   |
    |                   required by a bound introduced by this call
    |
    = help: the following other types implement trait `IntoCow<'a, Ref>`:
              <&'a BadgeSetId as IntoCow<'a, BadgeSetIdRef>>
              <&'a BadgeSetIdRef as IntoCow<'a, BadgeSetIdRef>>
              <&'a BlockedTermId as IntoCow<'a, BlockedTermIdRef>>
              <&'a BlockedTermIdRef as IntoCow<'a, BlockedTermIdRef>>
              <&'a CategoryId as IntoCow<'a, CategoryIdRef>>
              <&'a CategoryIdRef as IntoCow<'a, CategoryIdRef>>
              <&'a CharityCampaignId as IntoCow<'a, CharityCampaignIdRef>>
              <&'a CharityCampaignIdRef as IntoCow<'a, CharityCampaignIdRef>>
            and 83 others
note: required by a bound in `GetFollowedStreamsRequest::<'a>::user_id`
   --> /Users/emil/.cargo/git/checkouts/twitch_api-e5fea103d3f2733c/e9ed7c5/src/helix/endpoints/streams/get_followed_streams.rs:70:34
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `GetFollowedStreamsRequest::<'a>::user_id`

error[E0277]: the trait bound `&twitch_types::basic::UserIdRef: IntoCow<'_, UserIdRef>` is not satisfied
   --> /Users/emil/.cargo/git/checkouts/twitch_api-e5fea103d3f2733c/e9ed7c5/src/helix/client/client_ext.rs:343:92
    |
343 |         let req = helix::subscriptions::GetBroadcasterSubscriptionsRequest::broadcaster_id(user_id);
    |                   ------------------------------------------------------------------------ ^^^^^^^ the trait `IntoCow<'_, UserIdRef>` is not implemented for `&twitch_types::basic::UserIdRef`
    |                   |
    |                   required by a bound introduced by this call
    |
    = help: the following other types implement trait `IntoCow<'a, Ref>`:
              <&'a BadgeSetId as IntoCow<'a, BadgeSetIdRef>>
              <&'a BadgeSetIdRef as IntoCow<'a, BadgeSetIdRef>>
              <&'a BlockedTermId as IntoCow<'a, BlockedTermIdRef>>
              <&'a BlockedTermIdRef as IntoCow<'a, BlockedTermIdRef>>
              <&'a CategoryId as IntoCow<'a, CategoryIdRef>>
              <&'a CategoryIdRef as IntoCow<'a, CategoryIdRef>>
              <&'a CharityCampaignId as IntoCow<'a, CharityCampaignIdRef>>
              <&'a CharityCampaignIdRef as IntoCow<'a, CharityCampaignIdRef>>
            and 83 others
note: required by a bound in `GetBroadcasterSubscriptionsRequest::<'a>::broadcaster_id`
   --> /Users/emil/.cargo/git/checkouts/twitch_api-e5fea103d3f2733c/e9ed7c5/src/helix/endpoints/subscriptions/get_broadcaster_subscriptions.rs:69:48
    |
69  |     pub fn broadcaster_id(broadcaster_id: impl types::IntoCow<'a, types::UserIdRef> + 'a) -> Self {
    |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `GetBroadcasterSubscriptionsRequest::<'a>::broadcaster_id`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `twitch_api` due to 2 previous errors

Can this be solved neatly without requiring a patch?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions