Pattern is indeed not stable. Only concrete implementations of it in the standard library are stable.
So... is this a bug in the docs or not? I agree that only the concrete implementations are stable, and that you need nightly if you want to implement Pattern on your own type, but when I just read the docs it feels like I should be able to implement Pattern.
Maybe I'm just overthinking things again...
find is indeed stable,
Pattern is indeed unstable, and both are marked accordingly in the docs.
Of course you can't implement
Pattern because it's unstable, but you can call
find because it's stable.
Maybe you're expecting to not be able to call
find because it would involve passing a type that implements
Pattern, and that's unstable? In that case no, that only requires the type implementing the trait, and even if the trait is unstable the trait implementation just needs to be stable (well, trait implementations can't be unstable, so it just needs to exist)
Yup, that sums up what I was think pretty much exactly. So, no bugs in the docs, just a bug in my understanding of the docs. Thank you!
Note that this happens secretly in a few places. For example, when you use
? it's using the unstable Try in std::ops - Rust in what it actually calls.
We try not to do it too often, as things can leak a bit (restricting the flexibility we have to change things later) but it's helpful sometimes to let people call things for std types even if they can't implement things for their own stuff just yet.
Makes sense. I just got concerned precisely because the leaking restricts what you can do with the unstable API in the future. But if you already know about it, then it isn't a big deal, and we can just let this topic go away.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.