mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Panic when creating a HirDisplayWrapper with DisplayTarget::SourceCode
This commit is contained in:
parent
ffdb2da49d
commit
a43409fa43
1 changed files with 5 additions and 1 deletions
|
@ -51,6 +51,10 @@ pub trait HirDisplay {
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
|
assert!(
|
||||||
|
!matches!(display_target, DisplayTarget::SourceCode { .. }),
|
||||||
|
"HirDisplayWrapper cannot fail with DisplaySourceCodeError, use HirDisplay::hir_fmt directly instead"
|
||||||
|
);
|
||||||
HirDisplayWrapper { db, t: self, max_size, omit_verbose_types, display_target }
|
HirDisplayWrapper { db, t: self, max_size, omit_verbose_types, display_target }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +239,7 @@ where
|
||||||
Err(HirDisplayError::FmtError) => Err(fmt::Error),
|
Err(HirDisplayError::FmtError) => Err(fmt::Error),
|
||||||
Err(HirDisplayError::DisplaySourceCodeError(_)) => {
|
Err(HirDisplayError::DisplaySourceCodeError(_)) => {
|
||||||
// This should never happen
|
// This should never happen
|
||||||
panic!("HirDisplay failed when calling Display::fmt!")
|
panic!("HirDisplay::hir_fmt failed with DisplaySourceCodeError when calling Display::fmt!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue