Skip to content

Commit c1cefa5

Browse files
nikomatsakisbrson
authored andcommitted
Add unsafe tags to usage of LLVM funcs
1 parent 8ea1a8e commit c1cefa5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/comp/middle/trans_common.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,13 @@ fn val_str(tn: type_names, v: ValueRef) -> str { ret ty_str(tn, val_ty(v)); }
428428

429429
// Returns the nth element of the given LLVM structure type.
430430
fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef {
431-
let elt_count = llvm::LLVMCountStructElementTypes(llstructty);
432-
assert (n < elt_count);
433-
let elt_tys = std::vec::init_elt(T_nil(), elt_count);
434-
llvm::LLVMGetStructElementTypes(llstructty, to_ptr(elt_tys));
435-
ret llvm::LLVMGetElementType(elt_tys[n]);
431+
unsafe {
432+
let elt_count = llvm::LLVMCountStructElementTypes(llstructty);
433+
assert (n < elt_count);
434+
let elt_tys = std::vec::init_elt(T_nil(), elt_count);
435+
llvm::LLVMGetStructElementTypes(llstructty, to_ptr(elt_tys));
436+
ret llvm::LLVMGetElementType(elt_tys[n]);
437+
}
436438
}
437439

438440
fn find_scope_cx(cx: @block_ctxt) -> @block_ctxt {

0 commit comments

Comments
 (0)