mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Add enum, reference, array and slice to render_const_scalar
This commit is contained in:
parent
4458e7f190
commit
f9e3b180b7
9 changed files with 561 additions and 115 deletions
|
@ -2107,14 +2107,6 @@ impl Const {
|
|||
pub fn render_eval(self, db: &dyn HirDatabase) -> Result<String, ConstEvalError> {
|
||||
let c = db.const_eval(self.id.into(), Substitution::empty(Interner))?;
|
||||
let r = format!("{}", HexifiedConst(c).display(db));
|
||||
// We want to see things like `<utf8-error>` and `<layout-error>` as they are probably bug in our
|
||||
// implementation, but there is no need to show things like `<enum-not-supported>` or `<ref-not-supported>` to
|
||||
// the user.
|
||||
if r.contains("not-supported>") {
|
||||
return Err(ConstEvalError::MirEvalError(MirEvalError::NotSupported(
|
||||
"rendering complex constants".to_string(),
|
||||
)));
|
||||
}
|
||||
return Ok(r);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue