s/generator/coroutine/

This commit is contained in:
Oli Scherer 2023-10-19 21:46:28 +00:00
parent 60956837cf
commit e96ce20b34
468 changed files with 2201 additions and 2197 deletions

View file

@ -460,7 +460,7 @@ pub fn type_di_node<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll D
}
ty::FnDef(..) | ty::FnPtr(_) => build_subroutine_type_di_node(cx, unique_type_id),
ty::Closure(..) => build_closure_env_di_node(cx, unique_type_id),
ty::Coroutine(..) => enums::build_generator_di_node(cx, unique_type_id),
ty::Coroutine(..) => enums::build_coroutine_di_node(cx, unique_type_id),
ty::Adt(def, ..) => match def.adt_kind() {
AdtKind::Struct => build_struct_type_di_node(cx, unique_type_id),
AdtKind::Union => build_union_type_di_node(cx, unique_type_id),
@ -1026,20 +1026,20 @@ fn build_struct_type_di_node<'ll, 'tcx>(
// Tuples
//=-----------------------------------------------------------------------------
/// Builds the DW_TAG_member debuginfo nodes for the upvars of a closure or generator.
/// For a generator, this will handle upvars shared by all states.
/// Builds the DW_TAG_member debuginfo nodes for the upvars of a closure or coroutine.
/// For a coroutine, this will handle upvars shared by all states.
fn build_upvar_field_di_nodes<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
closure_or_generator_ty: Ty<'tcx>,
closure_or_generator_di_node: &'ll DIType,
closure_or_coroutine_ty: Ty<'tcx>,
closure_or_coroutine_di_node: &'ll DIType,
) -> SmallVec<&'ll DIType> {
let (&def_id, up_var_tys) = match closure_or_generator_ty.kind() {
ty::Coroutine(def_id, args, _) => (def_id, args.as_generator().prefix_tys()),
let (&def_id, up_var_tys) = match closure_or_coroutine_ty.kind() {
ty::Coroutine(def_id, args, _) => (def_id, args.as_coroutine().prefix_tys()),
ty::Closure(def_id, args) => (def_id, args.as_closure().upvar_tys()),
_ => {
bug!(
"build_upvar_field_di_nodes() called with non-closure-or-generator-type: {:?}",
closure_or_generator_ty
"build_upvar_field_di_nodes() called with non-closure-or-coroutine-type: {:?}",
closure_or_coroutine_ty
)
}
};
@ -1049,7 +1049,7 @@ fn build_upvar_field_di_nodes<'ll, 'tcx>(
);
let capture_names = cx.tcx.closure_saved_names_of_captured_variables(def_id);
let layout = cx.layout_of(closure_or_generator_ty);
let layout = cx.layout_of(closure_or_coroutine_ty);
up_var_tys
.into_iter()
@ -1058,7 +1058,7 @@ fn build_upvar_field_di_nodes<'ll, 'tcx>(
.map(|(index, (up_var_ty, capture_name))| {
build_field_di_node(
cx,
closure_or_generator_di_node,
closure_or_coroutine_di_node,
capture_name.as_str(),
cx.size_and_align_of(up_var_ty),
layout.fields.offset(index),

View file

@ -268,18 +268,18 @@ pub(super) fn build_enum_type_di_node<'ll, 'tcx>(
)
}
/// A generator debuginfo node looks the same as a that of an enum type.
/// A coroutine debuginfo node looks the same as a that of an enum type.
///
/// See [build_enum_type_di_node] for more information.
pub(super) fn build_generator_di_node<'ll, 'tcx>(
pub(super) fn build_coroutine_di_node<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
unique_type_id: UniqueTypeId<'tcx>,
) -> DINodeCreationResult<'ll> {
let generator_type = unique_type_id.expect_ty();
let generator_type_and_layout = cx.layout_of(generator_type);
let generator_type_name = compute_debuginfo_type_name(cx.tcx, generator_type, false);
let coroutine_type = unique_type_id.expect_ty();
let coroutine_type_and_layout = cx.layout_of(coroutine_type);
let coroutine_type_name = compute_debuginfo_type_name(cx.tcx, coroutine_type, false);
debug_assert!(!wants_c_like_enum_debuginfo(generator_type_and_layout));
debug_assert!(!wants_c_like_enum_debuginfo(coroutine_type_and_layout));
type_map::build_type_with_children(
cx,
@ -287,24 +287,24 @@ pub(super) fn build_generator_di_node<'ll, 'tcx>(
cx,
type_map::Stub::Union,
unique_type_id,
&generator_type_name,
size_and_align_of(generator_type_and_layout),
&coroutine_type_name,
size_and_align_of(coroutine_type_and_layout),
NO_SCOPE_METADATA,
DIFlags::FlagZero,
),
|cx, generator_type_di_node| match generator_type_and_layout.variants {
|cx, coroutine_type_di_node| match coroutine_type_and_layout.variants {
Variants::Multiple { tag_encoding: TagEncoding::Direct, .. } => {
build_union_fields_for_direct_tag_generator(
build_union_fields_for_direct_tag_coroutine(
cx,
generator_type_and_layout,
generator_type_di_node,
coroutine_type_and_layout,
coroutine_type_di_node,
)
}
Variants::Single { .. }
| Variants::Multiple { tag_encoding: TagEncoding::Niche { .. }, .. } => {
bug!(
"Encountered generator with non-direct-tag layout: {:?}",
generator_type_and_layout
"Encountered coroutine with non-direct-tag layout: {:?}",
coroutine_type_and_layout
)
}
},
@ -428,7 +428,7 @@ fn build_union_fields_for_enum<'ll, 'tcx>(
})
.collect();
build_union_fields_for_direct_tag_enum_or_generator(
build_union_fields_for_direct_tag_enum_or_coroutine(
cx,
enum_type_and_layout,
enum_type_di_node,
@ -469,8 +469,8 @@ fn build_variant_names_type_di_node<'ll, 'tcx>(
fn build_variant_struct_wrapper_type_di_node<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
enum_or_generator_type_and_layout: TyAndLayout<'tcx>,
enum_or_generator_type_di_node: &'ll DIType,
enum_or_coroutine_type_and_layout: TyAndLayout<'tcx>,
enum_or_coroutine_type_di_node: &'ll DIType,
variant_index: VariantIdx,
untagged_variant_index: Option<VariantIdx>,
variant_struct_type_di_node: &'ll DIType,
@ -486,13 +486,13 @@ fn build_variant_struct_wrapper_type_di_node<'ll, 'tcx>(
Stub::Struct,
UniqueTypeId::for_enum_variant_struct_type_wrapper(
cx.tcx,
enum_or_generator_type_and_layout.ty,
enum_or_coroutine_type_and_layout.ty,
variant_index,
),
&variant_struct_wrapper_type_name(variant_index),
// NOTE: We use size and align of enum_type, not from variant_layout:
size_and_align_of(enum_or_generator_type_and_layout),
Some(enum_or_generator_type_di_node),
size_and_align_of(enum_or_coroutine_type_and_layout),
Some(enum_or_coroutine_type_di_node),
DIFlags::FlagZero,
),
|cx, wrapper_struct_type_di_node| {
@ -535,7 +535,7 @@ fn build_variant_struct_wrapper_type_di_node<'ll, 'tcx>(
cx,
wrapper_struct_type_di_node,
"value",
size_and_align_of(enum_or_generator_type_and_layout),
size_and_align_of(enum_or_coroutine_type_and_layout),
Size::ZERO,
DIFlags::FlagZero,
variant_struct_type_di_node,
@ -662,40 +662,40 @@ fn split_128(value: u128) -> Split128 {
Split128 { hi: (value >> 64) as u64, lo: value as u64 }
}
fn build_union_fields_for_direct_tag_generator<'ll, 'tcx>(
fn build_union_fields_for_direct_tag_coroutine<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
generator_type_and_layout: TyAndLayout<'tcx>,
generator_type_di_node: &'ll DIType,
coroutine_type_and_layout: TyAndLayout<'tcx>,
coroutine_type_di_node: &'ll DIType,
) -> SmallVec<&'ll DIType> {
let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag_field, .. } =
generator_type_and_layout.variants
coroutine_type_and_layout.variants
else {
bug!("This function only supports layouts with directly encoded tags.")
};
let (generator_def_id, generator_args) = match generator_type_and_layout.ty.kind() {
&ty::Coroutine(def_id, args, _) => (def_id, args.as_generator()),
let (coroutine_def_id, coroutine_args) = match coroutine_type_and_layout.ty.kind() {
&ty::Coroutine(def_id, args, _) => (def_id, args.as_coroutine()),
_ => unreachable!(),
};
let generator_layout = cx.tcx.optimized_mir(generator_def_id).generator_layout().unwrap();
let coroutine_layout = cx.tcx.optimized_mir(coroutine_def_id).coroutine_layout().unwrap();
let common_upvar_names = cx.tcx.closure_saved_names_of_captured_variables(generator_def_id);
let variant_range = generator_args.variant_range(generator_def_id, cx.tcx);
let common_upvar_names = cx.tcx.closure_saved_names_of_captured_variables(coroutine_def_id);
let variant_range = coroutine_args.variant_range(coroutine_def_id, cx.tcx);
let variant_count = (variant_range.start.as_u32()..variant_range.end.as_u32()).len();
let tag_base_type = tag_base_type(cx, generator_type_and_layout);
let tag_base_type = tag_base_type(cx, coroutine_type_and_layout);
let variant_names_type_di_node = build_variant_names_type_di_node(
cx,
generator_type_di_node,
coroutine_type_di_node,
variant_range
.clone()
.map(|variant_index| (variant_index, CoroutineArgs::variant_name(variant_index))),
);
let discriminants: IndexVec<VariantIdx, DiscrResult> = {
let discriminants_iter = generator_args.discriminants(generator_def_id, cx.tcx);
let discriminants_iter = coroutine_args.discriminants(coroutine_def_id, cx.tcx);
let mut discriminants: IndexVec<VariantIdx, DiscrResult> =
IndexVec::with_capacity(variant_count);
for (variant_index, discr) in discriminants_iter {
@ -709,16 +709,16 @@ fn build_union_fields_for_direct_tag_generator<'ll, 'tcx>(
// Build the type node for each field.
let variant_field_infos: SmallVec<VariantFieldInfo<'ll>> = variant_range
.map(|variant_index| {
let variant_struct_type_di_node = super::build_generator_variant_struct_type_di_node(
let variant_struct_type_di_node = super::build_coroutine_variant_struct_type_di_node(
cx,
variant_index,
generator_type_and_layout,
generator_type_di_node,
generator_layout,
coroutine_type_and_layout,
coroutine_type_di_node,
coroutine_layout,
&common_upvar_names,
);
let span = generator_layout.variant_source_info[variant_index].span;
let span = coroutine_layout.variant_source_info[variant_index].span;
let source_info = if !span.is_dummy() {
let loc = cx.lookup_debug_loc(span.lo());
Some((file_metadata(cx, &loc.file), loc.line as c_uint))
@ -735,10 +735,10 @@ fn build_union_fields_for_direct_tag_generator<'ll, 'tcx>(
})
.collect();
build_union_fields_for_direct_tag_enum_or_generator(
build_union_fields_for_direct_tag_enum_or_coroutine(
cx,
generator_type_and_layout,
generator_type_di_node,
coroutine_type_and_layout,
coroutine_type_di_node,
&variant_field_infos[..],
variant_names_type_di_node,
tag_base_type,
@ -747,9 +747,9 @@ fn build_union_fields_for_direct_tag_generator<'ll, 'tcx>(
)
}
/// This is a helper function shared between enums and generators that makes sure fields have the
/// This is a helper function shared between enums and coroutines that makes sure fields have the
/// expect names.
fn build_union_fields_for_direct_tag_enum_or_generator<'ll, 'tcx>(
fn build_union_fields_for_direct_tag_enum_or_coroutine<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
enum_type_and_layout: TyAndLayout<'tcx>,
enum_type_di_node: &'ll DIType,

View file

@ -66,14 +66,14 @@ pub(super) fn build_enum_type_di_node<'ll, 'tcx>(
}
}
pub(super) fn build_generator_di_node<'ll, 'tcx>(
pub(super) fn build_coroutine_di_node<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
unique_type_id: UniqueTypeId<'tcx>,
) -> DINodeCreationResult<'ll> {
if cpp_like_debuginfo(cx.tcx) {
cpp_like::build_generator_di_node(cx, unique_type_id)
cpp_like::build_coroutine_di_node(cx, unique_type_id)
} else {
native::build_generator_di_node(cx, unique_type_id)
native::build_coroutine_di_node(cx, unique_type_id)
}
}
@ -101,7 +101,7 @@ fn build_c_style_enum_di_node<'ll, 'tcx>(
}
}
/// Extract the type with which we want to describe the tag of the given enum or generator.
/// Extract the type with which we want to describe the tag of the given enum or coroutine.
fn tag_base_type<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
enum_type_and_layout: TyAndLayout<'tcx>,
@ -300,8 +300,8 @@ fn build_enum_variant_struct_type_di_node<'ll, 'tcx>(
.di_node
}
/// Build the struct type for describing a single generator state.
/// See [build_generator_variant_struct_type_di_node].
/// Build the struct type for describing a single coroutine state.
/// See [build_coroutine_variant_struct_type_di_node].
///
/// ```txt
///
@ -317,25 +317,25 @@ fn build_enum_variant_struct_type_di_node<'ll, 'tcx>(
/// ---> DW_TAG_structure_type (type of variant 3)
///
/// ```
pub fn build_generator_variant_struct_type_di_node<'ll, 'tcx>(
pub fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
variant_index: VariantIdx,
generator_type_and_layout: TyAndLayout<'tcx>,
generator_type_di_node: &'ll DIType,
generator_layout: &CoroutineLayout<'tcx>,
coroutine_type_and_layout: TyAndLayout<'tcx>,
coroutine_type_di_node: &'ll DIType,
coroutine_layout: &CoroutineLayout<'tcx>,
common_upvar_names: &IndexSlice<FieldIdx, Symbol>,
) -> &'ll DIType {
let variant_name = CoroutineArgs::variant_name(variant_index);
let unique_type_id = UniqueTypeId::for_enum_variant_struct_type(
cx.tcx,
generator_type_and_layout.ty,
coroutine_type_and_layout.ty,
variant_index,
);
let variant_layout = generator_type_and_layout.for_variant(cx, variant_index);
let variant_layout = coroutine_type_and_layout.for_variant(cx, variant_index);
let generator_args = match generator_type_and_layout.ty.kind() {
ty::Coroutine(_, args, _) => args.as_generator(),
let coroutine_args = match coroutine_type_and_layout.ty.kind() {
ty::Coroutine(_, args, _) => args.as_coroutine(),
_ => unreachable!(),
};
@ -346,17 +346,17 @@ pub fn build_generator_variant_struct_type_di_node<'ll, 'tcx>(
Stub::Struct,
unique_type_id,
&variant_name,
size_and_align_of(generator_type_and_layout),
Some(generator_type_di_node),
size_and_align_of(coroutine_type_and_layout),
Some(coroutine_type_di_node),
DIFlags::FlagZero,
),
|cx, variant_struct_type_di_node| {
// Fields that just belong to this variant/state
let state_specific_fields: SmallVec<_> = (0..variant_layout.fields.count())
.map(|field_index| {
let generator_saved_local = generator_layout.variant_fields[variant_index]
let coroutine_saved_local = coroutine_layout.variant_fields[variant_index]
[FieldIdx::from_usize(field_index)];
let field_name_maybe = generator_layout.field_names[generator_saved_local];
let field_name_maybe = coroutine_layout.field_names[coroutine_saved_local];
let field_name = field_name_maybe
.as_ref()
.map(|s| Cow::from(s.as_str()))
@ -377,7 +377,7 @@ pub fn build_generator_variant_struct_type_di_node<'ll, 'tcx>(
.collect();
// Fields that are common to all states
let common_fields: SmallVec<_> = generator_args
let common_fields: SmallVec<_> = coroutine_args
.prefix_tys()
.iter()
.zip(common_upvar_names)
@ -388,7 +388,7 @@ pub fn build_generator_variant_struct_type_di_node<'ll, 'tcx>(
variant_struct_type_di_node,
upvar_name.as_str(),
cx.size_and_align_of(upvar_ty),
generator_type_and_layout.fields.offset(index),
coroutine_type_and_layout.fields.offset(index),
DIFlags::FlagZero,
type_di_node(cx, upvar_ty),
)
@ -397,7 +397,7 @@ pub fn build_generator_variant_struct_type_di_node<'ll, 'tcx>(
state_specific_fields.into_iter().chain(common_fields.into_iter()).collect()
},
|cx| build_generic_type_param_di_nodes(cx, generator_type_and_layout.ty),
|cx| build_generic_type_param_di_nodes(cx, coroutine_type_and_layout.ty),
)
.di_node
}

View file

@ -110,12 +110,12 @@ pub(super) fn build_enum_type_di_node<'ll, 'tcx>(
)
}
/// Build the debuginfo node for a generator environment. It looks the same as the debuginfo for
/// Build the debuginfo node for a coroutine environment. It looks the same as the debuginfo for
/// an enum. See [build_enum_type_di_node] for more information.
///
/// ```txt
///
/// ---> DW_TAG_structure_type (top-level type for the generator)
/// ---> DW_TAG_structure_type (top-level type for the coroutine)
/// DW_TAG_variant_part (variant part)
/// DW_AT_discr (reference to discriminant DW_TAG_member)
/// DW_TAG_member (discriminant member)
@ -127,21 +127,21 @@ pub(super) fn build_enum_type_di_node<'ll, 'tcx>(
/// DW_TAG_structure_type (type of variant 3)
///
/// ```
pub(super) fn build_generator_di_node<'ll, 'tcx>(
pub(super) fn build_coroutine_di_node<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
unique_type_id: UniqueTypeId<'tcx>,
) -> DINodeCreationResult<'ll> {
let generator_type = unique_type_id.expect_ty();
let &ty::Coroutine(generator_def_id, _, _) = generator_type.kind() else {
bug!("build_generator_di_node() called with non-generator type: `{:?}`", generator_type)
let coroutine_type = unique_type_id.expect_ty();
let &ty::Coroutine(coroutine_def_id, _, _) = coroutine_type.kind() else {
bug!("build_coroutine_di_node() called with non-coroutine type: `{:?}`", coroutine_type)
};
let containing_scope = get_namespace_for_item(cx, generator_def_id);
let generator_type_and_layout = cx.layout_of(generator_type);
let containing_scope = get_namespace_for_item(cx, coroutine_def_id);
let coroutine_type_and_layout = cx.layout_of(coroutine_type);
debug_assert!(!wants_c_like_enum_debuginfo(generator_type_and_layout));
debug_assert!(!wants_c_like_enum_debuginfo(coroutine_type_and_layout));
let generator_type_name = compute_debuginfo_type_name(cx.tcx, generator_type, false);
let coroutine_type_name = compute_debuginfo_type_name(cx.tcx, coroutine_type, false);
type_map::build_type_with_children(
cx,
@ -149,26 +149,26 @@ pub(super) fn build_generator_di_node<'ll, 'tcx>(
cx,
Stub::Struct,
unique_type_id,
&generator_type_name,
size_and_align_of(generator_type_and_layout),
&coroutine_type_name,
size_and_align_of(coroutine_type_and_layout),
Some(containing_scope),
DIFlags::FlagZero,
),
|cx, generator_type_di_node| {
let generator_layout =
cx.tcx.optimized_mir(generator_def_id).generator_layout().unwrap();
|cx, coroutine_type_di_node| {
let coroutine_layout =
cx.tcx.optimized_mir(coroutine_def_id).coroutine_layout().unwrap();
let Variants::Multiple { tag_encoding: TagEncoding::Direct, ref variants, .. } =
generator_type_and_layout.variants
coroutine_type_and_layout.variants
else {
bug!(
"Encountered generator with non-direct-tag layout: {:?}",
generator_type_and_layout
"Encountered coroutine with non-direct-tag layout: {:?}",
coroutine_type_and_layout
)
};
let common_upvar_names =
cx.tcx.closure_saved_names_of_captured_variables(generator_def_id);
cx.tcx.closure_saved_names_of_captured_variables(coroutine_def_id);
// Build variant struct types
let variant_struct_type_di_nodes: SmallVec<_> = variants
@ -179,7 +179,7 @@ pub(super) fn build_generator_di_node<'ll, 'tcx>(
// with enums?
let variant_name = format!("{}", variant_index.as_usize()).into();
let span = generator_layout.variant_source_info[variant_index].span;
let span = coroutine_layout.variant_source_info[variant_index].span;
let source_info = if !span.is_dummy() {
let loc = cx.lookup_debug_loc(span.lo());
Some((file_metadata(cx, &loc.file), loc.line))
@ -191,12 +191,12 @@ pub(super) fn build_generator_di_node<'ll, 'tcx>(
variant_index,
variant_name,
variant_struct_type_di_node:
super::build_generator_variant_struct_type_di_node(
super::build_coroutine_variant_struct_type_di_node(
cx,
variant_index,
generator_type_and_layout,
generator_type_di_node,
generator_layout,
coroutine_type_and_layout,
coroutine_type_di_node,
coroutine_layout,
&common_upvar_names,
),
source_info,
@ -206,18 +206,18 @@ pub(super) fn build_generator_di_node<'ll, 'tcx>(
smallvec![build_enum_variant_part_di_node(
cx,
generator_type_and_layout,
generator_type_di_node,
coroutine_type_and_layout,
coroutine_type_di_node,
&variant_struct_type_di_nodes[..],
)]
},
// We don't seem to be emitting generic args on the generator type, it seems. Rather
// We don't seem to be emitting generic args on the coroutine type, it seems. Rather
// they get attached to the struct type of each variant.
NO_GENERICS,
)
}
/// Builds the DW_TAG_variant_part of an enum or generator debuginfo node:
/// Builds the DW_TAG_variant_part of an enum or coroutine debuginfo node:
///
/// ```txt
/// DW_TAG_structure_type (top-level type for enum)
@ -306,10 +306,10 @@ fn build_enum_variant_part_di_node<'ll, 'tcx>(
/// ```
fn build_discr_member_di_node<'ll, 'tcx>(
cx: &CodegenCx<'ll, 'tcx>,
enum_or_generator_type_and_layout: TyAndLayout<'tcx>,
enum_or_generator_type_di_node: &'ll DIType,
enum_or_coroutine_type_and_layout: TyAndLayout<'tcx>,
enum_or_coroutine_type_di_node: &'ll DIType,
) -> Option<&'ll DIType> {
let tag_name = match enum_or_generator_type_and_layout.ty.kind() {
let tag_name = match enum_or_coroutine_type_and_layout.ty.kind() {
ty::Coroutine(..) => "__state",
_ => "",
};
@ -320,14 +320,14 @@ fn build_discr_member_di_node<'ll, 'tcx>(
// In LLVM IR the wrong scope will be listed but when DWARF is
// generated from it, the DW_TAG_member will be a child the
// DW_TAG_variant_part.
let containing_scope = enum_or_generator_type_di_node;
let containing_scope = enum_or_coroutine_type_di_node;
match enum_or_generator_type_and_layout.layout.variants() {
match enum_or_coroutine_type_and_layout.layout.variants() {
// A single-variant enum has no discriminant.
&Variants::Single { .. } => None,
&Variants::Multiple { tag_field, .. } => {
let tag_base_type = tag_base_type(cx, enum_or_generator_type_and_layout);
let tag_base_type = tag_base_type(cx, enum_or_coroutine_type_and_layout);
let (size, align) = cx.size_and_align_of(tag_base_type);
unsafe {
@ -340,7 +340,7 @@ fn build_discr_member_di_node<'ll, 'tcx>(
UNKNOWN_LINE_NUMBER,
size.bits(),
align.bits() as u32,
enum_or_generator_type_and_layout.fields.offset(tag_field).bits(),
enum_or_coroutine_type_and_layout.fields.offset(tag_field).bits(),
DIFlags::FlagArtificial,
type_di_node(cx, tag_base_type),
))

View file

@ -43,7 +43,7 @@ pub(super) enum UniqueTypeId<'tcx> {
/// The ID of a regular type as it shows up at the language level.
Ty(Ty<'tcx>, private::HiddenZst),
/// The ID for the single DW_TAG_variant_part nested inside the top-level
/// DW_TAG_structure_type that describes enums and generators.
/// DW_TAG_structure_type that describes enums and coroutines.
VariantPart(Ty<'tcx>, private::HiddenZst),
/// The ID for the artificial struct type describing a single enum variant.
VariantStructType(Ty<'tcx>, VariantIdx, private::HiddenZst),

View file

@ -342,7 +342,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
// We look up the generics of the enclosing function and truncate the args
// to their length in order to cut off extra stuff that might be in there for
// closures or generators.
// closures or coroutines.
let generics = tcx.generics_of(enclosing_fn_def_id);
let args = instance.args.truncate_to(tcx, generics);