Repository navigation
Open
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.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.needs-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.This change is large or controversial enough that it should have an RFC accepted before doing it.
Description
so this issue is a follow up for #134422 (closed as not planned) to suggest making a lint instead.
What the issue talked about
Rust does not check for T: Sized in required trait methods
trait Foo {
fn bar(self: Self, x: str);
}The above code compiles, even though Self and str are both ?Sized
this makes the trait unimplementable
impl Foo for [u8] {
fn bar(self: Self, x: str) {}
}Produces:
The size for values of type `[u8]` cannot be known at compile time
The size for values of type `str` cannot be known at compile timeFor more information please see the RFC
Meta
for anyone who cares, here is rustc --version --verbose
rustc 1.85.0-nightly (21fe748be 2024-12-11)
binary: rustc
commit-hash: 21fe748be15271ea5804e0507cd699b675efe038
commit-date: 2024-12-11
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5
Here is the RFC
Metadata
Metadata
Assignees
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.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.needs-rfcThis change is large or controversial enough that it should have an RFC accepted before doing it.This change is large or controversial enough that it should have an RFC accepted before doing it.
Activity
ionicmc-rs commentedon Dec 18, 2024
[-]Unsized receiver in traits[/-][+]Unsized types in required trait methods[/+]ionicmc-rs commentedon Dec 18, 2024
i will make an rfc as the label suggests
ionicmc-rs commentedon Dec 18, 2024
here is the rfc
ionicmc-rs commentedon Dec 18, 2024
rustbot commentedon Dec 18, 2024
ionicmc-rs commentedon Dec 18, 2024
workingjubilee commentedon Dec 18, 2024
ionicmc-rs commentedon Dec 19, 2024
ionicmc-rs commentedon Dec 20, 2024
The RFC may not be accepted, but this issue is mildly severe, so can someone come up with a solution