diff options
| author | Yuki Okushi <huyuumi.dev+love@gmail.com> | 2022-11-07 09:46:26 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-07 09:46:26 +0900 |
| commit | 06e261aaf57e49c5650513f5ab262c20f1e7ebfe (patch) | |
| tree | a1abcff68c7fe78ce55e6c00e4c291c61d1e5435 /compiler/rustc_codegen_llvm/src | |
| parent | 19c780ab1361efdb2a416f035e87dd9140d63901 (diff) | |
| parent | 299bc61035466b3e6ce0af78d19996a5eef6e294 (diff) | |
| download | rust-06e261aaf57e49c5650513f5ab262c20f1e7ebfe.tar.gz rust-06e261aaf57e49c5650513f5ab262c20f1e7ebfe.zip | |
Rollup merge of #104045 - Ayush1325:type_array, r=nikic
Add type_array to BaseTypeMethods Moved `type_array` function to `rustc_codegen_ssa::BaseTypeMethods` trait. This allows using normal `alloca` function to create arrays as suggested in https://github.com/rust-lang/rust/pull/104022. Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/type_.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/type_.rs b/compiler/rustc_codegen_llvm/src/type_.rs index eeb38d4ecf5..5eec7dc6130 100644 --- a/compiler/rustc_codegen_llvm/src/type_.rs +++ b/compiler/rustc_codegen_llvm/src/type_.rs @@ -127,10 +127,6 @@ impl<'ll> CodegenCx<'ll, '_> { pub(crate) fn type_variadic_func(&self, args: &[&'ll Type], ret: &'ll Type) -> &'ll Type { unsafe { llvm::LLVMFunctionType(ret, args.as_ptr(), args.len() as c_uint, True) } } - - pub(crate) fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type { - unsafe { llvm::LLVMRustArrayType(ty, len) } - } } impl<'ll, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { @@ -231,6 +227,10 @@ impl<'ll, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn val_ty(&self, v: &'ll Value) -> &'ll Type { common::val_ty(v) } + + fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type { + unsafe { llvm::LLVMRustArrayType(ty, len) } + } } impl Type { |
