You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey folks! I've been writing a library which uses capnp and also does some nifty stuff with the std::borrow::Borrow trait, which has this method Borrow::borrow. I imported Borrow::borrow at the top of my file and it caused majorly confusing issues with capnp; to make a long story short, for everything I wrote with capnp which was building an object (and using Builder::borrow) Rust attempted to resolve the methods as Borrow::borrow instead. This resulted in extremely confusing errors such as "attempt to move out of borrowed content" on calling builder.borrow().get_field(). I realize it's not possible to reimplement borrow in terms of the Borrow trait, but it's currently extremely bad trying to use std::borrow::Borrow; at the top of a file and also do something with Builder which requires Builder::borrow. I've localized all my use statements for Borrow::borrow and it's quite nasty.
I realize a name change would unfortunately be a pretty bad breaking change, but I just want to put the possibility out there. Colliding with a useful, bread-and-butter (for me, at least) stdlib trait in this nasty way seems Not Good. I don't really have any other solutions to suggest though.
The text was updated successfully, but these errors were encountered:
Hey folks! I've been writing a library which uses capnp and also does some nifty stuff with the
std::borrow::Borrow
trait, which has this methodBorrow::borrow
. I importedBorrow::borrow
at the top of my file and it caused majorly confusing issues with capnp; to make a long story short, for everything I wrote with capnp which was building an object (and usingBuilder::borrow
) Rust attempted to resolve the methods asBorrow::borrow
instead. This resulted in extremely confusing errors such as "attempt to move out of borrowed content" on callingbuilder.borrow().get_field()
. I realize it's not possible to reimplementborrow
in terms of theBorrow
trait, but it's currently extremely bad trying touse std::borrow::Borrow;
at the top of a file and also do something withBuilder
which requiresBuilder::borrow
. I've localized all myuse
statements forBorrow::borrow
and it's quite nasty.I realize a name change would unfortunately be a pretty bad breaking change, but I just want to put the possibility out there. Colliding with a useful, bread-and-butter (for me, at least) stdlib trait in this nasty way seems Not Good. I don't really have any other solutions to suggest though.
The text was updated successfully, but these errors were encountered: