-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Description
I've got this code
trait Foo {
fn bar(&self) -> Self where Self: Sized;
}
impl Foo for str {
// fn bar(&self) -> Self { unimplemented!() }
}
the error is:
error[E0046]: not all trait items implemented, missing: `bar`
--> src/lib.rs:5:1
However, since str
is not Sized
, i don't think bar
needs to be implemented. if i remove the "//", i'll got:
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> src/lib.rs:6:22
So although this trait fits object safety rules, i still can't implement it for unsized types.
cramertj
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.