Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
.map(|field_index| {
let coroutine_saved_local = coroutine_layout.variant_fields[variant_index]
[FieldIdx::from_usize(field_index)];
let field_name_maybe = coroutine_layout.field_names[coroutine_saved_local];
let field_name_maybe =
coroutine_layout.field_tys[coroutine_saved_local].debuginfo_name;
let field_name = field_name_maybe
.as_ref()
.map(|s| Cow::from(s.as_str()))
Expand Down
17 changes: 6 additions & 11 deletions compiler/rustc_middle/src/mir/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ fn write_scope_tree(

// Coroutine debuginfo.
if let Some(layout) = body.coroutine_layout_raw() {
for (field, name) in layout.field_names.iter_enumerated() {
let source_info = layout.field_tys[field].source_info;
if let Some(name) = name
for (field, field_decl) in layout.field_tys.iter_enumerated() {
let source_info = field_decl.source_info;
if let Some(name) = field_decl.debuginfo_name
&& source_info.scope == parent
{
let indented_debug_info =
Expand Down Expand Up @@ -559,17 +559,12 @@ fn write_coroutine_layout<'tcx>(
w: &mut dyn io::Write,
options: PrettyPrintMirOptions,
) -> io::Result<()> {
let CoroutineLayout {
field_tys,
field_names: _, // Dumped in scope tree with debug info.
variant_fields,
variant_source_info,
storage_conflicts,
} = layout;
let CoroutineLayout { field_tys, variant_fields, variant_source_info, storage_conflicts } =
layout;

writeln!(w, "{INDENT}coroutine layout {{")?;

for (field, CoroutineSavedTy { ty, source_info, ignore_for_traits }) in
for (field, CoroutineSavedTy { ty, source_info, ignore_for_traits, debuginfo_name: _ }) in
field_tys.iter_enumerated()
{
let ignore_for_traits = if *ignore_for_traits { " (ignored for traits)" } else { "" };
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_middle/src/mir/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub struct CoroutineSavedTy<'tcx> {
pub source_info: SourceInfo,
/// Whether the local should be ignored for trait bound computations.
pub ignore_for_traits: bool,
/// The name for debuginfo.
pub debuginfo_name: Option<Symbol>,
}

/// The layout of coroutine state.
Expand All @@ -36,9 +38,6 @@ pub struct CoroutineLayout<'tcx> {
/// The type of every local stored inside the coroutine.
pub field_tys: IndexVec<CoroutineSavedLocal, CoroutineSavedTy<'tcx>>,

/// The name for debuginfo.
pub field_names: IndexVec<CoroutineSavedLocal, Option<Symbol>>,

/// Which of the above fields are in each variant. Note that one field may
/// be stored in multiple variants.
pub variant_fields: IndexVec<VariantIdx, IndexVec<FieldIdx, CoroutineSavedLocal>>,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,6 @@ impl<'tcx> TyCtxt<'tcx> {
iter::repeat(source_info).take(CoroutineArgs::RESERVED_VARIANTS).collect();
let proxy_layout = CoroutineLayout {
field_tys: [].into(),
field_names: [].into(),
variant_fields,
variant_source_info,
storage_conflicts: BitMatrix::new(0, 0),
Expand Down
Loading
Loading