Open
Description
opened on Dec 18, 2024
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 time
For 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
Assignees
Labels
Area: Lints (warnings about flaws in source code) such as unused_mut.Area: trait objects, vtable layoutCategory: A feature request, i.e: not implemented / a PR.Relevant to the language team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.This change is large or controversial enough that it should have an RFC accepted before doing it.
Activity