Skip to content

Commit

Permalink
Explicitly set MSRV for rust extension (Qiskit#8196)
Browse files Browse the repository at this point in the history
* Explicitly set MSRV for rust extension

This commit explicitly sets the MSRV (minimum supported rust version)
for Qiskit Terra to 1.56 which was released in October 2021 (with 1.56.1
which fixed two CVEs being released Nov. 1st 2021). Previously we had
avoided setting a hard MSRV and opted to try and just loosely support the
past 6 months of rust releases. However, managing it loosely has proven
tricky to manage in practice. This commit sets a hard version for MSRV
and modifies a test job to validate we're able to compile with the MSRV.
This should ensure we're able to avoid breaking compatibility for that
version.

* Explicitly set MSRV to 1.56.1 instead of loosely 1.56

* Explicitly set version as variable in CI config

* Assign MSRV to azure variable

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
mtreinish and mergify[bot] authored Jun 17, 2022
1 parent 3577669 commit 186c807
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .azure/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ parameters:
type: boolean
default: false

- name: "rustVersion"
type: string
default: "stable"


jobs:
- job: "Linux_Tests_Python${{ replace(parameters.pythonVersion, '.', '') }}"
Expand Down Expand Up @@ -52,6 +56,10 @@ jobs:
path: .stestr
displayName: "Cache stestr"

- bash: |
rustup default "${{ parameters.rustVersion }}"
displayName: "Use rust version ${{ parameters.rustVersion }}"
- bash: |
set -e
python -m pip install --upgrade pip setuptools wheel virtualenv
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ the Visual C++ build tools so that rust can link against the system c/c++
libraries. You can see more details on this in the
[rustup documentation](https://rust-lang.github.io/rustup/installation/windows.html).

Qiskit Terra has a minimum supported Rust version (MSRV) of 1.56.1. This means
to build Qiskit Terra from source you must have at least rustc version 1.56.1
installed, older versions will not be able to compile Qiskit.

Once you have a rust compiler installed you can rely on the normal Python
build/install steps to install Qiskit Terra. This means you just run
`pip install .` in your local git clone to build and install Qiskit Terra.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Qiskit Terra
[![License](https://img.shields.io/github/license/Qiskit/qiskit-terra.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)<!--- long-description-skip-begin -->[![Build Status](https://img.shields.io/travis/com/Qiskit/qiskit-terra/master.svg?style=popout-square)](https://travis-ci.com/Qiskit/qiskit-terra)[![Release](https://img.shields.io/github/release/Qiskit/qiskit-terra.svg?style=popout-square)](https://github.com/Qiskit/qiskit-terra/releases)[![Downloads](https://img.shields.io/pypi/dm/qiskit-terra.svg?style=popout-square)](https://pypi.org/project/qiskit-terra/)[![Coverage Status](https://coveralls.io/repos/github/Qiskit/qiskit-terra/badge.svg?branch=main)](https://coveralls.io/github/Qiskit/qiskit-terra?branch=main)<!--- long-description-skip-end -->
[![License](https://img.shields.io/github/license/Qiskit/qiskit-terra.svg?style=popout-square)](https://opensource.org/licenses/Apache-2.0)<!--- long-description-skip-begin -->[![Build Status](https://img.shields.io/travis/com/Qiskit/qiskit-terra/master.svg?style=popout-square)](https://travis-ci.com/Qiskit/qiskit-terra)[![Release](https://img.shields.io/github/release/Qiskit/qiskit-terra.svg?style=popout-square)](https://github.com/Qiskit/qiskit-terra/releases)[![Downloads](https://img.shields.io/pypi/dm/qiskit-terra.svg?style=popout-square)](https://pypi.org/project/qiskit-terra/)[![Coverage Status](https://coveralls.io/repos/github/Qiskit/qiskit-terra/badge.svg?branch=main)](https://coveralls.io/github/Qiskit/qiskit-terra?branch=main)[![Minimum rustc 1.56.1](https://img.shields.io/badge/rustc-1.56.1+-blue.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)<!--- long-description-skip-end -->

**Qiskit** is an open-source framework for working with noisy quantum computers at the level of pulses, circuits, and algorithms.

Expand Down
9 changes: 8 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Trigger types. This needs to include all the triggers for the different
# pipelines we might want to run.
#
#
# Each of these individually triggers the pipeline compilation step, but it's
# the templating expressions in the `stages` list that actually set what runs.
trigger:
Expand Down Expand Up @@ -45,6 +45,12 @@ parameters:
type: string
default: "3.10"

- name: "minimumRustVersion"
displayName: "Minimum supported version of Rust"
type: string
default: "1.56.1"


# These two versions of Python can be chosen somewhat arbitrarily, but we get
# slightly better coverage per PR if they're neither the maximum nor minimum
# supported versions.
Expand Down Expand Up @@ -144,6 +150,7 @@ stages:
pythonVersion: ${{ parameters.minimumPythonVersion }}
testQPY: false
testImages: false
rustVersion: ${{ parameters.minimumRustVersion }}

# The rest of the PR pipeline is to test the oldest and newest supported
# versions of Python, along with the integration tests (via the tutorials).
Expand Down
10 changes: 10 additions & 0 deletions releasenotes/notes/msrv-0b626e1cfb415abf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
upgrade:
- |
Qiskit Terra's compiled Rust extensions now have a minimum supported Rust
version (MSRV) of 1.56.1. This means when building Qiskit Terra from source
the oldest version of the Rust compiler supported is 1.56.1. If you are using
an older version of the Rust compiler you will need to update to a newer
version to continue to build Qiskit from source. This change was necessary
as a number of upstream dependencies have updated their minimum supported
versions too.

0 comments on commit 186c807

Please sign in to comment.