Closed Bug 1668744 Opened 4 years ago Closed 4 years ago

error: `extern` fn uses type `for<'r> fn(&'r ThinVec<nsCString>) -> bool`, which is not FFI-safe

Categories

(Core :: Networking: DNS, defect, P2)

defect

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox81 --- unaffected
firefox82 --- unaffected
firefox83 --- fixed

People

(Reporter: sg, Assigned: emilio)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [necko-triaged])

Attachments

(3 files)

Since updating mozilla-central today, I get the following error when building:

 1:09.62    Compiling netwerk_helper v0.0.1 (/home/simon/work/refactor/netwerk/base/rust-helper)
 1:09.90 error: `extern` fn uses type `for<'r> fn(&'r ThinVec<nsCString>) -> bool`, which is not FFI-safe
 1:09.90    --> netwerk/base/rust-helper/src/lib.rs:323:76
 1:09.90     |
 1:09.90 323 | pub extern "C" fn rust_parse_etc_hosts<'a>(path: &'a nsACString, callback: ParsingCallback) {
 1:09.90     |                                                                            ^^^^^^^^^^^^^^^ not FFI-safe
 1:09.90     |
 1:09.91     = note: `-D improper-ctypes-definitions` implied by `-D warnings`
 1:09.91     = help: consider using an `extern fn(...) -> ...` function pointer instead
 1:09.91     = note: this function pointer has Rust-specific calling convention
 1:09.91 error: aborting due to previous error
 1:09.92 error: could not compile `netwerk_helper`

I did rustup update but it didn't fix this.

FWIW, I am using rust Nightly.

Regressed by: 1616252
Has Regression Range: --- → yes
Component: General → Networking: DNS
Product: Firefox Build System → Core

Valentin, is it possible to make this work with Rust nightly as well?

Flags: needinfo?(valentin.gosu)
Assignee: nobody → emilio

Using extern fn is needed to avoid a warning, but also this avoids copying the
filename when it's already valid utf-8, and makes some other minor cosmetic
tweaks, like removing useless move in lambdas and so on.

All these functions use snake case so they're not needed.

Depends on D92182

No need to cast a byte as a char to test it against ascii characters.

Depends on D92183

Emilio is blazing fast 🙂
Thanks a lot for fixing this so quickly. My compiler was just warming up.

Flags: needinfo?(valentin.gosu)
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1d7ff6f2d3ae Cleanup a bit and use explicit extern function pointer in rust etc/hosts parser. r=valentin,necko-reviewers https://hg.mozilla.org/integration/autoland/rev/fb2e42f334c6 Remove useless #[allow()] attributes. r=valentin,necko-reviewers https://hg.mozilla.org/integration/autoland/rev/37cd0824dd4b Make fast_is_hex_digit better. r=valentin,necko-reviewers

Set release status flags based on info from the regressing bug 1616252

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: