1
Fork 0

Rollup merge of #104922 - estebank:fur-elize, r=oli-obk

Detect long types in E0308 and write them to disk

On type error with long types, print an abridged type and write the full type to disk.

Print the widest possible short type while still fitting in the terminal.
This commit is contained in:
Matthias Krüger 2022-12-08 12:57:28 +01:00 committed by GitHub
commit 086bdbbd73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 316 additions and 101 deletions

View file

@ -952,6 +952,17 @@ impl Session {
) -> Option<Symbol> {
attrs.iter().find(|at| at.has_name(name)).and_then(|at| at.value_str())
}
pub fn diagnostic_width(&self) -> usize {
let default_column_width = 140;
if let Some(width) = self.opts.diagnostic_width {
width
} else if self.opts.unstable_opts.ui_testing {
default_column_width
} else {
termize::dimensions().map_or(default_column_width, |(w, _)| w)
}
}
}
// JUSTIFICATION: defn of the suggested wrapper fns