Bug 1512271 - Allow link.exe to keep linking the stylo tests after rust-lang/rust#54451. r=simonsapin

This commit is contained in:
Emilio Cobos Álvarez 2018-12-11 15:31:17 +01:00
Родитель f7066e0fb7
Коммит 8acdef75e7
2 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -85,6 +85,7 @@ fn main() {
for line in r.lines() {
let s = line
.unwrap()
.replace("#[no_mangle]", "")
.replace("pub extern \"C\" fn", "pub unsafe extern \"C\" fn");
w.write_all(s.as_bytes()).unwrap();
w.write_all(b"\n").unwrap();

Просмотреть файл

@ -16,11 +16,15 @@ mod error_reporter;
#[path = "../../../ports/geckolib/stylesheet_loader.rs"]
mod stylesheet_loader;
#[allow(non_snake_case, unused_unsafe, private_no_mangle_fns)]
#[allow(non_snake_case, unused_unsafe)]
mod glue {
// this module pretends to be glue.rs, with the safe functions swapped for unsafe ones. This is
// a hack to compensate for the fact that `fn` types cannot coerce to `unsafe fn` types. The
// imports are populated with the same things so the type assertion should be equivalent
// this module pretends to be glue.rs, with the safe functions swapped for
// unsafe ones. This is a hack to compensate for the fact that `fn` types
// cannot coerce to `unsafe fn` types. The imports are populated with the
// same things so the type assertion should be equivalent.
//
// We also rely on #[no_mangle] being stripped out so that it can link on
// Windows without linking to Gecko, see bug 1512271.
use geckoservo::*;
include!(concat!(env!("OUT_DIR"), "/glue.rs"));
}