Fix name and pretty print now uses trimmed_name
This commit is contained in:
parent
2cf9b7f5e5
commit
bb2bfc3f3f
8 changed files with 51 additions and 30 deletions
|
|
@ -178,7 +178,7 @@ impl CrateItem {
|
|||
pub fn emit_mir<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
|
||||
self.body()
|
||||
.ok_or_else(|| io::Error::other(format!("No body found for `{}`", self.name())))?
|
||||
.dump(w, &self.name())
|
||||
.dump(w, &self.trimmed_name())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ fn pretty_aggregate<W: Write>(
|
|||
}
|
||||
AggregateKind::Adt(def, var, _, _, _) => {
|
||||
if def.kind() == AdtKind::Enum {
|
||||
write!(writer, "{}::{}", def.name(), def.variant(*var).unwrap().name())?;
|
||||
write!(writer, "{}::{}", def.trimmed_name(), def.variant(*var).unwrap().name())?;
|
||||
} else {
|
||||
write!(writer, "{}", def.variant(*var).unwrap().name())?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -876,6 +876,9 @@ pub struct VariantDef {
|
|||
}
|
||||
|
||||
impl VariantDef {
|
||||
/// The name of the variant, struct or union.
|
||||
///
|
||||
/// This will not include the name of the enum or qualified path.
|
||||
pub fn name(&self) -> Symbol {
|
||||
with(|cx| cx.variant_name(*self))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue