mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 22:56:11 +03:00
fix(ast): Add archive(check_bytes)
to all relevant AST types (#9574)
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
CI / Miri (swc_ecma_codegen) (push) Has been cancelled
CI / Miri (swc_ecma_minifier) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
Some checks failed
CI / Cargo fmt (push) Has been cancelled
CI / Cargo clippy (push) Has been cancelled
CI / Check license of dependencies (push) Has been cancelled
CI / Check (macos-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / Test wasm (binding_core_wasm) (push) Has been cancelled
CI / Test wasm (binding_minifier_wasm) (push) Has been cancelled
CI / Test wasm (binding_typescript_wasm) (push) Has been cancelled
CI / List crates (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (macos-latest) (push) Has been cancelled
CI / Test node bindings - ${{ matrix.os }} (windows-latest) (push) Has been cancelled
CI / Test with @swc/cli (push) Has been cancelled
CI / Miri (better_scoped_tls) (push) Has been cancelled
CI / Miri (string_enum) (push) Has been cancelled
CI / Miri (swc) (push) Has been cancelled
CI / Miri (swc_bundler) (push) Has been cancelled
CI / Miri (swc_ecma_codegen) (push) Has been cancelled
CI / Miri (swc_ecma_minifier) (push) Has been cancelled
Benchmark / Bench everything (push) Has been cancelled
CI / Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} (push) Has been cancelled
CI / Done (push) Has been cancelled
**Description:** 1. all struct that support rkyv add `archive(check_bytes)` 2. all recursive struct that support rkyv add check_bytes bound this PR will fix the error reported in https://github.com/swc-project/swc/pull/9562
This commit is contained in:
parent
04016e9687
commit
185d6f55b3
8
.changeset/tough-cooks-stare.md
Normal file
8
.changeset/tough-cooks-stare.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
swc_core: patch
|
||||||
|
swc_common: patch
|
||||||
|
swc_ecma_ast: patch
|
||||||
|
swc_html_ast: patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: all struct that support rkyv add `archive(check_bytes)`
|
@ -23,9 +23,15 @@ pub struct Tuple(#[span] HasSpan, usize, usize);
|
|||||||
archive(bound(serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace"))
|
archive(bound(serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace"))
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))]
|
#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))]
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "rkyv-impl",
|
||||||
|
archive_attr(check_bytes(bound = "__C: rkyv::validation::ArchiveContext, <__C as \
|
||||||
|
rkyv::Fallible>::Error: std::error::Error"))
|
||||||
|
)]
|
||||||
#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))]
|
#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))]
|
||||||
pub struct HasSpan {
|
pub struct HasSpan {
|
||||||
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
||||||
|
#[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,15 +1277,22 @@ impl Take for Import {
|
|||||||
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))]
|
#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))]
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "rkyv-impl",
|
||||||
|
archive_attr(check_bytes(bound = "__C: rkyv::validation::ArchiveContext, <__C as \
|
||||||
|
rkyv::Fallible>::Error: std::error::Error"))
|
||||||
|
)]
|
||||||
#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))]
|
#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))]
|
||||||
#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct ExprOrSpread {
|
pub struct ExprOrSpread {
|
||||||
#[cfg_attr(feature = "serde-impl", serde(default))]
|
#[cfg_attr(feature = "serde-impl", serde(default))]
|
||||||
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
||||||
|
#[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))]
|
||||||
pub spread: Option<Span>,
|
pub spread: Option<Span>,
|
||||||
|
|
||||||
#[cfg_attr(feature = "serde-impl", serde(rename = "expression"))]
|
#[cfg_attr(feature = "serde-impl", serde(rename = "expression"))]
|
||||||
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
||||||
|
#[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))]
|
||||||
pub expr: Box<Expr>,
|
pub expr: Box<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,15 +24,22 @@ use crate::{typescript::TsTypeAnn, Expr};
|
|||||||
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))]
|
#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))]
|
||||||
|
#[cfg_attr(
|
||||||
|
feature = "rkyv-impl",
|
||||||
|
archive_attr(check_bytes(bound = "__C: rkyv::validation::ArchiveContext, <__C as \
|
||||||
|
rkyv::Fallible>::Error: std::error::Error"))
|
||||||
|
)]
|
||||||
#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))]
|
#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))]
|
||||||
#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub struct BindingIdent {
|
pub struct BindingIdent {
|
||||||
#[cfg_attr(feature = "serde-impl", serde(flatten))]
|
#[cfg_attr(feature = "serde-impl", serde(flatten))]
|
||||||
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
||||||
|
#[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))]
|
||||||
pub id: Ident,
|
pub id: Ident,
|
||||||
|
|
||||||
#[cfg_attr(feature = "serde-impl", serde(default, rename = "typeAnnotation"))]
|
#[cfg_attr(feature = "serde-impl", serde(default, rename = "typeAnnotation"))]
|
||||||
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
#[cfg_attr(feature = "__rkyv", omit_bounds)]
|
||||||
|
#[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))]
|
||||||
pub type_ann: Option<Box<TsTypeAnn>>,
|
pub type_ann: Option<Box<TsTypeAnn>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ pub struct DocumentFragment {
|
|||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
||||||
@ -75,6 +76,7 @@ impl EqIgnoreSpan for DocumentType {
|
|||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
||||||
|
@ -29,6 +29,7 @@ pub struct AttributeToken {
|
|||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
||||||
#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum Raw {
|
pub enum Raw {
|
||||||
Same,
|
Same,
|
||||||
@ -44,6 +45,7 @@ pub enum Raw {
|
|||||||
feature = "rkyv",
|
feature = "rkyv",
|
||||||
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer"))
|
||||||
)]
|
)]
|
||||||
|
#[cfg_attr(feature = "rkyv", archive(check_bytes))]
|
||||||
#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
|
#[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))]
|
||||||
pub enum Token {
|
pub enum Token {
|
||||||
Doctype {
|
Doctype {
|
||||||
|
Loading…
Reference in New Issue
Block a user