We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 41f27d9 commit a292390Copy full SHA for a292390
compiler/rustc_codegen_llvm/src/type_.rs
@@ -203,7 +203,11 @@ impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
203
}
204
205
fn element_type(&self, ty: &'ll Type) -> &'ll Type {
206
- unsafe { llvm::LLVMGetElementType(ty) }
+ match self.type_kind(ty) {
207
+ TypeKind::Array | TypeKind::Vector => unsafe { llvm::LLVMGetElementType(ty) },
208
+ TypeKind::Pointer => bug!("element_type is not supported for opaque pointers"),
209
+ other => bug!("element_type called on unsupported type {:?}", other),
210
+ }
211
212
213
fn vector_length(&self, ty: &'ll Type) -> usize {
0 commit comments