Closed Bug 1520683 Opened 1 year ago Closed 1 year ago

Syntax errors in rust source files can invalidate the entire gecko build.


(Firefox Build System :: General, defect)

Not set


(firefox66 fixed)

Tracking Status
firefox66 --- fixed


(Reporter: gw, Assigned: emilio)




(1 file)

If you make a mistake in a source file that breaks the cbindgen parser, the entire source tree gets invalidated and forces a full gecko rebuild.


  • Edit, add a syntax error that breaks cbindgen.

The output will look something like:

 0:00.68 gfx/webrender_bindings/webrender_ffi_generated.h.stub
 0:01.13 Traceback (most recent call last):
 0:01.13   File "/usr/lib/python2.7/", line 174, in _run_module_as_main
 0:01.13     "__main__", fname, loader, pkg_name)
 0:01.13   File "/usr/lib/python2.7/", line 72, in _run_code
 0:01.13     exec code in run_globals
 0:01.14   File "/home/code/work/mozilla-central/python/mozbuild/mozbuild/action/", line 110, in <module>
 0:01.14     sys.exit(main(sys.argv[1:]))
 0:01.14   File "/home/code/work/mozilla-central/python/mozbuild/mozbuild/action/", line 70, in main
 0:01.14     ret = module.__dict__[method](output, *args.additional_arguments, **kwargs)
 0:01.14   File "/home/code/work/mozilla-central/layout/style/", line 28, in generate
 0:01.14     raise TypeError("cbindgen failed: %s" % stderr)
 0:01.14 TypeError: cbindgen failed: ERROR: Parsing crate `webrender`:`/home/code/work/mozilla-central/gfx/wr/webrender/src/`:
 0:01.14 Error { start_span: Span, end_span: Span, message: "expected `=>`" }
 0:01.14 Try running `rustc -Z parse-only /home/code/work/mozilla-central/gfx/wr/webrender/src/` to see a nicer error message
 0:01.14 ERROR: Couldn't generate bindings for /home/code/work/mozilla-central/toolkit/library/rust.

Once that has happened, gecko now does a complete rebuild once the syntax error is fixed.

Related - it's also difficult to find where in the source the error is, since you don't get any normal rustc error outputs.

Any ideas on what's happening here Emilio?

Flags: needinfo?(emilio)

The issue is that when the generation of the file fails we overwrite it with the empty contents.

Assignee: nobody → emilio
Component: Graphics: WebRender → General
Flags: needinfo?(emilio)
Product: Core → Firefox Build System
That way we avoid massive rebuilds due to errors that are recoverable and that
would make the file generation succeed with the same contents as before.
See Also: → 1520815
Pushed by
When the file generation fails, don't write to the underlying file. r=mshal,froydnj
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.