chore: cleanup the dependencies on static_assertions and oxc_index. (#3095)

We used to export `static_assertions` as part of the `oxc_index`. It
would've made sense back when it was only a vessel for exporting other
crates - although even then it wouldn't make much sense other than being
convenient - Now with it turning into a port of `index_vec` and
potentially getting bigger as the result of specific needs of the
project; It makes much more sense to stop exporting it from `oxc_index`
and use the crate directly in places that used to use what `oxc_index`
were exporting.


PS: we may want to follow up this with an `oxc_asset` crate containing
our own set of assertion tools which would also export
`static_assertions`.
This commit is contained in:
Ali Rezvani 2024-04-25 12:26:23 +03:30 committed by GitHub
parent 8618f6b32a
commit ac72d08592
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 17 additions and 19 deletions

7
Cargo.lock generated
View file

@ -1239,12 +1239,12 @@ dependencies = [
"bitflags 2.5.0",
"num-bigint",
"oxc_allocator",
"oxc_index",
"oxc_span",
"oxc_syntax",
"ryu-js",
"serde",
"serde_json",
"static_assertions",
"tsify",
"wasm-bindgen",
]
@ -1354,7 +1354,6 @@ name = "oxc_index"
version = "0.12.5"
dependencies = [
"serde",
"static_assertions",
]
[[package]]
@ -1406,7 +1405,6 @@ dependencies = [
"oxc_ast",
"oxc_codegen",
"oxc_diagnostics",
"oxc_index",
"oxc_macros",
"oxc_parser",
"oxc_resolver",
@ -1420,6 +1418,7 @@ dependencies = [
"rustc-hash",
"serde",
"serde_json",
"static_assertions",
"url",
]
@ -1490,12 +1489,12 @@ dependencies = [
"oxc_allocator",
"oxc_ast",
"oxc_diagnostics",
"oxc_index",
"oxc_span",
"oxc_syntax",
"rustc-hash",
"seq-macro",
"serde_json",
"static_assertions",
]
[[package]]

View file

@ -21,7 +21,6 @@ doctest = false
oxc_allocator = { workspace = true }
oxc_span = { workspace = true }
oxc_syntax = { workspace = true }
oxc_index = { workspace = true }
bitflags = { workspace = true }
num-bigint = { workspace = true }
@ -33,6 +32,8 @@ ryu-js = { workspace = true, optional = true }
tsify = { workspace = true, optional = true }
wasm-bindgen = { workspace = true, optional = true }
static_assertions = { workspace = true }
[features]
default = []
serialize = [

View file

@ -56,7 +56,7 @@ pub use crate::{
#[test]
fn size_asserts() {
use crate::ast;
use oxc_index::assert_eq_size;
use static_assertions::assert_eq_size;
assert_eq_size!(ast::Statement, [u8; 16]);
assert_eq_size!(ast::Expression, [u8; 16]);

View file

@ -19,8 +19,7 @@ workspace = true
doctest = false
[dependencies]
serde = { workspace = true }
static_assertions = { workspace = true }
serde = { workspace = true }
[features]
serialize = []

View file

@ -150,8 +150,6 @@ mod indexing;
pub use idxslice::{IndexBox, IndexSlice};
pub use indexing::{IdxRangeBounds, IdxSliceIndex};
pub use static_assertions::*;
#[macro_use]
mod macros;

View file

@ -28,7 +28,6 @@ oxc_macros = { workspace = true }
oxc_semantic = { workspace = true }
oxc_syntax = { workspace = true }
oxc_codegen = { workspace = true }
oxc_index = { workspace = true }
oxc_resolver = { workspace = true }
rayon = { workspace = true }
@ -50,5 +49,7 @@ once_cell = { workspace = true }
memchr = { workspace = true }
json-strip-comments = { workspace = true }
static_assertions = { workspace = true }
[dev-dependencies]
insta = { workspace = true }

View file

@ -41,7 +41,7 @@ use oxc_semantic::AstNode;
#[cfg(target_pointer_width = "64")]
#[test]
fn size_asserts() {
use oxc_index::assert_eq_size;
use static_assertions::assert_eq_size;
// `RuleEnum` runs in a really tight loop, make sure it is small for CPU cache.
// A reduction from 168 bytes to 16 results 15% performance improvement.

View file

@ -23,13 +23,13 @@ oxc_span = { workspace = true }
oxc_ast = { workspace = true }
oxc_syntax = { workspace = true }
oxc_diagnostics = { workspace = true }
oxc_index = { workspace = true }
assert-unchecked = { workspace = true }
bitflags = { workspace = true }
rustc-hash = { workspace = true }
num-bigint = { workspace = true }
seq-macro = { workspace = true }
static_assertions = { workspace = true }
assert-unchecked = { workspace = true }
bitflags = { workspace = true }
rustc-hash = { workspace = true }
num-bigint = { workspace = true }
seq-macro = { workspace = true }
memchr = { workspace = true }

View file

@ -35,7 +35,7 @@ pub struct Token {
#[cfg(target_pointer_width = "64")]
mod size_asserts {
oxc_index::assert_eq_size!(super::Token, [u8; 16]);
static_assertions::assert_eq_size!(super::Token, [u8; 16]);
}
impl Token {