Skip to content

Commit a8151d7

Browse files
committed
Auto merge of rust-lang#149704 - matthiaskrgr:rollup-u4zhw99, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - rust-lang#146826 (Implement `Allocator` for `&mut A` where `A: Allocator + ?Sized`) - rust-lang#148487 (add Option::into_flat_iter) - rust-lang#148814 (stabilize `array_windows`) - rust-lang#149401 (Fix `name()` functions for local defs in rustc_public) - rust-lang#149683 (Fix armv8r-none-eabihf tier) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 7266423 + 838958c commit a8151d7

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

compiler/rustc_public/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ impl CrateItem {
178178
pub fn emit_mir<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
179179
self.body()
180180
.ok_or_else(|| io::Error::other(format!("No body found for `{}`", self.name())))?
181-
.dump(w, &self.name())
181+
.dump(w, &self.trimmed_name())
182182
}
183183
}
184184

compiler/rustc_public/src/mir/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ fn pretty_aggregate<W: Write>(
412412
}
413413
AggregateKind::Adt(def, var, _, _, _) => {
414414
if def.kind() == AdtKind::Enum {
415-
write!(writer, "{}::{}", def.name(), def.variant(*var).unwrap().name())?;
415+
write!(writer, "{}::{}", def.trimmed_name(), def.variant(*var).unwrap().name())?;
416416
} else {
417417
write!(writer, "{}", def.variant(*var).unwrap().name())?;
418418
}

compiler/rustc_public/src/ty.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,9 @@ pub struct VariantDef {
876876
}
877877

878878
impl VariantDef {
879+
/// The name of the variant, struct or union.
880+
///
881+
/// This will not include the name of the enum or qualified path.
879882
pub fn name(&self) -> Symbol {
880883
with(|cx| cx.variant_name(*self))
881884
}

0 commit comments

Comments
 (0)