1
Fork 0

Tweak shortening logic to be less trigger happy

This commit is contained in:
Esteban Küber 2022-11-25 18:20:08 -08:00
parent 7674edeeba
commit 360c0a7a3e
4 changed files with 18 additions and 16 deletions

View file

@ -2503,7 +2503,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
Some(match (exp_found.expected.unpack(), exp_found.found.unpack()) {
(ty::TermKind::Ty(expected), ty::TermKind::Ty(found)) => {
let (mut exp, mut fnd) = self.cmp(expected, found);
let len = self.tcx.sess().diagnostic_width().saturating_sub(20);
// Use the terminal width as the basis to determine when to compress the printed
// out type, but give ourselves some leeway to avoid ending up creating a file for
// a type that is somewhat shorter than the path we'd write to.
let len = self.tcx.sess().diagnostic_width() + 40;
let exp_s = exp.content();
let fnd_s = fnd.content();
let mut exp_p = None;