-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Arc<str> does not have a Default impl #124275
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.Libs-SmallLibs issues that are considered "small" or self-containedLibs issues that are considered "small" or self-containedT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.Libs-SmallLibs issues that are considered "small" or self-containedLibs issues that are considered "small" or self-containedT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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 becausestrdoesn't have a Default impl (presumably due to being unsized).In theory its as "simple" as adding this into the
std/alloclibrary, which does pass./x.py check library/coreon 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.