Rollup merge of #82720 - henryboisdequin:fix-79040, r=oli-obk
Fix diagnostic suggests adding type `[type error]` Fixes #79040 ### Unresolved questions: <del>Why does this change output the diagnostic twice (`src/test/ui/79040.rs`)?</del> Thanks `````@oli-obk`````
This commit is contained in:
commit
a5a825e6a3
7 changed files with 32 additions and 27 deletions
|
@ -722,11 +722,12 @@ fn infer_placeholder_type(
|
|||
format!("{}: {}", item_ident, ty),
|
||||
Applicability::MachineApplicable,
|
||||
)
|
||||
.emit();
|
||||
.emit_unless(ty.references_error());
|
||||
}
|
||||
None => {
|
||||
let mut diag = bad_placeholder_type(tcx, vec![span]);
|
||||
if !matches!(ty.kind(), ty::Error(_)) {
|
||||
|
||||
if !ty.references_error() {
|
||||
diag.span_suggestion(
|
||||
span,
|
||||
"replace `_` with the correct type",
|
||||
|
@ -734,6 +735,7 @@ fn infer_placeholder_type(
|
|||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
||||
diag.emit();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue