Skip to content

Commit

Permalink
Update Rust dependencies (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
idavis authored Feb 1, 2024
1 parent 51a8117 commit caecc47
Show file tree
Hide file tree
Showing 9 changed files with 2,918 additions and 2,103 deletions.
234 changes: 129 additions & 105 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pyqir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ repository = "https://github.com/qir-alliance/pyqir"
[dependencies]
const-str = "0.5"
llvm-sys-110 = { package = "llvm-sys", version = "110.0", optional = true }
llvm-sys-120 = { package = "llvm-sys", version = "120.2", optional = true }
llvm-sys-130 = { package = "llvm-sys", version = "130.0", optional = true }
llvm-sys-140 = { package = "llvm-sys", version = "140.0", optional = true }
pyo3 = { version = "0.17", features = ["abi3-py38", "extension-module"] }
llvm-sys-120 = { package = "llvm-sys", version = "120.3", optional = true }
llvm-sys-130 = { package = "llvm-sys", version = "130.1", optional = true }
llvm-sys-140 = { package = "llvm-sys", version = "140.1", optional = true }
pyo3 = { version = "0.19", features = ["abi3-py38", "extension-module"] }
qirlib = { path = "../qirlib" }

[features]
Expand Down
4,754 changes: 2,775 additions & 1,979 deletions pyqir/NOTICE-WHEEL.txt

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions pyqir/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ impl Instruction {
#[allow(clippy::unnecessary_lazy_evaluations)]
Self::operands(slf, py)?
.into_iter()
.filter_map(|o| {
o.as_ref(py)
.is_instance_of::<BasicBlock>()
.map(|b| b.then(|| o))
.transpose()
})
.filter_map(|o| o.as_ref(py).is_instance_of::<BasicBlock>().then(|| Ok(o)))
.collect()
}
}
Expand Down
2 changes: 1 addition & 1 deletion pyqir/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ impl Deref for Metadata {

/// A metadata string
#[pyclass(extends = Metadata, subclass)]
#[pyo3(text_signature = "(context, string)")]
pub(crate) struct MetadataString;

#[pymethods]
Expand All @@ -82,6 +81,7 @@ impl MetadataString {
/// :param context: The LLVM context.
/// :param string: the value of the metadata string to create
#[new]
#[pyo3(text_signature = "(context, string)")]
pub(crate) unsafe fn new(
py: Python,
context: Py<Context>,
Expand Down
2 changes: 1 addition & 1 deletion pyqir/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use std::{
/// :param Context context: The LLVM context.
/// :param str name: The module name.
#[pyclass(unsendable)]
#[pyo3(text_signature = "(context, name)")]
pub(crate) struct Module {
module: NonNull<LLVMModule>,
context: Py<Context>,
Expand All @@ -44,6 +43,7 @@ pub(crate) struct Module {
#[pymethods]
impl Module {
#[new]
#[pyo3(text_signature = "(context, name)")]
pub(crate) fn new(py: Python, context: Py<Context>, name: &str) -> Self {
let name = CString::new(name).unwrap();
let module = unsafe {
Expand Down
6 changes: 3 additions & 3 deletions pyqir/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ impl Deref for Type {
/// :param Context context: The LLVM context.
/// :param int width: The number of bits in the integer.
#[pyclass(extends = Type)]
#[pyo3(text_signature = "(context, width)")]
pub(crate) struct IntType;

#[pymethods]
impl IntType {
#[new]
#[pyo3(text_signature = "(context, width)")]
fn new(py: Python, context: Py<Context>, width: u32) -> (Self, Type) {
let ty = unsafe { LLVMIntTypeInContext(context.borrow(py).as_ptr(), width) };
(
Expand All @@ -143,12 +143,12 @@ impl IntType {
/// :param Type ret: The return type.
/// :param typing.Sequence[Type] params: The parameter types.
#[pyclass(extends = Type)]
#[pyo3(text_signature = "(ret, params)")]
pub(crate) struct FunctionType;

#[pymethods]
impl FunctionType {
#[new]
#[pyo3(text_signature = "(ret, params)")]
fn new(py: Python, ret: &Type, params: Vec<PyRef<Type>>) -> PyResult<(Self, Type)> {
Owner::merge(
py,
Expand Down Expand Up @@ -277,12 +277,12 @@ impl ArrayType {
///
/// :param Type pointee: The type being pointed to.
#[pyclass(extends = Type)]
#[pyo3(text_signature = "(pointee)")]
pub(crate) struct PointerType;

#[pymethods]
impl PointerType {
#[new]
#[pyo3(text_signature = "(pointee)")]
fn new(py: Python, pointee: &Type) -> (Self, Type) {
let ty = unsafe { LLVMPointerType(pointee.as_ptr(), 0) };
(
Expand Down
2 changes: 1 addition & 1 deletion pyqir/src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ impl From<Py<Module>> for Owner {
/// :param typing.Optional[Function] parent: The parent function.
/// :param typing.Optional[BasicBlock] before: The block to insert this block before.
#[pyclass(extends = Value, unsendable)]
#[pyo3(text_signature = "(context, name, parent=None, before=None)")]
pub(crate) struct BasicBlock(NonNull<LLVMBasicBlock>);

#[pymethods]
impl BasicBlock {
#[new]
#[pyo3(text_signature = "(context, name, parent=None, before=None)")]
fn new(
py: Python,
context: Py<Context>,
Expand Down
6 changes: 3 additions & 3 deletions qirlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ bitvec = "1.0"
const-str = "0.5"
lazy_static = "1.4"
llvm-sys-110 = { package = "llvm-sys", version = "110.0", optional = true }
llvm-sys-120 = { package = "llvm-sys", version = "120.2", optional = true }
llvm-sys-130 = { package = "llvm-sys", version = "130.0", optional = true }
llvm-sys-140 = { package = "llvm-sys", version = "140.0", optional = true }
llvm-sys-120 = { package = "llvm-sys", version = "120.3", optional = true }
llvm-sys-130 = { package = "llvm-sys", version = "130.1", optional = true }
llvm-sys-140 = { package = "llvm-sys", version = "140.1", optional = true }
log = "0.4"
mut_static = "5.0"

Expand Down

0 comments on commit caecc47

Please sign in to comment.