Migrate to the 2024 edition (#35755)

* Migrate to 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Allow unsafe_op_in_unsafe_fn lint

This lint warns by default in the 2024
edition, but is *way* too noisy for servo.

We might enable it in the future, but not now.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Compile using the 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-03-13 11:28:11 +01:00 committed by GitHub
parent eb2ca42824
commit bb0d08432e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 317 additions and 293 deletions

View file

@ -131,3 +131,6 @@ sig = "1.0"
[target.'cfg(target_os = "windows")'.dependencies]
windows-sys = { workspace = true, features = ["Win32_Graphics_Gdi"] }
libservo = { path = "../../components/servo", features = ["no-wgl"] }
[lints.rust]
unsafe_op_in_unsafe_fn = { level = "allow" }

View file

@ -238,14 +238,14 @@ impl Dialog {
Dialog::Authentication {
username,
password,
ref mut request,
request,
} => {
let mut is_open = true;
Modal::new("authentication".into()).show(ctx, |ui| {
let mut frame = egui::Frame::default().inner_margin(10.0).begin(ui);
frame.content_ui.set_min_width(150.0);
if let Some(ref request) = request {
if let Some(request) = request {
let url =
egui::RichText::new(request.url().origin().unicode_serialization());
frame.content_ui.heading(url);

View file

@ -34,11 +34,11 @@ struct HostCallbacks {
jvm: JavaVM,
}
extern "C" {
unsafe extern "C" {
fn ANativeWindow_fromSurface(env: *mut jni::sys::JNIEnv, surface: jobject) -> *mut c_void;
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn android_main() {
// FIXME(mukilan): this android_main is only present to stop
// the java side 'System.loadLibrary('servoshell') call from
@ -57,7 +57,7 @@ where
});
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_version<'local>(
env: JNIEnv<'local>,
_class: JClass<'local>,
@ -67,7 +67,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_version<'local>(
.unwrap_or_else(|_str| JObject::null().into())
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_init<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -147,7 +147,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_init<'local>(
};
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_requestShutdown<'local>(
mut env: JNIEnv<'local>,
_class: JClass<'local>,
@ -156,7 +156,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_requestShutdown<'local>(
call(&mut env, |s| s.request_shutdown());
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_deinit<'local>(
_env: JNIEnv<'local>,
_class: JClass<'local>,
@ -165,7 +165,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_deinit<'local>(
simpleservo::deinit();
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_resize<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -179,7 +179,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_resize<'local>(
}
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_performUpdates<'local>(
mut env: JNIEnv<'local>,
_class: JClass<'local>,
@ -191,7 +191,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_performUpdates<'local>(
});
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_loadUri<'local>(
mut env: JNIEnv<'local>,
_class: JClass<'local>,
@ -209,7 +209,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_loadUri<'local>(
};
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_reload<'local>(
mut env: JNIEnv<'local>,
_class: JClass<'local>,
@ -218,7 +218,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_reload<'local>(
call(&mut env, |s| s.reload());
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_stop<'local>(
mut env: JNIEnv<'local>,
_class: JClass<'local>,
@ -227,7 +227,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_stop<'local>(
call(&mut env, |s| s.stop());
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_goBack<'local>(
mut env: JNIEnv<'local>,
_class: JClass<'local>,
@ -236,7 +236,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_goBack<'local>(
call(&mut env, |s| s.go_back());
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_goForward<'local>(
mut env: JNIEnv<'local>,
_class: JClass<'local>,
@ -245,7 +245,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_goForward<'local>(
call(&mut env, |s| s.go_forward());
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_scrollStart<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -258,7 +258,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_scrollStart<'local>(
call(&mut env, |s| s.scroll_start(dx as f32, dy as f32, x, y));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_scrollEnd<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -271,7 +271,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_scrollEnd<'local>(
call(&mut env, |s| s.scroll_end(dx as f32, dy as f32, x, y));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_scroll<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -284,7 +284,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_scroll<'local>(
call(&mut env, |s| s.scroll(dx as f32, dy as f32, x, y));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_touchDown<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -296,7 +296,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_touchDown<'local>(
call(&mut env, |s| s.touch_down(x, y, pointer_id));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_touchUp<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -308,7 +308,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_touchUp<'local>(
call(&mut env, |s| s.touch_up(x, y, pointer_id));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_touchMove<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -320,7 +320,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_touchMove<'local>(
call(&mut env, |s| s.touch_move(x, y, pointer_id));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_touchCancel<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -332,7 +332,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_touchCancel<'local>(
call(&mut env, |s| s.touch_cancel(x, y, pointer_id));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_pinchZoomStart<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -344,7 +344,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_pinchZoomStart<'local>(
call(&mut env, |s| s.pinchzoom_start(factor, x as u32, y as u32));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_pinchZoom<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -356,7 +356,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_pinchZoom<'local>(
call(&mut env, |s| s.pinchzoom(factor, x as u32, y as u32));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_pinchZoomEnd<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -368,7 +368,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_pinchZoomEnd<'local>(
call(&mut env, |s| s.pinchzoom_end(factor, x as u32, y as u32));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_click(
mut env: JNIEnv,
_: JClass,
@ -379,7 +379,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_click(
call(&mut env, |s| s.click(x, y));
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_pauseCompositor(
mut env: JNIEnv,
_: JClass<'_>,
@ -388,7 +388,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_pauseCompositor(
call(&mut env, |s| s.pause_compositor());
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_resumeCompositor<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -407,7 +407,7 @@ pub extern "C" fn Java_org_servo_servoview_JNIServo_resumeCompositor<'local>(
});
}
#[no_mangle]
#[unsafe(no_mangle)]
pub extern "C" fn Java_org_servo_servoview_JNIServo_mediaSessionAction<'local>(
mut env: JNIEnv<'local>,
_: JClass<'local>,
@ -689,7 +689,7 @@ impl HostTrait for HostCallbacks {
fn on_panic(&self, _reason: String, _backtrace: Option<String>) {}
}
extern "C" {
unsafe extern "C" {
pub fn __android_log_write(prio: c_int, tag: *const c_char, text: *const c_char) -> c_int;
}

View file

@ -213,7 +213,7 @@ unsafe extern "C" fn on_vsync_cb(
static SERVO_CHANNEL: OnceLock<Sender<ServoAction>> = OnceLock::new();
#[no_mangle]
#[unsafe(no_mangle)]
extern "C" fn on_surface_created_cb(xcomponent: *mut OH_NativeXComponent, window: *mut c_void) {
info!("on_surface_created_cb");

View file

@ -35,11 +35,11 @@ pub fn deinit(clean_shutdown: bool) {
}
}
#[link_section = "__TEXT,__info_plist"]
#[no_mangle]
#[unsafe(link_section = "__TEXT,__info_plist")]
#[unsafe(no_mangle)]
pub static INFO_PLIST: [u8; 619] = *include_bytes!("Info.plist");
#[link(name = "count_threads")]
extern "C" {
unsafe extern "C" {
fn macos_count_running_threads() -> i32;
}