Skip to content

Commit a265f39

Browse files
authored
chore: update rust edition 2024 (#576)
1 parent 3caa543 commit a265f39

File tree

181 files changed

+864
-839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+864
-839
lines changed

Diff for: Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = ["nova_cli", "nova_vm", "small_string", "tests"]
44
exclude = ["nova_lint"]
55

66
[workspace.package]
7-
edition = "2021"
7+
edition = "2024"
88
version = "0.1.0"
99
license = "MPL-2.0"
1010
homepage = "https://trynova.dev"

Diff for: nova_cli/src/helper.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use nova_vm::{
66
ecmascript::{
7-
builtins::{create_builtin_function, ArgumentsList, Behaviour, BuiltinFunctionArgs},
8-
execution::{agent::ExceptionType, Agent, JsResult},
7+
builtins::{ArgumentsList, Behaviour, BuiltinFunctionArgs, create_builtin_function},
8+
execution::{Agent, JsResult, agent::ExceptionType},
99
types::{
1010
InternalMethods, IntoValue, Object, OrdinaryObject, PropertyDescriptor, PropertyKey,
1111
String, Value,

Diff for: nova_cli/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use helper::{
1414
use nova_vm::{
1515
ecmascript::{
1616
execution::{
17-
agent::{GcAgent, HostHooks, Job, Options},
1817
Agent, JsResult,
18+
agent::{GcAgent, HostHooks, Job, Options},
1919
},
2020
scripts_and_modules::script::{parse_script, script_evaluation},
2121
types::{Object, String as JsString, Value},

Diff for: nova_lint/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "nova_lint"
33
repository = "https://github.com/trynova/nova/tree/main/nova_lint"
44
description = "A collection of custom lints to ease the development and maintenance of the Nova project."
5-
edition = "2021"
5+
edition = "2024"
66
version = "0.1.0"
77
license = "MPL-2.0"
88
homepage = "https://trynova.dev"

Diff for: nova_lint/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mod utils;
2929

3030
pub(crate) use utils::*;
3131

32-
#[no_mangle]
32+
#[unsafe(no_mangle)]
3333
pub fn register_lints(sess: &rustc_session::Session, lint_store: &mut rustc_lint::LintStore) {
3434
agent_comes_first::register_lints(sess, lint_store);
3535
gc_scope_comes_last::register_lints(sess, lint_store);

Diff for: nova_vm/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use small_string::SmallString;
66
use std::fs::File;
7-
use std::io::{self, prelude::*, BufReader};
7+
use std::io::{self, BufReader, prelude::*};
88

99
fn replace_invalid_key_characters(string: &str) -> String {
1010
let mut string = string.to_owned();

Diff for: nova_vm/src/ecmascript/abstract_operations/operations_on_iterator_objects.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ use crate::{
1010
operations_on_objects::{call, call_function, get, get_method, try_get_method},
1111
type_conversion::to_boolean,
1212
},
13-
builtins::{ordinary::ordinary_object_create_with_intrinsics, ArgumentsList},
13+
builtins::{ArgumentsList, ordinary::ordinary_object_create_with_intrinsics},
1414
execution::{
15-
agent::{ExceptionType, JsError},
1615
Agent, JsResult, ProtoIntrinsics,
16+
agent::{ExceptionType, JsError},
1717
},
1818
types::{
19-
Function, IntoValue, Object, PropertyDescriptor, PropertyKey, Value,
20-
BUILTIN_STRING_MEMORY,
19+
BUILTIN_STRING_MEMORY, Function, IntoValue, Object, PropertyDescriptor, PropertyKey,
20+
Value,
2121
},
2222
},
2323
engine::{
24-
context::{Bindable, GcScope, NoGcScope},
2524
Scoped, TryResult,
25+
context::{Bindable, GcScope, NoGcScope},
2626
},
2727
heap::{CompactionLists, HeapMarkAndSweep, WellKnownSymbolIndexes, WorkQueues},
2828
};

Diff for: nova_vm/src/ecmascript/abstract_operations/operations_on_objects.rs

+16-17
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,33 @@ use super::{
1414
},
1515
};
1616
use crate::{
17-
ecmascript::types::scope_property_keys,
18-
engine::{
19-
context::{Bindable, GcScope, NoGcScope},
20-
rootable::Rootable,
21-
unwrap_try, Scoped, TryResult,
22-
},
23-
};
24-
use crate::{
17+
SmallInteger,
2518
ecmascript::{
2619
abstract_operations::operations_on_iterator_objects::iterator_step_value,
2720
builtins::{
28-
array_create,
21+
ArgumentsList, Array, BuiltinConstructorFunction, array_create,
2922
keyed_collections::map_objects::map_prototype::canonicalize_keyed_collection_key,
30-
ArgumentsList, Array, BuiltinConstructorFunction,
3123
},
3224
execution::{
33-
agent::ExceptionType, new_class_field_initializer_environment, Agent,
34-
ECMAScriptCodeEvaluationState, EnvironmentIndex, ExecutionContext, JsResult,
35-
RealmIdentifier,
25+
Agent, ECMAScriptCodeEvaluationState, EnvironmentIndex, ExecutionContext, JsResult,
26+
RealmIdentifier, agent::ExceptionType, new_class_field_initializer_environment,
3627
},
3728
types::{
38-
Function, InternalMethods, IntoFunction, IntoObject, IntoValue, Number, Object,
39-
OrdinaryObject, PropertyDescriptor, PropertyKey, String, Value, BUILTIN_STRING_MEMORY,
29+
BUILTIN_STRING_MEMORY, Function, InternalMethods, IntoFunction, IntoObject, IntoValue,
30+
Number, Object, OrdinaryObject, PropertyDescriptor, PropertyKey, String, Value,
4031
},
4132
},
42-
engine::{instanceof_operator, Vm},
33+
engine::{Vm, instanceof_operator},
4334
heap::{Heap, ObjectEntry},
44-
SmallInteger,
35+
};
36+
use crate::{
37+
ecmascript::types::scope_property_keys,
38+
engine::{
39+
Scoped, TryResult,
40+
context::{Bindable, GcScope, NoGcScope},
41+
rootable::Rootable,
42+
unwrap_try,
43+
},
4544
};
4645

4746
/// ### [7.3.1 MakeBasicObject ( internalSlotsList )](https://tc39.es/ecma262/#sec-makebasicobject)

Diff for: nova_vm/src/ecmascript/abstract_operations/testing_and_comparison.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@
66
77
use crate::ecmascript::abstract_operations::type_conversion::to_numeric_primitive;
88
use crate::ecmascript::builtins::proxy::abstract_operations::{
9-
validate_non_revoked_proxy, NonRevokedProxy,
9+
NonRevokedProxy, validate_non_revoked_proxy,
1010
};
1111
use crate::ecmascript::types::{InternalSlots, Numeric, Primitive, PropertyKey};
12-
use crate::engine::context::{Bindable, GcScope, NoGcScope};
1312
use crate::engine::TryResult;
13+
use crate::engine::context::{Bindable, GcScope, NoGcScope};
1414
use crate::heap::WellKnownSymbolIndexes;
1515
use crate::{
1616
ecmascript::{
17-
execution::{agent::ExceptionType, Agent, JsResult},
17+
execution::{Agent, JsResult, agent::ExceptionType},
1818
types::{
19-
bigint::BigInt, Function, InternalMethods, IntoValue, Number, Object, String, Value,
19+
Function, InternalMethods, IntoValue, Number, Object, String, Value, bigint::BigInt,
2020
},
2121
},
2222
heap::PrimitiveHeapIndexable,
2323
};
2424

2525
use super::operations_on_objects::get;
2626
use super::type_conversion::{
27-
string_to_big_int, string_to_number, to_boolean, to_primitive, PreferredType,
27+
PreferredType, string_to_big_int, string_to_number, to_boolean, to_primitive,
2828
};
2929

3030
/// ### [7.2.1 RequireObjectCoercible ( argument )](https://tc39.es/ecma262/#sec-requireobjectcoercible)

Diff for: nova_vm/src/ecmascript/abstract_operations/type_conversion.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
use num_bigint::Sign;
1818

1919
use crate::ecmascript::types::IntoPrimitive;
20-
use crate::engine::context::{Bindable, GcScope, NoGcScope};
2120
use crate::engine::TryResult;
21+
use crate::engine::context::{Bindable, GcScope, NoGcScope};
2222
use crate::{
23+
SmallInteger,
2324
ecmascript::{
2425
builtins::{
25-
primitive_objects::{PrimitiveObjectData, PrimitiveObjectHeapData},
2626
ArgumentsList,
27+
primitive_objects::{PrimitiveObjectData, PrimitiveObjectHeapData},
2728
},
28-
execution::{agent::ExceptionType, Agent, JsResult},
29+
execution::{Agent, JsResult, agent::ExceptionType},
2930
types::{
30-
BigInt, IntoNumeric, IntoObject, IntoValue, Number, Numeric, Object, Primitive,
31-
PropertyKey, String, Value, BUILTIN_STRING_MEMORY,
31+
BUILTIN_STRING_MEMORY, BigInt, IntoNumeric, IntoObject, IntoValue, Number, Numeric,
32+
Object, Primitive, PropertyKey, String, Value,
3233
},
3334
},
3435
heap::{CreateHeapData, WellKnownSymbolIndexes},
35-
SmallInteger,
3636
};
3737

3838
use super::{

Diff for: nova_vm/src/ecmascript/builders/builtin_function_builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use crate::{
1010
},
1111
execution::{Agent, RealmIdentifier},
1212
types::{
13-
BuiltinFunctionHeapData, IntoFunction, IntoObject, IntoValue, Object, ObjectHeapData,
14-
OrdinaryObject, PropertyKey, String, Value, BUILTIN_STRING_MEMORY,
13+
BUILTIN_STRING_MEMORY, BuiltinFunctionHeapData, IntoFunction, IntoObject, IntoValue,
14+
Object, ObjectHeapData, OrdinaryObject, PropertyKey, String, Value,
1515
},
1616
},
1717
engine::context::Bindable,

Diff for: nova_vm/src/ecmascript/builders/ordinary_object_builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use crate::{
77
builtins::{Builtin, BuiltinFunction, BuiltinGetter, BuiltinIntrinsic},
88
execution::{Agent, RealmIdentifier},
99
types::{
10-
IntoFunction, IntoObject, IntoValue, ObjectHeapData, OrdinaryObject, PropertyKey,
11-
Value, BUILTIN_STRING_MEMORY,
10+
BUILTIN_STRING_MEMORY, IntoFunction, IntoObject, IntoValue, ObjectHeapData,
11+
OrdinaryObject, PropertyKey, Value,
1212
},
1313
},
1414
heap::{element_array::ElementDescriptor, indexes::ObjectIndex},

Diff for: nova_vm/src/ecmascript/builtins.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,18 @@ pub(crate) mod weak_ref;
5555
pub(crate) mod weak_set;
5656

5757
pub(crate) use arguments::*;
58-
pub(crate) use array::abstract_operations::*;
5958
pub use array::Array;
59+
pub(crate) use array::abstract_operations::*;
6060
pub(crate) use array::{ArrayHeapData, SealableElementsVector};
6161
#[cfg(feature = "array-buffer")]
6262
pub use array_buffer::ArrayBuffer;
6363
#[cfg(feature = "array-buffer")]
6464
pub(crate) use array_buffer::ArrayBufferHeapData;
6565
pub use builtin_constructor::BuiltinConstructorFunction;
66-
pub(crate) use builtin_constructor::{create_builtin_constructor, BuiltinConstructorArgs};
66+
pub(crate) use builtin_constructor::{BuiltinConstructorArgs, create_builtin_constructor};
6767
pub use builtin_function::{
68-
create_builtin_function, ArgumentsList, Behaviour, Builtin, BuiltinFunction,
69-
BuiltinFunctionArgs, BuiltinGetter, ConstructorFn, RegularFn as JsFunction, RegularFn,
68+
ArgumentsList, Behaviour, Builtin, BuiltinFunction, BuiltinFunctionArgs, BuiltinGetter,
69+
ConstructorFn, RegularFn as JsFunction, RegularFn, create_builtin_function,
7070
};
7171
pub(crate) use builtin_function::{BuiltinIntrinsic, BuiltinIntrinsicConstructor};
7272
pub use control_abstraction_objects::*;

Diff for: nova_vm/src/ecmascript/builtins/arguments.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ use crate::{
3333
abstract_operations::operations_on_objects::{
3434
try_create_data_property_or_throw, try_define_property_or_throw,
3535
},
36-
execution::{agent::Agent, ProtoIntrinsics},
36+
execution::{ProtoIntrinsics, agent::Agent},
3737
types::{
38-
IntoFunction, IntoValue, Number, Object, PropertyDescriptor, PropertyKey, Value,
39-
BUILTIN_STRING_MEMORY,
38+
BUILTIN_STRING_MEMORY, IntoFunction, IntoValue, Number, Object, PropertyDescriptor,
39+
PropertyKey, Value,
4040
},
4141
},
4242
heap::WellKnownSymbolIndexes,

Diff for: nova_vm/src/ecmascript/builtins/array.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,20 @@ use crate::{
2323
},
2424
execution::{Agent, JsResult, ProtoIntrinsics},
2525
types::{
26-
Function, InternalMethods, InternalSlots, IntoObject, IntoValue, Object,
27-
OrdinaryObject, PropertyDescriptor, PropertyKey, Value, BUILTIN_STRING_MEMORY,
26+
BUILTIN_STRING_MEMORY, Function, InternalMethods, InternalSlots, IntoObject, IntoValue,
27+
Object, OrdinaryObject, PropertyDescriptor, PropertyKey, Value,
2828
},
2929
},
3030
engine::{
31+
Scoped, TryResult,
3132
context::{Bindable, GcScope, NoGcScope},
3233
rootable::{HeapRootData, HeapRootRef, Rootable},
33-
unwrap_try, Scoped, TryResult,
34+
unwrap_try,
3435
},
3536
heap::{
37+
CreateHeapData, Heap, HeapMarkAndSweep, WorkQueues,
3638
element_array::{ElementArrays, ElementDescriptor},
3739
indexes::ArrayIndex,
38-
CreateHeapData, Heap, HeapMarkAndSweep, WorkQueues,
3940
},
4041
};
4142

@@ -251,10 +252,12 @@ impl<'a> InternalSlots<'a> for Array<'a> {
251252
}
252253

253254
fn set_backing_object(self, agent: &mut Agent, backing_object: OrdinaryObject<'static>) {
254-
assert!(agent[self]
255-
.object_index
256-
.replace(backing_object.unbind())
257-
.is_none());
255+
assert!(
256+
agent[self]
257+
.object_index
258+
.replace(backing_object.unbind())
259+
.is_none()
260+
);
258261
}
259262

260263
fn internal_set_extensible(self, agent: &mut Agent, value: bool) {

Diff for: nova_vm/src/ecmascript/builtins/array/abstract_operations.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

55
use crate::ecmascript::abstract_operations::type_conversion::to_uint32_number;
6-
use crate::engine::context::{Bindable, GcScope, NoGcScope};
76
use crate::engine::TryResult;
7+
use crate::engine::context::{Bindable, GcScope, NoGcScope};
88
use crate::{
99
ecmascript::{
1010
abstract_operations::{
@@ -13,13 +13,13 @@ use crate::{
1313
type_conversion::{to_number, to_uint32},
1414
},
1515
builtins::ArgumentsList,
16-
execution::{agent::ExceptionType, Agent, JsResult},
17-
types::{IntoObject, Number, Object, PropertyDescriptor, Value, BUILTIN_STRING_MEMORY},
16+
execution::{Agent, JsResult, agent::ExceptionType},
17+
types::{BUILTIN_STRING_MEMORY, IntoObject, Number, Object, PropertyDescriptor, Value},
1818
},
19-
heap::{indexes::ArrayIndex, Heap, WellKnownSymbolIndexes},
19+
heap::{Heap, WellKnownSymbolIndexes, indexes::ArrayIndex},
2020
};
2121

22-
use super::{data::SealableElementsVector, Array, ArrayHeapData};
22+
use super::{Array, ArrayHeapData, data::SealableElementsVector};
2323

2424
/// ### [10.4.2.2 ArrayCreate ( length \[ , proto \] )](https://tc39.es/ecma262/#sec-arraycreate)
2525
///

Diff for: nova_vm/src/ecmascript/builtins/array/data.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
use crate::{
66
ecmascript::types::{OrdinaryObject, Value},
77
heap::{
8+
CompactionLists, HeapMarkAndSweep, WorkQueues,
89
element_array::{ElementArrayKey, ElementArrays, ElementDescriptor, ElementsVector},
910
indexes::ElementIndex,
10-
CompactionLists, HeapMarkAndSweep, WorkQueues,
1111
},
1212
};
1313

Diff for: nova_vm/src/ecmascript/builtins/array_buffer.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ use crate::{
1414
},
1515
},
1616
engine::{
17+
Scoped,
1718
context::{Bindable, NoGcScope},
1819
rootable::{HeapRootData, HeapRootRef, Rootable},
19-
Scoped,
2020
},
2121
heap::{
22-
indexes::{ArrayBufferIndex, IntoBaseIndex},
2322
CompactionLists, CreateHeapData, Heap, HeapMarkAndSweep, WorkQueues,
23+
indexes::{ArrayBufferIndex, IntoBaseIndex},
2424
},
2525
};
2626

2727
use abstract_operations::detach_array_buffer;
2828
pub(crate) use abstract_operations::{
29-
allocate_array_buffer, array_buffer_byte_length, clone_array_buffer, get_value_from_buffer,
30-
is_detached_buffer, is_fixed_length_array_buffer, set_value_in_buffer, DetachKey, Ordering,
29+
DetachKey, Ordering, allocate_array_buffer, array_buffer_byte_length, clone_array_buffer,
30+
get_value_from_buffer, is_detached_buffer, is_fixed_length_array_buffer, set_value_in_buffer,
3131
};
3232
use core::ops::{Index, IndexMut};
3333
pub use data::*;
@@ -242,10 +242,12 @@ impl<'a> InternalSlots<'a> for ArrayBuffer<'a> {
242242
}
243243

244244
fn set_backing_object(self, agent: &mut Agent, backing_object: OrdinaryObject<'static>) {
245-
assert!(agent[self]
246-
.object_index
247-
.replace(backing_object.unbind())
248-
.is_none());
245+
assert!(
246+
agent[self]
247+
.object_index
248+
.replace(backing_object.unbind())
249+
.is_none()
250+
);
249251
}
250252
}
251253

Diff for: nova_vm/src/ecmascript/builtins/array_buffer/abstract_operations.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use crate::ecmascript::abstract_operations::type_conversion::to_index;
77
use crate::ecmascript::types::{Numeric, Viewable};
88
use crate::engine::context::{Bindable, GcScope, NoGcScope};
99
use crate::{
10+
Heap,
1011
ecmascript::{
1112
abstract_operations::operations_on_objects::get,
12-
execution::{agent::ExceptionType, Agent, JsResult},
13-
types::{DataBlock, Function, IntoFunction, Number, Object, Value, BUILTIN_STRING_MEMORY},
13+
execution::{Agent, JsResult, agent::ExceptionType},
14+
types::{BUILTIN_STRING_MEMORY, DataBlock, Function, IntoFunction, Number, Object, Value},
1415
},
1516
heap::indexes::ArrayBufferIndex,
16-
Heap,
1717
};
1818

1919
// TODO: Implement the contents of the `DetachKey` struct?

0 commit comments

Comments
 (0)