Uh oh!
There was an error while loading. Please reload this page.
Improve suggestions when multiples tuples implement the same trait - #159672
Conversation
rustbot
commented
Jul 21, 2026
r? @oli-obk rustbot has assigned @oli-obk. Use Why was this reviewer chosen?The reviewer was selected based on:
|
rperier
commented
Jul 21, 2026
Perhaps a ui test dedicated to this use case, specifically might be helpful, imho. It was convered by any tests. |
This comment has been minimized.
This comment has been minimized.
114f1a4 to
f9303a9CompareIdea: can we style the type like rustdoc does: https://doc.rust-lang.org/nightly/std/fmt/trait.Debug.html#impl-Debug-for-(T,) , like this I'm a bit worried that it's going to look like shit in a terminal, though... |
rperier
commented
Jul 22, 2026
I like this idea, the output would be more concise and simpler. Plus, I would not have to count the max number of tuples args, so the code would be simpler. However, I agree with you, how is it about to be rendered in a terminal ? I am going to investigate |
rperier
commented
Jul 22, 2026
Simply by using UTF8 ? UTF8 can handle these kind of notation, normally (exponent, indices, etc...) |
rperier
commented
Jul 22, 2026
f9303a9 to
93c6b30Compare
This comment has been minimized.
This comment has been minimized.
What about something like this ? The rendering in a terminal is quiet good. |
mejrs
commented
Jul 22, 2026
I do think it would be nice to say "up to tuples of length 12" or something. |
Like : ? |
93c6b30 to
1b78e29Comparerperier
commented
Jul 22, 2026
@rustbot ready |
There was a problem hiding this comment.
r? me
Thanks, great work. I love this message specifically being more concise.
How does this diagnostic compose with #[splat]? Can you add a test documenting what that looks like? If it's weird or doesn't work then no need to fix that necessarily, feel free to punt it towards the splat people :)
Also cc @estebank I know you care deeply about how errors show up in the terminal, is use of subscript acceptable to you?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rperier
commented
Jul 23, 2026
Sorry, I don't know what |
mejrs
commented
Jul 23, 2026
It's an experiment, see https://rust-lang.github.io/rust-project-goals/2026/overloading-for-ffi.html and #153629 |
1b78e29 to
a16ffa9Compare
This comment has been minimized.
This comment has been minimized.
There are two branches actually, the case when all types implements the same traits , with less than 5 candidates and the case where there are more than 5 candidates. I did not changes anything to the case with less than 5 candidates, I have added a "concise output" for continuous arities (ranges from 0 to N or from K to N) where there are more than 5 candidates. @rustbot ready EDIT: in order to be sure that all tuples and continuous by step of 1, I had to sort the candidates. That's why I have updated the output of some tests, only the ordering output of these test have changed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rustbot
commented
Jul 30, 2026
Reminder, once the PR becomes ready for a review, use |
Instead of displaying all kind of tuples that implement a given trait, which might flood the user, it displays a concise message only when all the involved types are tuples.
a16ffa9 to
507283dComparerustbot
commented
Jul 31, 2026
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
rperier
commented
Jul 31, 2026
@rustbot ready |
…it_impls_tuples, r=mejrs Improve suggestions when multiples tuples implement the same trait Fixesrust-lang#152903
…it_impls_tuples, r=mejrs Improve suggestions when multiples tuples implement the same trait Fixesrust-lang#152903
Rollup of 14 pull requests Successful merges: - #159245 (Emit retags in codegen to support BorrowSanitizer (part 5)) - #159864 (Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]>) - #160079 (make atomic operations const) - #160124 (Structurally prevent zero-count `BackendRepr::SimdVector`s) - #160162 (Make `#[fundamental]` only apply to the first argument of `Box`) - #160210 (Remove an outdated FIXME) - #160282 (Improve diagnostic for patterns in function pointer types) - #157928 (Eagerly fetch typeck results when linting) - #159672 (Improve suggestions when multiples tuples implement the same trait) - #159861 (Add documentation for the `non_exhaustive` attribute) - #159907 (Fix `hidden_glob_reexports` in `rustc_ast`) - #159998 (Align expect messages with guidance) - #160145 (Expand checks for register_tool) - #160307 (Update `minifier` version to `0.4.0`)
Uh oh!
There was an error while loading. Please reload this page.
Rollup of 14 pull requests Successful merges: - rust-lang/rust#159245 (Emit retags in codegen to support BorrowSanitizer (part 5)) - rust-lang/rust#159864 (Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]>) - rust-lang/rust#160079 (make atomic operations const) - rust-lang/rust#160124 (Structurally prevent zero-count `BackendRepr::SimdVector`s) - rust-lang/rust#160162 (Make `#[fundamental]` only apply to the first argument of `Box`) - rust-lang/rust#160210 (Remove an outdated FIXME) - rust-lang/rust#160282 (Improve diagnostic for patterns in function pointer types) - rust-lang/rust#157928 (Eagerly fetch typeck results when linting) - rust-lang/rust#159672 (Improve suggestions when multiples tuples implement the same trait) - rust-lang/rust#159861 (Add documentation for the `non_exhaustive` attribute) - rust-lang/rust#159907 (Fix `hidden_glob_reexports` in `rustc_ast`) - rust-lang/rust#159998 (Align expect messages with guidance) - rust-lang/rust#160145 (Expand checks for register_tool) - rust-lang/rust#160307 (Update `minifier` version to `0.4.0`)
Rollup of 14 pull requests Successful merges: - rust-lang/rust#159245 (Emit retags in codegen to support BorrowSanitizer (part 5)) - rust-lang/rust#159864 (Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]>) - rust-lang/rust#160079 (make atomic operations const) - rust-lang/rust#160124 (Structurally prevent zero-count `BackendRepr::SimdVector`s) - rust-lang/rust#160162 (Make `#[fundamental]` only apply to the first argument of `Box`) - rust-lang/rust#160210 (Remove an outdated FIXME) - rust-lang/rust#160282 (Improve diagnostic for patterns in function pointer types) - rust-lang/rust#157928 (Eagerly fetch typeck results when linting) - rust-lang/rust#159672 (Improve suggestions when multiples tuples implement the same trait) - rust-lang/rust#159861 (Add documentation for the `non_exhaustive` attribute) - rust-lang/rust#159907 (Fix `hidden_glob_reexports` in `rustc_ast`) - rust-lang/rust#159998 (Align expect messages with guidance) - rust-lang/rust#160145 (Expand checks for register_tool) - rust-lang/rust#160307 (Update `minifier` version to `0.4.0`)
View all comments
Fixes#152903