Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ env:
DOC_PATH: target/doc

jobs:
typos:
runs-on: ubuntu-latest
steps:
- name: Install typos
run: cargo install typos-cli
- name: Typos
run: typos .

tests:
name: "LLVM ${{ matrix.llvm-version[0] }}: ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
needs: typos
strategy:
matrix:
llvm-version:
Expand Down Expand Up @@ -46,6 +55,7 @@ jobs:
run: cargo build --release --features llvm${{ matrix.llvm-version[1] }} --verbose
- name: Run tests
run: cargo test --release --features llvm${{ matrix.llvm-version[1] }} --verbose

doc:
name: Documentation
runs-on: ubuntu-latest
Expand All @@ -67,4 +77,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ env.DOC_PATH }}
force_orphan: true
force_orphan: true
9 changes: 9 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[default]
extend-ignore-identifiers-re = [
"TRE",
"olt",
"isplay",
"toi",
"OLT",
"BVE"
]
6 changes: 2 additions & 4 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ enum PositionState {
pub enum BuilderError {
#[error("Builder position is not set")]
UnsetPosition,
#[error("GEP error: does not point to a struct or index is out of bounds")]
GEPError,
#[error("Alignment error")]
AlignmentError(&'static str),
#[error("Aggregate extract index out of range")]
Expand Down Expand Up @@ -1104,13 +1102,13 @@ impl<'ctx> Builder<'ctx> {
let pointee_ty = ptr_ty.get_element_type();

if !pointee_ty.is_struct_type() {
return Err(BuilderError::GEPError);
return Err(BuilderError::GEPPointee);
}

let struct_ty = pointee_ty.into_struct_type();

if index >= struct_ty.count_fields() {
return Err(BuilderError::GEPError);
return Err(BuilderError::GEPIndex);
}

let c_string = to_c_str(name);
Expand Down