Shorten type in note
This commit is contained in:
parent
df2a35ea3d
commit
b400bde52a
@ -5,6 +5,7 @@ use rustc_hir::intravisit;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_hir::{HirId, Node};
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::print::with_forced_trimmed_paths;
|
||||
use rustc_middle::ty::subst::InternalSubsts;
|
||||
use rustc_middle::ty::util::IntTypeExt;
|
||||
use rustc_middle::ty::{self, DefIdTree, Ty, TyCtxt, TypeFolder, TypeSuperFoldable, TypeVisitable};
|
||||
@ -907,10 +908,10 @@ fn infer_placeholder_type<'a>(
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else {
|
||||
err.span_note(
|
||||
with_forced_trimmed_paths!(err.span_note(
|
||||
tcx.hir().body(body_id).value.span,
|
||||
&format!("however, the inferred type `{}` cannot be named", ty),
|
||||
);
|
||||
&format!("however, the inferred type `{ty}` cannot be named"),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@ -931,10 +932,10 @@ fn infer_placeholder_type<'a>(
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
} else {
|
||||
diag.span_note(
|
||||
with_forced_trimmed_paths!(diag.span_note(
|
||||
tcx.hir().body(body_id).value.span,
|
||||
&format!("however, the inferred type `{}` cannot be named", ty),
|
||||
);
|
||||
&format!("however, the inferred type `{ty}` cannot be named"),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
|
||||
LL | const C: _ = || 42;
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
note: however, the inferred type `[closure@$DIR/unnamable-types.rs:17:14: 17:16]` cannot be named
|
||||
note: however, the inferred type `[closure@unnamable-types.rs:17:14]` cannot be named
|
||||
--> $DIR/unnamable-types.rs:17:14
|
||||
|
|
||||
LL | const C: _ = || 42;
|
||||
@ -31,7 +31,7 @@ error: missing type for `const` item
|
||||
LL | const D = S { t: { let i = 0; move || -> i32 { i } } };
|
||||
| ^
|
||||
|
|
||||
note: however, the inferred type `S<[closure@$DIR/unnamable-types.rs:23:31: 23:45]>` cannot be named
|
||||
note: however, the inferred type `S<[closure@unnamable-types.rs:23:31]>` cannot be named
|
||||
--> $DIR/unnamable-types.rs:23:11
|
||||
|
|
||||
LL | const D = S { t: { let i = 0; move || -> i32 { i } } };
|
||||
|
@ -443,7 +443,7 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures
|
||||
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
|
||||
| ^ not allowed in type signatures
|
||||
|
|
||||
note: however, the inferred type `Map<Filter<std::ops::Range<i32>, [closure@$DIR/typeck_type_placeholder_item.rs:229:29: 229:32]>, [closure@$DIR/typeck_type_placeholder_item.rs:229:49: 229:52]>` cannot be named
|
||||
note: however, the inferred type `Map<Filter<Range<i32>, [closure@typeck_type_placeholder_item.rs:229:29]>, [closure@typeck_type_placeholder_item.rs:229:49]>` cannot be named
|
||||
--> $DIR/typeck_type_placeholder_item.rs:229:14
|
||||
|
|
||||
LL | const _: _ = (1..10).filter(|x| x % 2 == 0).map(|x| x * x);
|
||||
|
Loading…
x
Reference in New Issue
Block a user