]> git.lizzy.rs Git - rust.git/commit - src/tools/rust-analyzer
Rollup merge of #95260 - compiler-errors:fn, r=davidtwco
authorMatthias Krüger <matthias.krueger@famsik.de>
Fri, 1 Apr 2022 04:59:41 +0000 (06:59 +0200)
committerGitHub <noreply@github.com>
Fri, 1 Apr 2022 04:59:41 +0000 (06:59 +0200)
commit94b1960535b79bc211a1a9c9967a972e8306e7ae
treec2924d4fc0443386c2775be189f24643804a97a5
parent3cb5925660f06b5e0b5bed5675edde9597a4c4ee
parente0c8780a5baa78cbb5e8759d5783000547c0db75
Rollup merge of #95260 - compiler-errors:fn, r=davidtwco

Better suggestions for `Fn`-family trait selection errors

1. Suppress suggestions to add `std::ops::Fn{,Mut,Once}` bounds when a type already implements `Fn{,Mut,Once}`
2. Add a note that points out that a type does in fact implement `Fn{,Mut,Once}`, but the arguments vary (either by number or by actual arguments)
3. Add a note that points out that a type does in fact implement `Fn{,Mut,Once}`, but not the right one (e.g. implements `FnMut`, but `Fn` is required).

Fixes #95147
compiler/rustc_infer/src/infer/error_reporting/mod.rs
compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs