Tweak E0271 wording
This commit is contained in:
parent
5ae8e23816
commit
6c2c8edac3
9 changed files with 18 additions and 14 deletions
|
@ -1866,10 +1866,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
|
||||
with_forced_trimmed_paths! {
|
||||
if Some(pred.projection_ty.def_id) == self.tcx.lang_items().fn_once_output() {
|
||||
let fn_kind = self_ty.prefix_string(self.tcx);
|
||||
let item = match self_ty.kind() {
|
||||
ty::FnDef(def, _) => self.tcx.item_name(*def).to_string(),
|
||||
_ => self_ty.to_string(),
|
||||
};
|
||||
Some(format!(
|
||||
"expected `{self_ty}` to be a {fn_kind} that returns `{expected_ty}`, but it \
|
||||
"expected `{item}` to be a {fn_kind} that returns `{expected_ty}`, but it \
|
||||
returns `{normalized_ty}`",
|
||||
fn_kind = self_ty.prefix_string(self.tcx)
|
||||
))
|
||||
} else if Some(trait_def_id) == self.tcx.lang_items().future_trait() {
|
||||
Some(format!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue