rust-lang / rust-lang/rust

Trait inference is broken for unnamed structs

Open
#130,318 7 comments 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

A-associated-items A-trait-system C-bug E-help-wanted S-has-mcve T-compiler T-lang
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

I tried this code:

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=f985f43df2ad05edfb593d23248e46f3

I expected to see this happen: That this works both for structs with named fields as with structs with anonymous fields

Instead, this happened: Works as expected for named fields, but fails to compile for anonymous structs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.