Skip to content

fix: no lint unsized adt self_ty missing bounded assoc#22363

Merged
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
A4-Tacks:adt-unsized-ty-missing
May 15, 2026
Merged

fix: no lint unsized adt self_ty missing bounded assoc#22363
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
A4-Tacks:adt-unsized-ty-missing

Conversation

@A4-Tacks
Copy link
Copy Markdown
Member

@A4-Tacks A4-Tacks commented May 14, 2026

Fixes #22353

Example

trait Trait {
    fn item() where Self: Sized;
}
impl Trait for Adt {}
struct Adt([i32]);

Before this PR

error: not all trait items implemented, missing: `fn item`

After this PR

no lint

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 14, 2026
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calculating layout to check sizedness is pretty wasteful and also incorrect since layout can fail for unrelated reasons. You can look at how rustc does that here:

https://github.com/rust-lang/rust/blob/7c3c88f42ad444f4688b865591d84660be4ece2f/compiler/rustc_ty_utils/src/ty.rs#L352

View changes since this review

Example
---
```rust
trait Trait {
    fn item() where Self: Sized;
}
impl Trait for Adt {}
struct Adt([i32]);
```

**Before this PR**

```
error: not all trait items implemented, missing: `fn item`
```

**After this PR**

no lint
@A4-Tacks A4-Tacks force-pushed the adt-unsized-ty-missing branch from 16804e7 to b062ef8 Compare May 15, 2026 01:44
@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue May 15, 2026
Merged via the queue into rust-lang:master with commit 43e7434 May 15, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 15, 2026
@A4-Tacks A4-Tacks deleted the adt-unsized-ty-missing branch May 15, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive "not all trait items implemented" (E0046) for items with Self: Sized for non-primitive unsized types

3 participants