Rollup merge of #129344 - compiler-errors:less-option-unit-diagnostics, r=jieyouxu
Use `bool` in favor of `Option<()>` for diagnostics
We originally only supported `Option<()>` for optional notes/labels, but we now support `bool`. Let's use that, since it usually leads to more readable code.
I'm not removing the support from the derive macro, though I guess we could error on it... 🤔
This commit is contained in:
commit
937a18daf9
48 changed files with 106 additions and 121 deletions
|
@ -160,7 +160,7 @@ pub struct TypeLengthLimit {
|
|||
pub span: Span,
|
||||
pub shrunk: String,
|
||||
#[note(middle_written_to_path)]
|
||||
pub was_written: Option<()>,
|
||||
pub was_written: bool,
|
||||
pub path: PathBuf,
|
||||
pub type_length: usize,
|
||||
}
|
||||
|
|
|
@ -581,9 +581,9 @@ impl<'tcx> Instance<'tcx> {
|
|||
let mut path = PathBuf::new();
|
||||
let was_written = if let Some(path2) = written_to_path {
|
||||
path = path2;
|
||||
Some(())
|
||||
true
|
||||
} else {
|
||||
None
|
||||
false
|
||||
};
|
||||
tcx.dcx().emit_fatal(error::TypeLengthLimit {
|
||||
// We don't use `def_span(def_id)` so that diagnostics point
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue