Tweak wording
This commit is contained in:
parent
3dd638fe6c
commit
ff9c5db03c
10 changed files with 40 additions and 21 deletions
|
@ -247,6 +247,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
adjusted_ty,
|
adjusted_ty,
|
||||||
opt_input_type.as_ref().map(slice::from_ref),
|
opt_input_type.as_ref().map(slice::from_ref),
|
||||||
) {
|
) {
|
||||||
|
// Check for `self` receiver on the method, otherwise we can't use this as a `Fn*` trait.
|
||||||
|
if !self.tcx.associated_item(ok.value.def_id).fn_has_self_parameter {
|
||||||
|
self.tcx.sess.delay_span_bug(
|
||||||
|
call_expr.span,
|
||||||
|
"input to overloaded call fn is not a self receiver",
|
||||||
|
);
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let method = self.register_infer_ok_obligations(ok);
|
let method = self.register_infer_ok_obligations(ok);
|
||||||
let mut autoref = None;
|
let mut autoref = None;
|
||||||
if borrow {
|
if borrow {
|
||||||
|
@ -257,7 +266,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
// caused an error elsewhere.
|
// caused an error elsewhere.
|
||||||
self.tcx
|
self.tcx
|
||||||
.sess
|
.sess
|
||||||
.delay_span_bug(call_expr.span, "input to call/call_mut is not a ref?");
|
.delay_span_bug(call_expr.span, "input to call/call_mut is not a ref");
|
||||||
return None;
|
return None;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -271,6 +280,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
target: method.sig.inputs()[0],
|
target: method.sig.inputs()[0],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return Some((autoref, method));
|
return Some((autoref, method));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -823,7 +833,7 @@ impl<'a, 'tcx> DeferredCallResolution<'tcx> {
|
||||||
);
|
);
|
||||||
err.help(
|
err.help(
|
||||||
"make sure the `fn`/`fn_mut`/`fn_once` lang items are defined \
|
"make sure the `fn`/`fn_mut`/`fn_once` lang items are defined \
|
||||||
and have associated `call`/`call_mut`/`call_once` functions",
|
and have correctly defined `call`/`call_mut`/`call_once` methods",
|
||||||
);
|
);
|
||||||
err.emit();
|
err.emit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | a();
|
LL | a();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: failed to find an overloaded call trait for closure call
|
error: failed to find an overloaded call trait for closure call
|
||||||
--> $DIR/fn-fn_mut-call-ill-formed.rs:43:5
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:43:5
|
||||||
|
@ -12,7 +12,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | a();
|
LL | a();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: failed to find an overloaded call trait for closure call
|
error: failed to find an overloaded call trait for closure call
|
||||||
--> $DIR/fn-fn_mut-call-ill-formed.rs:43:5
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:43:5
|
||||||
|
@ -12,7 +12,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | a();
|
LL | a();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: failed to find an overloaded call trait for closure call
|
error: failed to find an overloaded call trait for closure call
|
||||||
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
||||||
|
@ -12,7 +12,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | a();
|
LL | a();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: failed to find an overloaded call trait for closure call
|
error: failed to find an overloaded call trait for closure call
|
||||||
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
||||||
|
@ -12,7 +12,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | a();
|
LL | a();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: failed to find an overloaded call trait for closure call
|
error: failed to find an overloaded call trait for closure call
|
||||||
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
||||||
|
@ -12,7 +12,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | a();
|
LL | a();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: failed to find an overloaded call trait for closure call
|
error: failed to find an overloaded call trait for closure call
|
||||||
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
||||||
|
@ -12,7 +12,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | a();
|
LL | a();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: failed to find an overloaded call trait for closure call
|
error: failed to find an overloaded call trait for closure call
|
||||||
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
||||||
|
@ -12,7 +12,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
error[E0308]: mismatched types
|
error: failed to find an overloaded call trait for closure call
|
||||||
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:42:5
|
||||||
|
|
|
||||||
|
LL | a();
|
||||||
|
| ^^^
|
||||||
|
|
|
||||||
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
|
error: failed to find an overloaded call trait for closure call
|
||||||
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
--> $DIR/fn-fn_mut-call-ill-formed.rs:47:5
|
||||||
|
|
|
|
||||||
LL | b();
|
LL | b();
|
||||||
| ^^^ expected `i32`, found `()`
|
| ^^^
|
||||||
|
|
|
||||||
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0308`.
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ error: failed to find an overloaded call trait for closure call
|
||||||
LL | one()
|
LL | one()
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have associated `call`/`call_mut`/`call_once` functions
|
= help: make sure the `fn`/`fn_mut`/`fn_once` lang items are defined and have correctly defined `call`/`call_mut`/`call_once` methods
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue