chore: update to Rust 1.70.0 (#1277)

This commit is contained in:
Bartek Iwańczuk 2023-07-11 20:50:03 +02:00 committed by GitHub
parent 4110d1bf4e
commit 4dd8b60bf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 46 additions and 50 deletions

View File

@ -320,9 +320,9 @@ where
}
/// Utility function that extracts the http request object from a wrapper object.
fn unwrap_request<'a>(
fn unwrap_request(
scope: &mut v8::HandleScope,
request: v8::Local<'a, v8::Object>,
request: v8::Local<v8::Object>,
) -> *mut Box<dyn HttpRequest> {
let external = request.get_internal_field(scope, 0).unwrap();
let external = unsafe { v8::Local::<v8::External>::cast(external) };

View File

@ -1,3 +1,3 @@
[toolchain]
channel = "1.66.0"
channel = "1.70.0"
components = ["rustfmt", "clippy"]

View File

@ -567,9 +567,9 @@ impl Object {
// Note: This function converts the key to a name, which possibly calls back
// into JavaScript.
#[inline(always)]
pub fn has<'s>(
pub fn has(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
key: Local<Value>,
) -> Option<bool> {
unsafe { v8__Object__Has(self, &*scope.get_current_context(), &*key) }
@ -577,20 +577,16 @@ impl Object {
}
#[inline(always)]
pub fn has_index<'s>(
&self,
scope: &mut HandleScope<'s>,
index: u32,
) -> Option<bool> {
pub fn has_index(&self, scope: &mut HandleScope, index: u32) -> Option<bool> {
unsafe { v8__Object__HasIndex(self, &*scope.get_current_context(), index) }
.into()
}
/// HasOwnProperty() is like JavaScript's Object.prototype.hasOwnProperty().
#[inline(always)]
pub fn has_own_property<'s>(
pub fn has_own_property(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
key: Local<Name>,
) -> Option<bool> {
unsafe {
@ -600,18 +596,18 @@ impl Object {
}
#[inline(always)]
pub fn delete<'s>(
pub fn delete(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
key: Local<Value>,
) -> Option<bool> {
unsafe { v8__Object__Delete(self, &*scope.get_current_context(), &*key) }
.into()
}
pub fn delete_index<'s>(
pub fn delete_index(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
index: u32,
) -> Option<bool> {
unsafe {
@ -724,9 +720,9 @@ impl Object {
/// Note: Private properties are not inherited. Do not rely on this, since it
/// may change.
#[inline(always)]
pub fn set_private<'s>(
pub fn set_private(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
key: Local<Private>,
value: Local<Value>,
) -> Option<bool> {
@ -746,9 +742,9 @@ impl Object {
/// Note: Private properties are not inherited. Do not rely on this, since it
/// may change.
#[inline(always)]
pub fn delete_private<'s>(
pub fn delete_private(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
key: Local<Private>,
) -> Option<bool> {
unsafe {
@ -762,9 +758,9 @@ impl Object {
/// Note: Private properties are not inherited. Do not rely on this, since it
/// may change.
#[inline(always)]
pub fn has_private<'s>(
pub fn has_private(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
key: Local<Private>,
) -> Option<bool> {
unsafe {

View File

@ -48,9 +48,9 @@ impl PrimitiveArray {
}
#[inline(always)]
pub fn set<'s>(
pub fn set(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
index: usize,
item: Local<'_, Primitive>,
) {

View File

@ -91,18 +91,13 @@ extern "C" {
}
#[repr(C)]
#[derive(Debug)]
#[derive(Debug, Default)]
pub enum NewStringType {
#[default]
Normal,
Internalized,
}
impl Default for NewStringType {
fn default() -> Self {
NewStringType::Normal
}
}
bitflags! {
#[derive(Default)]
#[repr(transparent)]

View File

@ -568,9 +568,9 @@ impl Value {
/// Convenience function not present in the original V8 API.
#[inline(always)]
pub fn to_rust_string_lossy<'s>(
pub fn to_rust_string_lossy(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
) -> std::string::String {
self
.to_string(scope)
@ -646,9 +646,9 @@ impl Value {
}
#[inline(always)]
pub fn instance_of<'s>(
pub fn instance_of(
&self,
scope: &mut HandleScope<'s>,
scope: &mut HandleScope,
object: Local<Object>,
) -> Option<bool> {
let mut out = Maybe::<bool>::default();
@ -664,7 +664,7 @@ impl Value {
}
#[inline(always)]
pub fn number_value<'s>(&self, scope: &mut HandleScope<'s>) -> Option<f64> {
pub fn number_value(&self, scope: &mut HandleScope) -> Option<f64> {
let mut out = Maybe::<f64>::default();
unsafe {
v8__Value__NumberValue(self, &*scope.get_current_context(), &mut out)
@ -673,7 +673,7 @@ impl Value {
}
#[inline(always)]
pub fn integer_value<'s>(&self, scope: &mut HandleScope<'s>) -> Option<i64> {
pub fn integer_value(&self, scope: &mut HandleScope) -> Option<i64> {
let mut out = Maybe::<i64>::default();
unsafe {
v8__Value__IntegerValue(self, &*scope.get_current_context(), &mut out)
@ -682,7 +682,7 @@ impl Value {
}
#[inline(always)]
pub fn uint32_value<'s>(&self, scope: &mut HandleScope<'s>) -> Option<u32> {
pub fn uint32_value(&self, scope: &mut HandleScope) -> Option<u32> {
let mut out = Maybe::<u32>::default();
unsafe {
v8__Value__Uint32Value(self, &*scope.get_current_context(), &mut out)
@ -691,7 +691,7 @@ impl Value {
}
#[inline(always)]
pub fn int32_value<'s>(&self, scope: &mut HandleScope<'s>) -> Option<i32> {
pub fn int32_value(&self, scope: &mut HandleScope) -> Option<i32> {
let mut out = Maybe::<i32>::default();
unsafe {
v8__Value__Int32Value(self, &*scope.get_current_context(), &mut out)
@ -700,7 +700,7 @@ impl Value {
}
#[inline(always)]
pub fn boolean_value<'s>(&self, scope: &mut HandleScope<'s, ()>) -> bool {
pub fn boolean_value(&self, scope: &mut HandleScope<'_, ()>) -> bool {
unsafe { v8__Value__BooleanValue(self, scope.get_isolate_ptr()) }
}

View File

@ -1,9 +1,10 @@
error[E0597]: `scope2` does not live long enough
--> $DIR/boxed_local.rs:9:43
--> tests/compile_fail/boxed_local.rs:9:43
|
7 | let _boxed_local = {
| ------------ borrow later stored here
8 | let mut scope2 = v8::HandleScope::new(&mut scope1);
| ---------- binding `scope2` declared here
9 | let mut scope3 = v8::HandleScope::new(&mut scope2);
| ^^^^^^^^^^^ borrowed value does not live long enough
10 | Box::new(v8::Integer::new(&mut scope3, 123))

View File

@ -1,9 +1,10 @@
error[E0597]: `scope2` does not live long enough
--> $DIR/handle_scope_escape_lifetime.rs:9:43
--> tests/compile_fail/handle_scope_escape_lifetime.rs:9:43
|
7 | let _local = {
| ------ borrow later stored here
8 | let mut scope2 = v8::HandleScope::new(&mut scope1);
| ---------- binding `scope2` declared here
9 | let mut scope3 = v8::HandleScope::new(&mut scope2);
| ^^^^^^^^^^^ borrowed value does not live long enough
...

View File

@ -1,9 +1,10 @@
error[E0597]: `scope2` does not live long enough
--> $DIR/handle_scope_lifetime_4.rs:9:35
--> tests/compile_fail/handle_scope_lifetime_4.rs:9:35
|
7 | let mut _scope3 = {
| ----------- borrow later stored here
8 | let mut scope2 = v8::HandleScope::new(&mut scope1);
| ---------- binding `scope2` declared here
9 | v8::EscapableHandleScope::new(&mut scope2)
| ^^^^^^^^^^^ borrowed value does not live long enough
10 | };

View File

@ -2,7 +2,7 @@ error[E0308]: mismatched types
--> tests/compile_fail/object_without_context_scope.rs:6:33
|
6 | let _object = v8::Object::new(&mut scope);
| --------------- ^^^^^^^^^^ expected struct `v8::Context`, found `()`
| --------------- ^^^^^^^^^^ expected `&mut HandleScope<'_>`, found `&mut HandleScope<'_, ()>`
| |
| arguments to this function are incorrect
|

View File

@ -1,9 +1,10 @@
error[E0597]: `scope3` does not live long enough
--> $DIR/try_catch_exception_lifetime.rs:11:43
--> tests/compile_fail/try_catch_exception_lifetime.rs:11:43
|
9 | let _exception = {
| ---------- borrow later stored here
10 | let mut scope3 = v8::HandleScope::new(&mut scope2);
| ---------- binding `scope3` declared here
11 | let mut scope4 = v8::HandleScope::new(&mut scope3);
| ^^^^^^^^^^^ borrowed value does not live long enough
...

View File

@ -1,9 +1,10 @@
error[E0597]: `scope3` does not live long enough
--> $DIR/try_catch_message_lifetime.rs:11:43
--> tests/compile_fail/try_catch_message_lifetime.rs:11:43
|
9 | let _message = {
| -------- borrow later stored here
10 | let mut scope3 = v8::HandleScope::new(&mut scope2);
| ---------- binding `scope3` declared here
11 | let mut scope4 = v8::HandleScope::new(&mut scope3);
| ^^^^^^^^^^^ borrowed value does not live long enough
...

View File

@ -679,8 +679,8 @@ fn get_isolate_from_handle() {
check_handle_helper(scope, expect_some, local2);
}
fn check_eval<'s>(
scope: &mut v8::HandleScope<'s>,
fn check_eval(
scope: &mut v8::HandleScope,
expect_some: Option<bool>,
code: &str,
) {
@ -4482,8 +4482,8 @@ fn mock_script_origin<'s>(
)
}
fn mock_source<'s>(
scope: &mut v8::HandleScope<'s>,
fn mock_source(
scope: &mut v8::HandleScope,
resource_name: &str,
source: &str,
) -> v8::script_compiler::Source {