Skip to content

Commit 5be97d3

Browse files
committed
refactor: use target_family instead of target_arch
1 parent e744b1e commit 5be97d3

File tree

11 files changed

+25
-25
lines changed

11 files changed

+25
-25
lines changed

clarity/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ features = ["arbitrary_precision", "unbounded_depth"]
4040
version = "0.2.23"
4141
features = ["std"]
4242

43-
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
43+
[target.'cfg(not(target_family = "wasm"))'.dependencies]
4444
rusqlite = { workspace = true }
4545

4646
[dev-dependencies]

clarity/src/vm/analysis/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ use self::type_checker::v2_1::TypeChecker as TypeChecker2_1;
3636
pub use self::types::{AnalysisPass, ContractAnalysis};
3737
use crate::vm::ast::{build_ast_with_rules, ASTRules};
3838
use crate::vm::costs::LimitedCostTracker;
39-
#[cfg(not(target_arch = "wasm32"))]
39+
#[cfg(not(target_family = "wasm"))]
4040
use crate::vm::database::MemoryBackingStore;
4141
use crate::vm::database::STORE_CONTRACT_SRC_INTERFACE;
4242
use crate::vm::representations::SymbolicExpression;
4343
use crate::vm::types::{QualifiedContractIdentifier, TypeSignature};
4444
use crate::vm::ClarityVersion;
4545

4646
/// Used by CLI tools like the docs generator. Not used in production
47-
#[cfg(not(target_arch = "wasm32"))]
47+
#[cfg(not(target_family = "wasm"))]
4848
pub fn mem_type_check(
4949
snippet: &str,
5050
version: ClarityVersion,

clarity/src/vm/database/clarity_store.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
#[cfg(not(target_arch = "wasm32"))]
17+
#[cfg(not(target_family = "wasm"))]
1818
use rusqlite::Connection;
1919
use stacks_common::types::chainstate::{StacksBlockId, TrieHash};
2020
use stacks_common::util::hash::{hex_bytes, to_hex, Sha512Trunc256Sum};
2121

2222
use crate::vm::analysis::AnalysisDatabase;
2323
use crate::vm::contexts::GlobalContext;
24-
#[cfg(not(target_arch = "wasm32"))]
24+
#[cfg(not(target_family = "wasm"))]
2525
use crate::vm::database::{
2626
ClarityDatabase, ClarityDeserializable, ClaritySerializable, NULL_BURN_STATE_DB, NULL_HEADER_DB,
2727
};
@@ -85,7 +85,7 @@ pub trait ClarityBackingStore {
8585
fn get_open_chain_tip_height(&mut self) -> u32;
8686
fn get_open_chain_tip(&mut self) -> StacksBlockId;
8787

88-
#[cfg(not(target_arch = "wasm32"))]
88+
#[cfg(not(target_family = "wasm"))]
8989
fn get_side_store(&mut self) -> &Connection;
9090

9191
fn get_cc_special_cases_handler(&self) -> Option<SpecialCaseHandler> {
@@ -222,7 +222,7 @@ impl ClarityBackingStore for NullBackingStore {
222222
panic!("NullBackingStore can't retrieve data")
223223
}
224224

225-
#[cfg(not(target_arch = "wasm32"))]
225+
#[cfg(not(target_family = "wasm"))]
226226
fn get_side_store(&mut self) -> &Connection {
227227
panic!("NullBackingStore has no side store")
228228
}

clarity/src/vm/database/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16-
#[cfg(not(target_arch = "wasm32"))]
16+
#[cfg(not(target_family = "wasm"))]
1717
pub use sqlite::MemoryBackingStore;
1818

1919
pub use self::clarity_db::{
@@ -22,7 +22,7 @@ pub use self::clarity_db::{
2222
};
2323
pub use self::clarity_store::{ClarityBackingStore, SpecialCaseHandler};
2424
pub use self::key_value_wrapper::{RollbackWrapper, RollbackWrapperPersistedLog};
25-
#[cfg(not(target_arch = "wasm32"))]
25+
#[cfg(not(target_family = "wasm"))]
2626
pub use self::sqlite::SqliteConnection;
2727
pub use self::structures::{
2828
ClarityDeserializable, ClaritySerializable, DataMapMetadata, DataVariableMetadata,
@@ -32,6 +32,6 @@ pub use self::structures::{
3232
pub mod clarity_db;
3333
pub mod clarity_store;
3434
mod key_value_wrapper;
35-
#[cfg(not(target_arch = "wasm32"))]
35+
#[cfg(not(target_family = "wasm"))]
3636
pub mod sqlite;
3737
mod structures;

clarity/src/vm/docs/contracts.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ use hashbrown::{HashMap, HashSet};
44
use stacks_common::consts::CHAIN_ID_TESTNET;
55
use stacks_common::types::StacksEpochId;
66

7-
#[cfg(not(target_arch = "wasm32"))]
7+
#[cfg(not(target_family = "wasm"))]
88
use crate::vm::analysis::mem_type_check;
99
use crate::vm::analysis::ContractAnalysis;
1010
use crate::vm::ast::{build_ast_with_rules, ASTRules};
1111
use crate::vm::contexts::GlobalContext;
1212
use crate::vm::costs::LimitedCostTracker;
13-
#[cfg(not(target_arch = "wasm32"))]
13+
#[cfg(not(target_family = "wasm"))]
1414
use crate::vm::database::MemoryBackingStore;
1515
use crate::vm::docs::{get_input_type_string, get_output_type_string, get_signature};
1616
use crate::vm::types::{FunctionType, QualifiedContractIdentifier, Value};
@@ -63,7 +63,7 @@ fn make_func_ref(func_name: &str, func_type: &FunctionType, description: &str) -
6363
}
6464
}
6565

66-
#[cfg(not(target_arch = "wasm32"))]
66+
#[cfg(not(target_family = "wasm"))]
6767
#[allow(clippy::expect_used)]
6868
fn get_constant_value(var_name: &str, contract_content: &str) -> Value {
6969
let to_eval = format!("{}\n{}", contract_content, var_name);
@@ -72,7 +72,7 @@ fn get_constant_value(var_name: &str, contract_content: &str) -> Value {
7272
.expect("BUG: failed to return constant value")
7373
}
7474

75-
#[cfg(not(target_arch = "wasm32"))]
75+
#[cfg(not(target_family = "wasm"))]
7676
fn doc_execute(program: &str) -> Result<Option<Value>, vm::Error> {
7777
let contract_id = QualifiedContractIdentifier::transient();
7878
let mut contract_context = ContractContext::new(contract_id.clone(), ClarityVersion::Clarity2);
@@ -99,7 +99,7 @@ fn doc_execute(program: &str) -> Result<Option<Value>, vm::Error> {
9999
})
100100
}
101101

102-
#[cfg(not(target_arch = "wasm32"))]
102+
#[cfg(not(target_family = "wasm"))]
103103
#[allow(clippy::expect_used)]
104104
pub fn make_docs(
105105
content: &str,
@@ -185,7 +185,7 @@ pub fn make_docs(
185185

186186
/// Produce a set of documents for multiple contracts, supplied as a list of `(contract_name, contract_content)` pairs,
187187
/// and a map from `contract_name` to corresponding `ContractSupportDocs`
188-
#[cfg(not(target_arch = "wasm32"))]
188+
#[cfg(not(target_family = "wasm"))]
189189
pub fn produce_docs_refs<A: AsRef<str>, B: AsRef<str>>(
190190
contracts: &[(A, B)],
191191
support_docs: &HashMap<&str, ContractSupportDocs>,

clarity/src/vm/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use std::{error, fmt};
1818

19-
#[cfg(not(target_arch = "wasm32"))]
19+
#[cfg(not(target_family = "wasm"))]
2020
use rusqlite::Error as SqliteError;
2121
use serde_json::Error as SerdeJSONErr;
2222
use stacks_common::types::chainstate::BlockHeaderHash;
@@ -57,7 +57,7 @@ pub enum InterpreterError {
5757
UninitializedPersistedVariable,
5858
FailedToConstructAssetTable,
5959
FailedToConstructEventBatch,
60-
#[cfg(not(target_arch = "wasm32"))]
60+
#[cfg(not(target_family = "wasm"))]
6161
SqliteError(IncomparableError<SqliteError>),
6262
BadFileName,
6363
FailedToCreateDataDirectory,

clarity/src/vm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub mod coverage;
4242

4343
pub mod events;
4444

45-
#[cfg(not(target_arch = "wasm32"))]
45+
#[cfg(not(target_family = "wasm"))]
4646
pub mod tooling;
4747

4848
#[cfg(any(test, feature = "testing"))]

stacks-common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ features = ["serde"]
6060
version = "0.2.23"
6161
features = ["std"]
6262

63-
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
63+
[target.'cfg(not(target_family = "wasm"))'.dependencies]
6464
rusqlite = { workspace = true }
6565

6666
[dev-dependencies]

stacks-common/src/bitvec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

17-
#[cfg(not(target_arch = "wasm32"))]
17+
#[cfg(not(target_family = "wasm"))]
1818
use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef};
1919
use serde::{Deserialize, Serialize};
2020

@@ -106,7 +106,7 @@ impl<'de, const MAX_SIZE: u16> Deserialize<'de> for BitVec<MAX_SIZE> {
106106
}
107107
}
108108

109-
#[cfg(not(target_arch = "wasm32"))]
109+
#[cfg(not(target_family = "wasm"))]
110110
impl<const MAX_SIZE: u16> FromSql for BitVec<MAX_SIZE> {
111111
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self> {
112112
let bytes = hex_bytes(value.as_str()?).map_err(|e| FromSqlError::Other(Box::new(e)))?;
@@ -115,7 +115,7 @@ impl<const MAX_SIZE: u16> FromSql for BitVec<MAX_SIZE> {
115115
}
116116
}
117117

118-
#[cfg(not(target_arch = "wasm32"))]
118+
#[cfg(not(target_family = "wasm"))]
119119
impl<const MAX_SIZE: u16> ToSql for BitVec<MAX_SIZE> {
120120
fn to_sql(&self) -> rusqlite::Result<ToSqlOutput<'_>> {
121121
let hex = bytes_to_hex(self.serialize_to_vec().as_slice());

stacks-common/src/types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::fmt;
1919
use std::ops::{Deref, DerefMut, Index, IndexMut};
2020
use std::sync::LazyLock;
2121

22-
#[cfg(not(target_arch = "wasm32"))]
22+
#[cfg(not(target_family = "wasm"))]
2323
pub mod sqlite;
2424

2525
use crate::address::c32::{c32_address, c32_address_decode};

0 commit comments

Comments
 (0)