Skip to content

Commit

Permalink
Remove dependence on crate ra_ap_stdx (#230)
Browse files Browse the repository at this point in the history
* Remove dependence on crate ra_ap_stdx

* Remove importing stdx::eprintln!. This was unused in any case
* Vendor a very small macro `format_to` from ra_ap_stdx. This was the last feature
  that we used from that library.
* Remove ra_ap_stdx from crates/oq3_syntax/Cargo.toml
* Remove a macro call testing whether we are in the rust tree. CI failed locally
  with this test. We are never in the rust tree, so it should be removed in
  any case.

* Pin version of crate rowan

rowan 0.5.16 requires rust 1.77. We need to support rust 1.70
Apparently rowan 0.5.15 is enough

* Udate macos version in CI workflow from 11 to 13

macos-11 causes CI to fail, or hang, because the image for macos-11
is no longer available. macos-12 is also not available.
  • Loading branch information
jlapeyre authored Oct 29, 2024
1 parent badf590 commit 9c4fb16
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-11, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Rust Format
Expand All @@ -33,7 +33,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-11, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Install Rust toolchain
Expand Down
2 changes: 1 addition & 1 deletion crates/oq3_semantics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ doctest = false
oq3_source_file.workspace = true
oq3_syntax.workspace = true
hashbrown = { version = "0.12.3" }
rowan = "0.15.11"
rowan = {version = "<=0.15.15"}
boolenum = "0.1"

[dev-dependencies]
Expand Down
3 changes: 1 addition & 2 deletions crates/oq3_syntax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ either = "1.7.0"
indexmap = "2.0.0"
itertools = "0.10.5"
once_cell = "1.17.0"
rowan = "0.15.11"
rowan = {version = "<=0.15.15"}
rustc-hash = "1.1.0"
smol_str = "0.2.0"
stdx = { version = "0.0.188", package = "ra_ap_stdx"}
triomphe = { version = "<= 0.1.11", default-features = false, features = ["std"] }
xshell = "0.2.2"
rustversion = "1.0"
Expand Down
23 changes: 17 additions & 6 deletions crates/oq3_syntax/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
semicolon_in_expressions_from_macros
)]

#[allow(unused)]
macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) };
}

mod parsing;
mod ptr;
mod sourcegen;
Expand All @@ -48,7 +43,6 @@ pub mod ted;

use std::marker::PhantomData;

use stdx::format_to;
use triomphe::Arc;

pub use crate::{
Expand Down Expand Up @@ -452,3 +446,20 @@ fn api_walkthrough() {
}
assert_eq!(exprs_cast, exprs_visit);
}

// #229
// This macro is copied from ra_ap_stdx. It is the only feature
// we needed from ra_ap_stdx. But that crate put us in a version bind.
/// Appends formatted string to a `String`.
#[macro_export]
macro_rules! format_to {
($buf:expr) => ();
($buf:expr, $lit:literal $($arg:tt)*) => {
{
use ::std::fmt::Write as _;
// We can't do ::std::fmt::Write::write_fmt($buf, format_args!($lit $($arg)*))
// unfortunately, as that loses out on autoref behavior.
_ = $buf.write_fmt(format_args!($lit $($arg)*))
}
};
}
2 changes: 0 additions & 2 deletions crates/oq3_syntax/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

#[cfg(not(feature = "in-rust-tree"))]
mod ast_src;
#[cfg(not(feature = "in-rust-tree"))]
mod sourcegen_ast;

use crate::ast;
Expand Down

0 comments on commit 9c4fb16

Please sign in to comment.