Skip to content

Commit

Permalink
Bump minimum supported Rust version to 1.63
Browse files Browse the repository at this point in the history
This is required by recent versions of the `cc` crate.

Cargo.lock is now committed so we are not forced to bump Rust versions in the future.
  • Loading branch information
ebarnard committed Dec 1, 2024
1 parent ce097de commit 9046c46
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
include:
- os: ubuntu-18.04
target: x86_64-unknown-linux-gnu
channel: 1.34.0
channel: 1.63
- os: ubuntu-18.04
target: x86_64-unknown-linux-gnu
channel: stable
Expand All @@ -32,21 +32,21 @@ jobs:

- os: macos-10.15
target: x86_64-apple-darwin
channel: 1.34.0
channel: 1.63
- os: macos-10.15
target: x86_64-apple-darwin
channel: stable

- os: windows-2019
target: x86_64-pc-windows-msvc
channel: 1.34.0
channel: 1.63
- os: windows-2019
target: x86_64-pc-windows-msvc
channel: stable

- os: windows-2019
target: i686-pc-windows-msvc
channel: 1.34.0
channel: 1.63
- os: windows-2019
target: i686-pc-windows-msvc
channel: stable
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# will have compiled files and executables
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
49 changes: 49 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "osqp"
version = "0.6.2"
edition = "2015"
rust-version = "1.63"
description = "The OSQP (Operator Splitting Quadratic Program) solver."
authors = ["Edward Barnard <[email protected]>"]
license = "Apache-2.0"
Expand Down
2 changes: 2 additions & 0 deletions osqp-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[package]
name = "osqp-sys"
version = "0.6.2"
edition = "2015"
rust-version = "1.63"
description = "FFI bindings to the OSQP (Operator Splitting Quadratic Program) solver."
authors = ["Edward Barnard <[email protected]>"]
license = "Apache-2.0"
Expand Down
3 changes: 2 additions & 1 deletion osqp-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ fn main() {
}

// Try to make c_int the same size as the target pointer width (i.e. 32 or 64 bits)
println!("cargo:rustc-check-cfg=cfg(osqp_dlong)");
let dlong_enabled = match &*env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() {
"64" => {
println!(r#"cargo:rustc-cfg=feature="osqp_dlong""#);
println!("cargo:rustc-cfg=osqp_dlong");
"ON"
}
"32" => "OFF",
Expand Down
10 changes: 5 additions & 5 deletions osqp-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
mod bindings;
pub use bindings::*;

#[cfg(feature = "osqp_dlong")]
#[cfg(osqp_dlong)]
pub type osqp_int = ::std::os::raw::c_longlong;
#[cfg(not(feature = "osqp_dlong"))]
#[cfg(not(osqp_dlong))]
pub type osqp_int = ::std::os::raw::c_int;
pub type osqp_float = f64;

Expand Down Expand Up @@ -84,7 +84,7 @@ mod tests {
data.A = A;
data.l = l.as_mut_ptr();
data.u = u.as_mut_ptr();
let data = &data as *const OSQPData;
let data = &mut data as *mut OSQPData;

// Define solver settings
let mut settings: OSQPSettings = mem::zeroed();
Expand All @@ -96,13 +96,13 @@ mod tests {

// Setup workspace
let mut work: *mut OSQPWorkspace = ptr::null_mut();
let status = osqp_setup(&mut work, data, settings);
let status = osqp_setup(&mut work, data as *const _, settings);
if status != 0 {
panic!("osqp_setup failed");
}

// Zero data and settings on the stack to ensure osqp does not reference them
*(data as *mut OSQPData) = mem::zeroed();
*data = mem::zeroed();
*settings = mem::zeroed();
*P = mem::zeroed();
*A = mem::zeroed();
Expand Down

0 comments on commit 9046c46

Please sign in to comment.