Skip to content

Conversation

@NobodyXu
Copy link
Contributor

@NobodyXu NobodyXu commented Sep 9, 2023

No description provided.

@NobodyXu
Copy link
Contributor Author

NobodyXu commented Sep 9, 2023

It turns out that using DynNestedProgress as a trait object and then use DynNestedProgressToNestedProgress doesn't work:

error[E0277]: the trait bound `dyn gix_features::progress::DynNestedProgress: gix_features::progress::Nest
edProgress` is not satisfied
   --> gix/src/clone/fetch/mod.rs:146:14
    |
146 |             .receive(DynNestedProgressToNestedProgress(progress), should_interrupt)
    |              ^^^^^^^ the trait `gix_features::progress::NestedProgress` is not implemented for `dyn 
gix_features::progress::DynNestedProgress`
    |
    = help: the following other types implement trait `gix_features::progress::NestedProgress`:              gix_features::progress::prodash::tree::Item
              gix_features::progress::Discard
              gix_features::progress::Either<L, R>
              gix_features::progress::DoOrDiscard<T>
              gix_features::progress::ThroughputOnDrop<T>
              gix_features::progress::BoxedDynNestedProgress
              gix_features::progress::DynNestedProgressToNestedProgress<T>
              &'a mut T
    = note: required for `&mut dyn gix_features::progress::DynNestedProgress` to implement `gix_features::
progress::NestedProgress`
    = note: required for `&mut dyn gix_features::progress::DynNestedProgress` to implement `gix_features::
progress::DynNestedProgress`
    = note: 1 redundant requirement hidden
    = note: required for `DynNestedProgressToNestedProgress<&mut dyn DynNestedProgress>` to implement `gix
_features::progress::NestedProgress`
    = note: the full type name has been written to '/Users/nobodyxu/Dev/gitoxide/target/debug/deps/gix-c1b
f5d15fa5fd661.long-type-8934911478669783998.txt'

For more information about this error, try `rustc --explain E0277`.
error: could not compile `gix` (lib) due to previous error

Content of /Users/nobodyxu/Dev/gitoxide/target/debug/deps/gix-c1b f5d15fa5fd661.long-type-8934911478669783998.txt:

gix_features::progress::DynNestedProgressToNestedProgress<&mut dyn gix_features::progress::DynNestedProgress>

@NobodyXu
Copy link
Contributor Author

NobodyXu commented Sep 9, 2023

I've already opened GitoxideLabs/prodash#24 for fixing use of Progress and Count as trait object, but I still haven't figured out how to fix DynNestedProgressToProgress.

@Byron
Copy link
Member

Byron commented Sep 9, 2023

Is DynNestedProgressToProgress actually needed anywhere? I thought that in all places, one should be able to use &mut dyn DynNestedProgress. Maybe that can be an avenue towards solving the issue, by avoidance. Disclaimer: I do definitely speak out of ignorance here.

@NobodyXu
Copy link
Contributor Author

NobodyXu commented Sep 9, 2023

It's used in gix::remote::fetch::Prepare::receive since it expects NestedProgress.

I can actually workaround this issue by creating a receive_inner that takes DynNestedProgress instead.

…ceive`

and expose a new `pub(crate)` fn `receive_inner`

Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
@NobodyXu NobodyXu marked this pull request as ready for review September 9, 2023 10:10
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.

Great to hear that this wasn't a blocker! Thanks again for the initiative!

]

[workspace.dependencies]
prodash = { version = "26.2.2", default-features = false }
Copy link
Member

Choose a reason for hiding this comment

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

That's nice! Thanks for introducing this feature!

@Byron Byron merged commit 1f2ffb6 into GitoxideLabs:main Sep 9, 2023
@NobodyXu NobodyXu deleted the optimize/progress-use branch September 9, 2023 22:13
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