diff --git a/boa_ast/Cargo.toml b/boa_ast/Cargo.toml index eeed440619c..733a25cdd87 100644 --- a/boa_ast/Cargo.toml +++ b/boa_ast/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true [features] serde = ["boa_interner/serde", "dep:serde"] -fuzzer-not-safe-for-production = ["arbitrary", "boa_interner/fuzzer-not-safe-for-production", "num-bigint/arbitrary"] +fuzz = ["arbitrary", "boa_interner/fuzz", "num-bigint/arbitrary"] [dependencies] boa_interner.workspace = true diff --git a/boa_ast/src/declaration/mod.rs b/boa_ast/src/declaration/mod.rs index 0fe943583f9..02f3e584c85 100644 --- a/boa_ast/src/declaration/mod.rs +++ b/boa_ast/src/declaration/mod.rs @@ -27,10 +27,7 @@ pub use variable::*; /// /// See the [module level documentation][self] for more information. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum Declaration { /// See [`Function`] diff --git a/boa_ast/src/declaration/variable.rs b/boa_ast/src/declaration/variable.rs index d39fadf3b0c..921f57ffe1e 100644 --- a/boa_ast/src/declaration/variable.rs +++ b/boa_ast/src/declaration/variable.rs @@ -45,10 +45,7 @@ use super::Declaration; /// [varstmt]: https://tc39.es/ecma262/#prod-VariableStatement /// [hoisting]: https://developer.mozilla.org/en-US/docs/Glossary/Hoisting #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct VarDeclaration(pub VariableList); @@ -85,10 +82,7 @@ impl VisitWith for VarDeclaration { /// /// [lexical declaration]: https://tc39.es/ecma262/#sec-let-and-const-declarations #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum LexicalDeclaration { /// A [const] variable creates a constant whose scope can be either global or local @@ -168,10 +162,7 @@ impl VisitWith for LexicalDeclaration { /// List of variables in a variable declaration. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct VariableList { list: Box<[Variable]>, @@ -262,10 +253,7 @@ impl TryFrom> for VariableList { /// [spec2]: https://tc39.es/ecma262/#prod-VariableDeclaration /// [spec3]: https://tc39.es/ecma262/#sec-declarations-and-the-variable-statement #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Variable { binding: Binding, @@ -348,10 +336,7 @@ impl VisitWith for Variable { /// /// [spec]: https://tc39.es/ecma262/#sec-declarations-and-the-variable-statement #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum Binding { /// A single identifier binding. diff --git a/boa_ast/src/expression/access.rs b/boa_ast/src/expression/access.rs index 60adfcc672b..b66f2a11cff 100644 --- a/boa_ast/src/expression/access.rs +++ b/boa_ast/src/expression/access.rs @@ -24,10 +24,7 @@ use core::ops::ControlFlow; /// /// See the [module level documentation][self] for more information. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum PropertyAccessField { /// A constant property field, such as `x.prop`. @@ -76,10 +73,7 @@ impl VisitWith for PropertyAccessField { /// /// See the [module level documentation][self] for more information. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum PropertyAccess { /// A simple property access (`x.prop`). @@ -134,10 +128,7 @@ impl VisitWith for PropertyAccess { /// A simple property access, where the target object is an [`Expression`]. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct SimplePropertyAccess { target: Box, @@ -221,10 +212,7 @@ impl VisitWith for SimplePropertyAccess { /// [spec]: https://tc39.es/ecma262/#prod-MemberExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_class_fields #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct PrivatePropertyAccess { target: Box, @@ -301,10 +289,7 @@ impl VisitWith for PrivatePropertyAccess { /// [spec]: https://tc39.es/ecma262/#prod-SuperProperty /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct SuperPropertyAccess { field: PropertyAccessField, diff --git a/boa_ast/src/expression/await.rs b/boa_ast/src/expression/await.rs index f546317150d..8c8786311ad 100644 --- a/boa_ast/src/expression/await.rs +++ b/boa_ast/src/expression/await.rs @@ -16,10 +16,7 @@ use boa_interner::{Interner, ToIndentedString, ToInternedString}; /// [spec]: https://tc39.es/ecma262/#prod-AwaitExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Await { target: Box, diff --git a/boa_ast/src/expression/call.rs b/boa_ast/src/expression/call.rs index 6020a179ba1..3787ad99d84 100644 --- a/boa_ast/src/expression/call.rs +++ b/boa_ast/src/expression/call.rs @@ -21,10 +21,7 @@ use super::Expression; /// [spec]: https://tc39.es/ecma262/#prod-CallExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Functions#Calling_functions #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Call { function: Box, @@ -108,10 +105,7 @@ impl VisitWith for Call { /// [spec]: https://tc39.es/ecma262/#prod-SuperCall /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct SuperCall { args: Box<[Expression]>, diff --git a/boa_ast/src/expression/identifier.rs b/boa_ast/src/expression/identifier.rs index 6ccc19432b0..0bf6844744f 100644 --- a/boa_ast/src/expression/identifier.rs +++ b/boa_ast/src/expression/identifier.rs @@ -43,10 +43,7 @@ pub const RESERVED_IDENTIFIERS_STRICT: [Sym; 9] = [ derive(serde::Serialize, serde::Deserialize), serde(transparent) )] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[repr(transparent)] pub struct Identifier { diff --git a/boa_ast/src/expression/literal/array.rs b/boa_ast/src/expression/literal/array.rs index 97b5af7bf09..631d0c9fb3a 100644 --- a/boa_ast/src/expression/literal/array.rs +++ b/boa_ast/src/expression/literal/array.rs @@ -25,10 +25,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-ArrayLiteral /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct ArrayLiteral { arr: Box<[Option]>, diff --git a/boa_ast/src/expression/literal/mod.rs b/boa_ast/src/expression/literal/mod.rs index 6e84b5e8820..60951351d3b 100644 --- a/boa_ast/src/expression/literal/mod.rs +++ b/boa_ast/src/expression/literal/mod.rs @@ -33,10 +33,7 @@ use super::Expression; /// [spec]: https://tc39.es/ecma262/#sec-primary-expression-literals /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Literals #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum Literal { /// A string literal is zero or more characters enclosed in double (`"`) or single (`'`) quotation marks. diff --git a/boa_ast/src/expression/literal/object.rs b/boa_ast/src/expression/literal/object.rs index 3e54b776a36..1736a2e31f2 100644 --- a/boa_ast/src/expression/literal/object.rs +++ b/boa_ast/src/expression/literal/object.rs @@ -33,10 +33,7 @@ use core::ops::ControlFlow; /// [primitive]: https://developer.mozilla.org/en-US/docs/Glossary/primitive #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(transparent))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct ObjectLiteral { properties: Box<[PropertyDefinition]>, diff --git a/boa_ast/src/expression/literal/template.rs b/boa_ast/src/expression/literal/template.rs index 7ba2d87cbb6..7c3f4bc189c 100644 --- a/boa_ast/src/expression/literal/template.rs +++ b/boa_ast/src/expression/literal/template.rs @@ -21,10 +21,7 @@ use crate::{ /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals /// [spec]: https://tc39.es/ecma262/#sec-template-literals #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct TemplateLiteral { elements: Box<[TemplateElement]>, @@ -44,10 +41,7 @@ impl From for Expression { /// /// [spec]: https://tc39.es/ecma262/#sec-template-literals #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum TemplateElement { /// A simple string. diff --git a/boa_ast/src/expression/mod.rs b/boa_ast/src/expression/mod.rs index 0f241388085..ad048080947 100644 --- a/boa_ast/src/expression/mod.rs +++ b/boa_ast/src/expression/mod.rs @@ -51,10 +51,7 @@ pub mod operator; /// /// See the [module level documentation][self] for more information. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, PartialEq)] pub enum Expression { /// The JavaScript `this` keyword refers to the object it belongs to. diff --git a/boa_ast/src/expression/new.rs b/boa_ast/src/expression/new.rs index dc2e1b11c1c..f93e7a9bea2 100644 --- a/boa_ast/src/expression/new.rs +++ b/boa_ast/src/expression/new.rs @@ -21,10 +21,7 @@ use super::Expression; /// [spec]: https://tc39.es/ecma262/#prod-NewExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct New { call: Call, diff --git a/boa_ast/src/expression/operator/assign/mod.rs b/boa_ast/src/expression/operator/assign/mod.rs index 45e9145844f..a2bbc692461 100644 --- a/boa_ast/src/expression/operator/assign/mod.rs +++ b/boa_ast/src/expression/operator/assign/mod.rs @@ -28,10 +28,7 @@ use crate::{ /// /// See the [module level documentation][self] for more information. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Assign { op: AssignOp, @@ -114,10 +111,7 @@ impl VisitWith for Assign { /// /// [spec]: hhttps://tc39.es/ecma262/#prod-LeftHandSideExpression #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum AssignTarget { /// A simple identifier, such as `a`. diff --git a/boa_ast/src/expression/operator/assign/op.rs b/boa_ast/src/expression/operator/assign/op.rs index 1a9ad432fa8..a2c25df8cf5 100644 --- a/boa_ast/src/expression/operator/assign/op.rs +++ b/boa_ast/src/expression/operator/assign/op.rs @@ -12,10 +12,7 @@ /// [spec]: https://tc39.es/ecma262/#prod-AssignmentOperator /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Assignment #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum AssignOp { /// The assignment operator assigns the value of the right operand to the left operand. diff --git a/boa_ast/src/expression/operator/binary/mod.rs b/boa_ast/src/expression/operator/binary/mod.rs index faced2d09c1..2e280392641 100644 --- a/boa_ast/src/expression/operator/binary/mod.rs +++ b/boa_ast/src/expression/operator/binary/mod.rs @@ -31,10 +31,7 @@ use crate::{ /// /// See the [module level documentation][self] for more information. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Binary { op: BinaryOp, diff --git a/boa_ast/src/expression/operator/binary/op.rs b/boa_ast/src/expression/operator/binary/op.rs index 41d8f9e03b8..60ace261298 100644 --- a/boa_ast/src/expression/operator/binary/op.rs +++ b/boa_ast/src/expression/operator/binary/op.rs @@ -4,10 +4,7 @@ use std::fmt::{Display, Formatter, Result}; /// This represents a binary operation between two values. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum BinaryOp { /// Numeric operation. @@ -90,10 +87,7 @@ impl Display for BinaryOp { /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Arithmetic #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum ArithmeticOp { /// The addition operator produces the sum of numeric operands or string concatenation. @@ -204,10 +198,7 @@ impl Display for ArithmeticOp { /// /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Bitwise #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum BitwiseOp { /// Performs the AND operation on each pair of bits. a AND b yields 1 only if both a and b are 1. @@ -331,10 +322,7 @@ impl Display for BitwiseOp { /// [spec]: tc39.es/ecma262/#sec-testing-and-comparison-operations /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Comparison #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum RelationalOp { /// The equality operator converts the operands if they are not of the same type, then applies @@ -528,10 +516,7 @@ impl Display for RelationalOp { /// [spec]: https://tc39.es/ecma262/#sec-binary-logical-operators /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Logical #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum LogicalOp { /// The logical AND operator returns the value of the first operand if it can be coerced into `false`; diff --git a/boa_ast/src/expression/operator/conditional.rs b/boa_ast/src/expression/operator/conditional.rs index 70852674ab6..a0ac5711d61 100644 --- a/boa_ast/src/expression/operator/conditional.rs +++ b/boa_ast/src/expression/operator/conditional.rs @@ -21,10 +21,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-ConditionalExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Literals #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Conditional { condition: Box, diff --git a/boa_ast/src/expression/operator/unary/mod.rs b/boa_ast/src/expression/operator/unary/mod.rs index ee34926bd6d..ecf77b0f9c6 100644 --- a/boa_ast/src/expression/operator/unary/mod.rs +++ b/boa_ast/src/expression/operator/unary/mod.rs @@ -30,10 +30,7 @@ use crate::visitor::{VisitWith, Visitor, VisitorMut}; /// [spec]: https://tc39.es/ecma262/#prod-UnaryExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Unary_operators #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Unary { op: UnaryOp, diff --git a/boa_ast/src/expression/operator/unary/op.rs b/boa_ast/src/expression/operator/unary/op.rs index 79a0235d515..ce3c7f607c9 100644 --- a/boa_ast/src/expression/operator/unary/op.rs +++ b/boa_ast/src/expression/operator/unary/op.rs @@ -11,10 +11,7 @@ /// [spec]: https://tc39.es/ecma262/#prod-UnaryExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Unary #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum UnaryOp { /// The increment operator increments (adds one to) its operand and returns a value. diff --git a/boa_ast/src/expression/optional.rs b/boa_ast/src/expression/optional.rs index f5f3a58d647..7d7ff48cdd6 100644 --- a/boa_ast/src/expression/optional.rs +++ b/boa_ast/src/expression/optional.rs @@ -9,10 +9,7 @@ use super::{access::PropertyAccessField, Expression}; /// List of valid operations in an [`Optional`] chain. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum OptionalOperationKind { /// A property access (`a?.prop`). @@ -77,10 +74,7 @@ impl VisitWith for OptionalOperationKind { /// In contrast, a non-shorted operation (`.prop`) will try to access the property, even if the target /// is `undefined` or `null`. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct OptionalOperation { kind: OptionalOperationKind, @@ -183,10 +177,7 @@ impl VisitWith for OptionalOperation { /// [spec]: https://tc39.es/ecma262/multipage/ecmascript-language-expressions.html#prod-OptionalExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Optional { target: Box, diff --git a/boa_ast/src/expression/spread.rs b/boa_ast/src/expression/spread.rs index 38326e253f5..fc86dde42ad 100644 --- a/boa_ast/src/expression/spread.rs +++ b/boa_ast/src/expression/spread.rs @@ -23,10 +23,7 @@ use super::Expression; /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(transparent))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Spread { target: Box, diff --git a/boa_ast/src/expression/tagged_template.rs b/boa_ast/src/expression/tagged_template.rs index db202618d78..2a01bbbf200 100644 --- a/boa_ast/src/expression/tagged_template.rs +++ b/boa_ast/src/expression/tagged_template.rs @@ -14,10 +14,7 @@ use super::Expression; /// [moz]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#tagged_templates /// [spec]: https://tc39.es/ecma262/#sec-tagged-templates #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct TaggedTemplate { tag: Box, diff --git a/boa_ast/src/expression/yield.rs b/boa_ast/src/expression/yield.rs index efd9981bd40..7357e00c64d 100644 --- a/boa_ast/src/expression/yield.rs +++ b/boa_ast/src/expression/yield.rs @@ -14,10 +14,7 @@ use super::Expression; /// [spec]: https://tc39.es/ecma262/#prod-YieldExpression /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Yield { target: Option>, diff --git a/boa_ast/src/function/arrow_function.rs b/boa_ast/src/function/arrow_function.rs index 3cd1b986db2..c02c3a8e2a3 100644 --- a/boa_ast/src/function/arrow_function.rs +++ b/boa_ast/src/function/arrow_function.rs @@ -19,10 +19,7 @@ use super::FormalParameterList; /// [spec]: https://tc39.es/ecma262/#prod-ArrowFunction /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct ArrowFunction { name: Option, diff --git a/boa_ast/src/function/async_arrow_function.rs b/boa_ast/src/function/async_arrow_function.rs index 09c8a5f7d72..191de2f5422 100644 --- a/boa_ast/src/function/async_arrow_function.rs +++ b/boa_ast/src/function/async_arrow_function.rs @@ -19,10 +19,7 @@ use boa_interner::{Interner, ToIndentedString}; /// [spec]: https://tc39.es/ecma262/#prod-AsyncArrowFunction /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct AsyncArrowFunction { name: Option, diff --git a/boa_ast/src/function/async_function.rs b/boa_ast/src/function/async_function.rs index 6d53cb39842..17df80504f8 100644 --- a/boa_ast/src/function/async_function.rs +++ b/boa_ast/src/function/async_function.rs @@ -20,10 +20,7 @@ use super::FormalParameterList; /// [spec]: https://tc39.es/ecma262/#sec-async-function-definitions /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct AsyncFunction { name: Option, diff --git a/boa_ast/src/function/async_generator.rs b/boa_ast/src/function/async_generator.rs index 21214a53de9..420a8bbd23f 100644 --- a/boa_ast/src/function/async_generator.rs +++ b/boa_ast/src/function/async_generator.rs @@ -19,10 +19,7 @@ use super::FormalParameterList; /// [spec]: https://tc39.es/ecma262/#sec-async-generator-function-definitions /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function* #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct AsyncGenerator { name: Option, diff --git a/boa_ast/src/function/class.rs b/boa_ast/src/function/class.rs index 56c37106fc5..dea5811eedf 100644 --- a/boa_ast/src/function/class.rs +++ b/boa_ast/src/function/class.rs @@ -22,10 +22,7 @@ use super::Function; /// [spec]: https://tc39.es/ecma262/#sec-class-definitions /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Class { name: Option, @@ -410,10 +407,7 @@ impl VisitWith for Class { /// /// [spec]: https://tc39.es/ecma262/#prod-ClassElement #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum ClassElement { /// A method definition, including `get` and `set` accessors. diff --git a/boa_ast/src/function/generator.rs b/boa_ast/src/function/generator.rs index 72d0ebff58e..5478633d46e 100644 --- a/boa_ast/src/function/generator.rs +++ b/boa_ast/src/function/generator.rs @@ -21,10 +21,7 @@ use super::FormalParameterList; /// [spec]: https://tc39.es/ecma262/#sec-generator-function-definitions /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function* #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Generator { name: Option, diff --git a/boa_ast/src/function/mod.rs b/boa_ast/src/function/mod.rs index cad45374c90..4aa1d06c395 100644 --- a/boa_ast/src/function/mod.rs +++ b/boa_ast/src/function/mod.rs @@ -57,10 +57,7 @@ use super::Declaration; /// [spec]: https://tc39.es/ecma262/#sec-function-definitions /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Function { name: Option, diff --git a/boa_ast/src/function/parameters.rs b/boa_ast/src/function/parameters.rs index 1d8648ae6a3..9d80ebd86b7 100644 --- a/boa_ast/src/function/parameters.rs +++ b/boa_ast/src/function/parameters.rs @@ -166,7 +166,7 @@ impl VisitWith for FormalParameterList { } } -#[cfg(feature = "fuzzer-not-safe-for-production")] +#[cfg(feature = "fuzz")] impl<'a> arbitrary::Arbitrary<'a> for FormalParameterList { fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { let params: Vec = u.arbitrary()?; @@ -214,10 +214,7 @@ impl Default for FormalParameterListFlags { /// [spec]: https://tc39.es/ecma262/#prod-FormalParameter /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Missing_formal_parameter #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct FormalParameter { variable: Variable, diff --git a/boa_ast/src/pattern.rs b/boa_ast/src/pattern.rs index a7af2932ac6..bd9b8694306 100644 --- a/boa_ast/src/pattern.rs +++ b/boa_ast/src/pattern.rs @@ -36,10 +36,7 @@ use core::ops::ControlFlow; /// /// See the [module level documentation][self] for more information. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum Pattern { /// An object pattern (`let {a, b, c} = object`). @@ -112,10 +109,7 @@ impl VisitWith for Pattern { /// [spec1]: https://tc39.es/ecma262/#prod-ObjectBindingPattern /// [spec2]: https://tc39.es/ecma262/#prod-ObjectAssignmentPattern #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct ObjectPattern(Box<[ObjectPatternElement]>); @@ -204,10 +198,7 @@ impl VisitWith for ObjectPattern { /// [spec1]: https://tc39.es/ecma262/#prod-ArrayBindingPattern /// [spec2]: https://tc39.es/ecma262/#prod-ArrayAssignmentPattern #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct ArrayPattern(Box<[ArrayPatternElement]>); @@ -282,10 +273,7 @@ impl VisitWith for ArrayPattern { /// [spec1]: https://tc39.es/ecma262/#prod-BindingProperty /// [spec2]: https://tc39.es/ecma262/#prod-AssignmentProperty #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum ObjectPatternElement { /// SingleName represents one of the following properties: @@ -585,10 +573,7 @@ impl VisitWith for ObjectPatternElement { /// [spec1]: https://tc39.es/ecma262/#prod-BindingElement /// [spec2]: https://tc39.es/ecma262/#prod-AssignmentElement #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum ArrayPatternElement { /// Elision represents the elision of an item in the array binding pattern. diff --git a/boa_ast/src/property.rs b/boa_ast/src/property.rs index acc0990d377..c6537199038 100644 --- a/boa_ast/src/property.rs +++ b/boa_ast/src/property.rs @@ -25,10 +25,7 @@ use super::{ /// [mdn]: https://developer.mozilla.org/en-US/docs/Glossary/property/JavaScript // TODO: Support all features: https://tc39.es/ecma262/#prod-PropertyDefinition #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum PropertyDefinition { /// Puts a variable into an object. @@ -141,10 +138,7 @@ impl VisitWith for PropertyDefinition { /// [spec]: https://tc39.es/ecma262/#prod-MethodDefinition /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum MethodDefinition { /// The `get` syntax binds an object property to a function that will be called when that property is looked up. @@ -256,10 +250,7 @@ impl VisitWith for MethodDefinition { /// /// [spec]: https://tc39.es/ecma262/#prod-PropertyName #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum PropertyName { /// A `Literal` property name can be either an identifier, a string or a numeric literal. diff --git a/boa_ast/src/statement/block.rs b/boa_ast/src/statement/block.rs index e725eaa791f..afd402ae33e 100644 --- a/boa_ast/src/statement/block.rs +++ b/boa_ast/src/statement/block.rs @@ -23,10 +23,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-BlockStatement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/block #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq, Default)] pub struct Block { #[cfg_attr(feature = "serde", serde(flatten))] diff --git a/boa_ast/src/statement/if.rs b/boa_ast/src/statement/if.rs index b8969a7e1bc..f41cbae6614 100644 --- a/boa_ast/src/statement/if.rs +++ b/boa_ast/src/statement/if.rs @@ -26,10 +26,7 @@ use core::ops::ControlFlow; /// [falsy]: https://developer.mozilla.org/en-US/docs/Glossary/falsy /// [expression]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Expressions #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct If { condition: Expression, diff --git a/boa_ast/src/statement/iteration/break.rs b/boa_ast/src/statement/iteration/break.rs index 263364ee1ab..578f91a9027 100644 --- a/boa_ast/src/statement/iteration/break.rs +++ b/boa_ast/src/statement/iteration/break.rs @@ -19,10 +19,7 @@ use crate::Statement; /// [spec]: https://tc39.es/ecma262/#prod-BreakStatement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Break { label: Option, diff --git a/boa_ast/src/statement/iteration/continue.rs b/boa_ast/src/statement/iteration/continue.rs index 2e3aae0938d..ed2a19f527e 100644 --- a/boa_ast/src/statement/iteration/continue.rs +++ b/boa_ast/src/statement/iteration/continue.rs @@ -17,10 +17,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-ContinueStatement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/continue #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Continue { label: Option, diff --git a/boa_ast/src/statement/iteration/do_while_loop.rs b/boa_ast/src/statement/iteration/do_while_loop.rs index e368e63a4a5..34fd03f33a4 100644 --- a/boa_ast/src/statement/iteration/do_while_loop.rs +++ b/boa_ast/src/statement/iteration/do_while_loop.rs @@ -20,10 +20,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#sec-do-while-statement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/do...while #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct DoWhileLoop { body: Box, diff --git a/boa_ast/src/statement/iteration/for_in_loop.rs b/boa_ast/src/statement/iteration/for_in_loop.rs index fb28c7c454e..41e11083eff 100644 --- a/boa_ast/src/statement/iteration/for_in_loop.rs +++ b/boa_ast/src/statement/iteration/for_in_loop.rs @@ -15,10 +15,7 @@ use core::ops::ControlFlow; /// [forin]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in /// [spec]: https://tc39.es/ecma262/#prod-ForInOfStatement #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct ForInLoop { initializer: IterableLoopInitializer, diff --git a/boa_ast/src/statement/iteration/for_loop.rs b/boa_ast/src/statement/iteration/for_loop.rs index 010aa80bd86..ea661100447 100644 --- a/boa_ast/src/statement/iteration/for_loop.rs +++ b/boa_ast/src/statement/iteration/for_loop.rs @@ -19,10 +19,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-ForDeclaration /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct ForLoop { #[cfg_attr(feature = "serde", serde(flatten))] @@ -139,10 +136,7 @@ impl VisitWith for ForLoop { /// Inner structure to avoid multiple indirections in the heap. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] struct InnerForLoop { init: Option, @@ -202,10 +196,7 @@ impl InnerForLoop { /// /// [spec]: https://tc39.es/ecma262/#prod-ForStatement #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum ForLoopInitializer { /// An expression initializer. diff --git a/boa_ast/src/statement/iteration/for_of_loop.rs b/boa_ast/src/statement/iteration/for_of_loop.rs index e88e053132d..ead1768106c 100644 --- a/boa_ast/src/statement/iteration/for_of_loop.rs +++ b/boa_ast/src/statement/iteration/for_of_loop.rs @@ -20,10 +20,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-ForInOfStatement /// [forawait]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct ForOfLoop { init: IterableLoopInitializer, diff --git a/boa_ast/src/statement/iteration/mod.rs b/boa_ast/src/statement/iteration/mod.rs index 22e938511fc..4377bedc694 100644 --- a/boa_ast/src/statement/iteration/mod.rs +++ b/boa_ast/src/statement/iteration/mod.rs @@ -35,10 +35,7 @@ use boa_interner::{Interner, ToInternedString}; /// /// [spec]: https://tc39.es/ecma262/#prod-ForInOfStatement #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum IterableLoopInitializer { /// An already declared variable. diff --git a/boa_ast/src/statement/iteration/while_loop.rs b/boa_ast/src/statement/iteration/while_loop.rs index e3d0fba4737..ab568182100 100644 --- a/boa_ast/src/statement/iteration/while_loop.rs +++ b/boa_ast/src/statement/iteration/while_loop.rs @@ -19,10 +19,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-grammar-notation-WhileStatement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/while #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct WhileLoop { condition: Expression, diff --git a/boa_ast/src/statement/labelled.rs b/boa_ast/src/statement/labelled.rs index 6c6f1376a90..89884ff8537 100644 --- a/boa_ast/src/statement/labelled.rs +++ b/boa_ast/src/statement/labelled.rs @@ -17,10 +17,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-LabelledItem /// [label-fn]: https://tc39.es/ecma262/#sec-labelled-function-declarations #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum LabelledItem { /// A labelled [`Function`]. @@ -85,10 +82,7 @@ impl VisitWith for LabelledItem { /// /// [spec]: https://tc39.es/ecma262/#sec-labelled-statements #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Labelled { item: Box, diff --git a/boa_ast/src/statement/mod.rs b/boa_ast/src/statement/mod.rs index 9f173dd66a8..f412a47b98b 100644 --- a/boa_ast/src/statement/mod.rs +++ b/boa_ast/src/statement/mod.rs @@ -38,10 +38,7 @@ use super::{declaration::VarDeclaration, expression::Expression}; /// /// See the [module level documentation][self] for more information. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum Statement { /// See [`Block`]. diff --git a/boa_ast/src/statement/return.rs b/boa_ast/src/statement/return.rs index 20e1ca8897a..6cd3d36ba22 100644 --- a/boa_ast/src/statement/return.rs +++ b/boa_ast/src/statement/return.rs @@ -24,10 +24,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-ReturnStatement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/return #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Return { target: Option, diff --git a/boa_ast/src/statement/switch.rs b/boa_ast/src/statement/switch.rs index a3de634ee70..77ce5d79442 100644 --- a/boa_ast/src/statement/switch.rs +++ b/boa_ast/src/statement/switch.rs @@ -19,10 +19,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-CaseClause /// [truthy]: https://developer.mozilla.org/en-US/docs/Glossary/Truthy #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Case { condition: Expression, @@ -87,10 +84,7 @@ impl VisitWith for Case { /// [spec]: https://tc39.es/ecma262/#prod-SwitchStatement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Switch { val: Expression, diff --git a/boa_ast/src/statement/throw.rs b/boa_ast/src/statement/throw.rs index a114cff5400..e3936d5c919 100644 --- a/boa_ast/src/statement/throw.rs +++ b/boa_ast/src/statement/throw.rs @@ -21,10 +21,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-ThrowStatement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/throw #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Throw { target: Expression, diff --git a/boa_ast/src/statement/try.rs b/boa_ast/src/statement/try.rs index bb07725a1b9..c8c673e69a1 100644 --- a/boa_ast/src/statement/try.rs +++ b/boa_ast/src/statement/try.rs @@ -23,10 +23,7 @@ use core::ops::ControlFlow; /// [spec]: https://tc39.es/ecma262/#prod-TryStatement /// [mdn]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Try { block: Block, @@ -35,10 +32,7 @@ pub struct Try { /// The type of error handler in a [`Try`] statement. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum ErrorHandler { /// A [`Catch`] error handler. @@ -145,10 +139,7 @@ impl VisitWith for Try { /// Catch block. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Catch { parameter: Option, @@ -217,10 +208,7 @@ impl VisitWith for Catch { /// Finally block. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub struct Finally { block: Block, diff --git a/boa_ast/src/statement_list.rs b/boa_ast/src/statement_list.rs index 9dbff9f4e84..35221ecf070 100644 --- a/boa_ast/src/statement_list.rs +++ b/boa_ast/src/statement_list.rs @@ -18,10 +18,7 @@ use std::cmp::Ordering; /// /// [spec]: https://tc39.es/ecma262/#prod-StatementListItem #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[derive(Clone, Debug, PartialEq)] pub enum StatementListItem { /// See [`Statement`]. @@ -203,7 +200,7 @@ impl VisitWith for StatementList { } } -#[cfg(feature = "fuzzer-not-safe-for-production")] +#[cfg(feature = "fuzz")] impl<'a> arbitrary::Arbitrary<'a> for StatementList { fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { Ok(Self { diff --git a/boa_engine/Cargo.toml b/boa_engine/Cargo.toml index 0d3d11e5df5..ddbf2cdc2fc 100644 --- a/boa_engine/Cargo.toml +++ b/boa_engine/Cargo.toml @@ -24,7 +24,7 @@ intl = [ "dep:sys-locale" ] -fuzzer-not-safe-for-production = ["boa_ast/fuzzer-not-safe-for-production", "boa_interner/fuzzer-not-safe-for-production"] +fuzz = ["boa_ast/fuzz", "boa_interner/fuzz"] # Enable Boa's WHATWG console object implementation. console = [] diff --git a/boa_interner/Cargo.toml b/boa_interner/Cargo.toml index 4ea19e8b231..5f07b9289d3 100644 --- a/boa_interner/Cargo.toml +++ b/boa_interner/Cargo.toml @@ -11,7 +11,7 @@ repository.workspace = true rust-version.workspace = true [features] -fuzzer-not-safe-for-production = ["arbitrary"] +fuzz = ["arbitrary"] [dependencies] boa_macros.workspace = true diff --git a/boa_interner/src/sym.rs b/boa_interner/src/sym.rs index 92b016d7cec..f77c8739625 100644 --- a/boa_interner/src/sym.rs +++ b/boa_interner/src/sym.rs @@ -13,10 +13,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", serde(transparent))] -#[cfg_attr( - feature = "fuzzer-not-safe-for-production", - derive(arbitrary::Arbitrary) -)] +#[cfg_attr(feature = "fuzz", derive(arbitrary::Arbitrary))] #[allow(clippy::unsafe_derive_deserialize)] pub struct Sym { value: NonZeroUsize, @@ -130,14 +127,6 @@ impl Sym { } /// Returns the internal value of the [`Sym`] - #[cfg(not(feature = "fuzzer-not-safe-for-production"))] - #[inline] - pub(super) const fn get(self) -> usize { - self.value.get() - } - - /// Returns the internal value of the [`Sym`] - #[cfg(feature = "fuzzer-not-safe-for-production")] #[inline] pub const fn get(self) -> usize { self.value.get() diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index a9781e10468..9a0c06d8996 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -78,7 +78,7 @@ dependencies = [ ] [[package]] -name = "boa_engine-fuzz" +name = "boa_fuzz" version = "0.0.0" dependencies = [ "boa_ast", @@ -464,9 +464,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 28d022c47d0..62ceab94043 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "boa_engine-fuzz" +name = "boa_fuzz" version = "0.0.0" publish = false edition = "2021" @@ -10,21 +10,13 @@ cargo-fuzz = true [dependencies] libfuzzer-sys = "0.4" -[dependencies.boa_ast] -path = "../boa_ast" -features = ["fuzzer-not-safe-for-production"] - -[dependencies.boa_engine] -path = "../boa_engine" -features = ["fuzzer-not-safe-for-production"] - -[dependencies.boa_interner] -path = "../boa_interner" -features = ["fuzzer-not-safe-for-production"] +boa_ast = { path = "../boa_ast", features = ["fuzz"] } +boa_engine = { path = "../boa_engine", features = ["fuzz"] } +boa_interner = { path = "../boa_interner", features = ["fuzz"] } # Prevent this from interfering with workspaces [workspace] -members = [""] +members = ["."] [profile.release] debug = 1