Skip to content

Commit

Permalink
Bug 1512271 - Allow link.exe to keep linking the stylo tests after ru…
Browse files Browse the repository at this point in the history
…st-lang/rust#54451. r=simonsapin
  • Loading branch information
emilio committed Dec 11, 2018
1 parent d2fbaec commit 579b6f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions servo/ports/geckolib/tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 8 additions & 4 deletions servo/ports/geckolib/tests/servo_function_signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

0 comments on commit 579b6f8

Please sign in to comment.