Skip to content

Commit d1ab6c2

Browse files
Do not suggest adjusting trait signature on type mismatch
1 parent 0f7ef1a commit d1ab6c2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3959,6 +3959,10 @@ fn hint_missing_borrow<'tcx>(
39593959
found_node: Node<'_>,
39603960
err: &mut Diagnostic,
39613961
) {
3962+
if matches!(found_node, Node::TraitItem(..)) {
3963+
return;
3964+
}
3965+
39623966
let found_args = match found.kind() {
39633967
ty::FnPtr(f) => infcx.instantiate_binder_with_placeholders(*f).inputs().iter(),
39643968
kind => {

tests/ui/typeck/mismatched-map-under-self.stderr

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ LL | self.map(Insertable::values).unwrap_or_default()
3030
found function signature `for<'a> fn(&'a _) -> _`
3131
note: required by a bound in `Option::<T>::map`
3232
--> $SRC_DIR/core/src/option.rs:LL:COL
33-
help: consider adjusting the signature so it does not borrow its argument
34-
|
35-
LL - fn values(&self) -> Self::Values;
36-
LL + fn values(self) -> Self::Values;
37-
|
3833

3934
error: aborting due to 2 previous errors
4035

0 commit comments

Comments
 (0)