Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pr: none

variables:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN_VERSION: "1.72"
RUST_TOOLCHAIN_VERSION: "1.73"

# variables set by pipeline
# - BASE_IMAGE
Expand Down
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"installJupyterlab": true,
"version": "latest"
"version": "3.11"
},
"ghcr.io/devcontainers/features/azure-cli:1": {
"version": "latest",
"extensions": "quantum"
}
},
"postCreateCommand": "npm install -g wasm-pack",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
CARGO_TERM_COLOR: always
NODE_VERSION: "18.17.1"
PYTHON_VERSION: "3.11"
RUST_TOOLCHAIN_VERSION: "1.72"
RUST_TOOLCHAIN_VERSION: "1.73"
RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN_VERSION: "1.72"
RUST_TOOLCHAIN_VERSION: "1.73"
RUST_TOOLCHAIN_COMPONENTS: rustfmt clippy

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
Expand Down
3 changes: 1 addition & 2 deletions compiler/qsc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ impl Eq for NodeId {}

impl PartialOrd for NodeId {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
assert!(!self.is_default(), "default node ID should be replaced");
self.0.partial_cmp(&other.0)
Some(self.cmp(other))
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/qsc_eval/src/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ pub(crate) fn call(
"DumpMachine" => {
let (state, qubit_count) = sim.capture_quantum_state();
match out.state(state, qubit_count) {
Ok(_) => Ok(Value::unit()),
Ok(()) => Ok(Value::unit()),
Err(_) => Err(Error::OutputFail(name_span)),
}
}
"Message" => match out.message(&arg.unwrap_string()) {
Ok(_) => Ok(Value::unit()),
Ok(()) => Ok(Value::unit()),
Err(_) => Err(Error::OutputFail(name_span)),
},
"CheckZero" => Ok(Value::Bool(sim.qubit_is_zero(arg.unwrap_qubit().0))),
Expand Down
4 changes: 2 additions & 2 deletions compiler/qsc_fir/src/fir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl Eq for NodeId {}

impl PartialOrd for NodeId {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.0.partial_cmp(&other.0)
Some(self.cmp(other))
}
}

Expand Down Expand Up @@ -180,7 +180,7 @@ macro_rules! fir_id {

impl PartialOrd for $id {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
self.0.partial_cmp(&other.0)
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/qsc_frontend/src/compile/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn matches_target(attrs: &[Box<Attr>], target: TargetProfile) -> bool {
ExprKind::Path(path) => {
match TargetProfile::from_str(path.name.name.as_ref()) {
Ok(t) => t == target,
Err(_) => true,
Err(()) => true,
}
}
_ => true,
Expand Down
13 changes: 9 additions & 4 deletions compiler/qsc_frontend/src/incremental/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::compile::{self, CompileUnit, PackageStore, TargetProfile};
use expect_test::{expect, Expect};
use indoc::indoc;
use miette::Diagnostic;
use std::fmt::Write;

#[test]
fn one_callable() {
Expand Down Expand Up @@ -185,8 +186,10 @@ fn check_unit(expect: &Expect, actual: &Increment) {
.ast
.names
.iter()
.map(|n| format!("node_id:{},", n.0))
.collect::<String>()
.fold(String::new(), |mut output, n| {
let _ = write!(output, "node_id:{},", n.0);
output
})
);
let terms = format!(
"\nterms:\n{}",
Expand All @@ -195,8 +198,10 @@ fn check_unit(expect: &Expect, actual: &Increment) {
.tys
.terms
.iter()
.map(|n| format!("node_id:{},", n.0))
.collect::<String>()
.fold(String::new(), |mut output, n| {
let _ = write!(output, "node_id:{},", n.0);
output
})
);

let hir = format!("\nhir:\n{}", actual.hir);
Expand Down
3 changes: 1 addition & 2 deletions compiler/qsc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ impl Eq for NodeId {}

impl PartialOrd for NodeId {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
assert!(!self.is_default(), "default node ID should be replaced");
self.0.partial_cmp(&other.0)
Some(self.cmp(other))
}
}

Expand Down
25 changes: 15 additions & 10 deletions pip/src/displayable_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mod tests;
use num_bigint::BigUint;
use num_complex::{Complex64, ComplexFloat};
use qsc::{fmt_basis_state_label, fmt_complex, format_state_id, get_phase};
use std::fmt::Write;

pub struct DisplayableState(pub Vec<(BigUint, Complex64)>, pub usize);

Expand All @@ -16,12 +17,15 @@ impl DisplayableState {
"STATE:{}",
self.0
.iter()
.map(|(id, state)| format!(
"\n{}: {}",
format_state_id(id, self.1),
fmt_complex(state)
))
.collect::<String>()
.fold(String::new(), |mut output, (id, state)| {
let _ = write!(
output,
"\n{}: {}",
format_state_id(id, self.1),
fmt_complex(state)
);
output
})
)
}

Expand All @@ -30,19 +34,20 @@ impl DisplayableState {
include_str!("state_header_template.html"),
self.0
.iter()
.map(|(id, state)| {
.fold(String::new(), |mut output, (id, state)| {
let amplitude = state.abs().powi(2) * 100.0;
format!(
let _ = write!(
output,
include_str!("state_row_template.html"),
fmt_basis_state_label(id, self.1),
fmt_complex(state),
amplitude,
amplitude,
get_phase(state),
get_phase(state)
)
);
output
})
.collect::<String>()
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions prereqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
import functools

python_ver = (3, 11) # Python support for Windows on ARM64 requires v3.11 or later
rust_ver = (1, 72) # Ensure Rust version 1.69 or later is installed
rust_ver = (1, 73) # Ensure Rust version 1.69 or later is installed
node_ver = (
18,
17,
)
wasmpack_ver = (0, 12, 1) # Latest tested wasm-pack version
rust_fmt_ver = (1, 6, 0) # Current version when Rust 1.72 shipped
rust_fmt_ver = (1, 6, 0) # Current version when Rust 1.73 shipped
clippy_ver = (0, 1, 69)

# Disable buffered output so that the log statements and subprocess output get interleaved in proper order
Expand Down