-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Arc<str>
does not have a Default
impl
#124275
Comments
Default
implArc<str>
does not have a Default
impl
@rustbot claim |
Hello @Billy-Sheppard, just out of curiosity, which use-case do you have in mind for this? |
I believe implementing |
Not OP, but I'd like to be able to quickly refactor |
I have a shared ( |
I tried this code:
I expected to see this happen:
Instead, this happened:
It does work for
Arc<&str>
but not forArc<str>
. This is becausestr
doesn't have a Default impl (presumably due to being unsized).In theory its as "simple" as adding this into the
std/alloc
library, which does pass./x.py check library/core
on my machine. However this is definitely not the most efficient implementation of the intended result, and perhaps an implementation similar toimpl Default for Box<str>
would suffice more acutely.Meta
rustc --version --verbose
:Stable channel: Build using the Stable version: 1.77.2
.Applies on nightly:
Nightly channel: Build using the Nightly version: 1.79.0-nightly (2024-04-21 fb898629a26e4acec59c)
also.The text was updated successfully, but these errors were encountered: