-
Notifications
You must be signed in to change notification settings - Fork 190
Open
Labels
C-coreComponent: core functionality such as traits, etc.Component: core functionality such as traits, etc.E-simpleEffort: simple.Effort: simple.T-bugType: bug.Type: bug.
Description
Although the conversion is implemented, the compiler won't let me use it because str
is not Sized
.
For example, the following code:
struct MetricMetadata {
description: SharedString,
unit: Option<Unit>,
}
impl MetricMetadata {
fn description(&self) -> std::borrow::Cow<'static, str> {
self.description.into()
}
}
refuses to compile with the following error:
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> src/metadata.rs:38:26
|
38 | self.description.into()
| ^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
= note: required for `std::borrow::Cow<'_, str>` to implement `std::convert::From<metrics::cow::Cow<'_, str>>`
= note: required for `metrics::cow::Cow<'_, str>` to implement `std::convert::Into<std::borrow::Cow<'_, str>>`
Metadata
Metadata
Assignees
Labels
C-coreComponent: core functionality such as traits, etc.Component: core functionality such as traits, etc.E-simpleEffort: simple.Effort: simple.T-bugType: bug.Type: bug.