From 7107d4869ef7c7d119a7bf4f08043ce93bfd55fa Mon Sep 17 00:00:00 2001 From: snek Date: Fri, 12 Jul 2024 09:30:31 -0700 Subject: [PATCH] rust 1.79.0 (#1527) --- .gitignore | 2 ++ rust-toolchain.toml | 2 +- src/object.rs | 10 ++++---- .../handle_scope_escape_to_nowhere.stderr | 24 +++++++++---------- tests/test_api.rs | 2 +- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 6ac67803..3eed1aa7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ **/*.rs.bk **/*.orig +.envrc + /.vscode/ /.idea/ /target/ diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 33641b78..3df8c16a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.77.2" +channel = "1.79.0" components = ["rustfmt", "clippy"] targets = [ "x86_64-apple-darwin", diff --git a/src/object.rs b/src/object.rs index cbcff3a1..b0d6fe07 100644 --- a/src/object.rs +++ b/src/object.rs @@ -710,8 +710,9 @@ impl Object { wrapper: Local, value: &impl GetRustObj, ) { - // TODO: use a const assert once const expressions are stable - assert!(TAG < LAST_TAG); + const { + assert!(TAG < LAST_TAG); + } let ptr = value.get_rust_obj(); unsafe { v8__Object__Wrap(isolate as *mut _, &*wrapper, ptr, TAG) } } @@ -727,8 +728,9 @@ impl Object { isolate: &mut Isolate, wrapper: Local, ) -> Option> { - // TODO: use a const assert once const expressions are stable - assert!(TAG < LAST_TAG); + const { + assert!(TAG < LAST_TAG); + } let ptr = unsafe { v8__Object__Unwrap(isolate as *mut _, &*wrapper, TAG) }; Ptr::new(&ptr) } diff --git a/tests/compile_fail/handle_scope_escape_to_nowhere.stderr b/tests/compile_fail/handle_scope_escape_to_nowhere.stderr index 9c5d0c12..e72c13a3 100644 --- a/tests/compile_fail/handle_scope_escape_to_nowhere.stderr +++ b/tests/compile_fail/handle_scope_escape_to_nowhere.stderr @@ -7,13 +7,13 @@ error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandl | required by a bound introduced by this call | = help: the following other types implement trait `v8::scope::param::NewEscapableHandleScope<'s, 'e>`: - as v8::scope::param::NewEscapableHandleScope<'s, 'e>> - as v8::scope::param::NewEscapableHandleScope<'s, 'p>> - as v8::scope::param::NewEscapableHandleScope<'s, 'p>> - as v8::scope::param::NewEscapableHandleScope<'s, 'e>> - as v8::scope::param::NewEscapableHandleScope<'s, 'p>> - as v8::scope::param::NewEscapableHandleScope<'s, 'e>> as v8::scope::param::NewEscapableHandleScope<'s, 'e>> + as v8::scope::param::NewEscapableHandleScope<'s, 'p>> + as v8::scope::param::NewEscapableHandleScope<'s, 'e>> + as v8::scope::param::NewEscapableHandleScope<'s, 'e>> + as v8::scope::param::NewEscapableHandleScope<'s, 'p>> + as v8::scope::param::NewEscapableHandleScope<'s, 'p>> + as v8::scope::param::NewEscapableHandleScope<'s, 'e>> note: required by a bound in `EscapableHandleScope::<'s, 'e>::new` --> src/scope.rs | @@ -27,10 +27,10 @@ error[E0277]: the trait bound `OwnedIsolate: v8::scope::param::NewEscapableHandl | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `v8::scope::param::NewEscapableHandleScope<'_, '_>` is not implemented for `OwnedIsolate` | = help: the following other types implement trait `v8::scope::param::NewEscapableHandleScope<'s, 'e>`: - as v8::scope::param::NewEscapableHandleScope<'s, 'e>> - as v8::scope::param::NewEscapableHandleScope<'s, 'p>> - as v8::scope::param::NewEscapableHandleScope<'s, 'p>> - as v8::scope::param::NewEscapableHandleScope<'s, 'e>> - as v8::scope::param::NewEscapableHandleScope<'s, 'p>> - as v8::scope::param::NewEscapableHandleScope<'s, 'e>> as v8::scope::param::NewEscapableHandleScope<'s, 'e>> + as v8::scope::param::NewEscapableHandleScope<'s, 'p>> + as v8::scope::param::NewEscapableHandleScope<'s, 'e>> + as v8::scope::param::NewEscapableHandleScope<'s, 'e>> + as v8::scope::param::NewEscapableHandleScope<'s, 'p>> + as v8::scope::param::NewEscapableHandleScope<'s, 'p>> + as v8::scope::param::NewEscapableHandleScope<'s, 'e>> diff --git a/tests/test_api.rs b/tests/test_api.rs index 837cee1f..54ab6155 100644 --- a/tests/test_api.rs +++ b/tests/test_api.rs @@ -251,7 +251,7 @@ fn test_string() { assert_eq!(2, local.utf8_length(scope)); // Should round-trip to UTF-8 assert_eq!(2, local.to_rust_string_lossy(scope).len()); - let mut buf = [MaybeUninit::uninit(); 0]; + let mut buf: [MaybeUninit; 0] = []; assert_eq!(2, local.to_rust_cow_lossy(scope, &mut buf).len()); let mut buf = [MaybeUninit::uninit(); 10]; assert_eq!(2, local.to_rust_cow_lossy(scope, &mut buf).len());