summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_llvm/src/type_of.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/type_of.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/type_of.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs
index dcc62d314..712b6ed53 100644
--- a/compiler/rustc_codegen_llvm/src/type_of.rs
+++ b/compiler/rustc_codegen_llvm/src/type_of.rs
@@ -42,7 +42,7 @@ fn uncached_llvm_type<'a, 'tcx>(
// FIXME(eddyb) producing readable type names for trait objects can result
// in problematically distinct types due to HRTB and subtyping (see #47638).
// ty::Dynamic(..) |
- ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Generator(..) | ty::Str
+ ty::Adt(..) | ty::Closure(..) | ty::Foreign(..) | ty::Coroutine(..) | ty::Str
// For performance reasons we use names only when emitting LLVM IR.
if !cx.sess().fewer_names() =>
{
@@ -54,10 +54,10 @@ fn uncached_llvm_type<'a, 'tcx>(
write!(&mut name, "::{}", def.variant(index).name).unwrap();
}
}
- if let (&ty::Generator(_, _, _), &Variants::Single { index }) =
+ if let (&ty::Coroutine(_, _, _), &Variants::Single { index }) =
(layout.ty.kind(), &layout.variants)
{
- write!(&mut name, "::{}", ty::GeneratorArgs::variant_name(index)).unwrap();
+ write!(&mut name, "::{}", ty::CoroutineArgs::variant_name(index)).unwrap();
}
Some(name)
}
@@ -397,7 +397,12 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
// extracts all the individual values.
let ety = element.llvm_type(cx);
- return Some(cx.type_vector(ety, *count));
+ if *count == 1 {
+ // Emitting `<1 x T>` would be silly; just use the scalar.
+ return Some(ety);
+ } else {
+ return Some(cx.type_vector(ety, *count));
+ }
}
// FIXME: The above only handled integer arrays; surely more things