Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small Rust fixes #2053

Merged
merged 1 commit into from
Jul 22, 2017
Merged

Small Rust fixes #2053

merged 1 commit into from
Jul 22, 2017

Conversation

acfoltzer
Copy link
Contributor

A couple small fixes to improve quality of life for Rustaceans:

First, pass the target name to rustc as a crate-name argument, rather than relying on pragmas within the Rust source files. This reduces the extent to which existing Rust sources must be modified in order to work under Meson.

Second, use the default Ninja behavior for rustc-generated depfiles. This prevents unnecessary rebuilding; see c93ef9b.

This is required for downstream Rust dependencies to properly import
libraries using `extern crate`.
@codecov-io
Copy link

codecov-io commented Jul 12, 2017

Codecov Report

Merging #2053 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2053      +/-   ##
==========================================
+ Coverage   64.01%   64.01%   +<.01%     
==========================================
  Files          72       72              
  Lines       17222    17223       +1     
  Branches     3550     3550              
==========================================
+ Hits        11025    11026       +1     
  Misses       5106     5106              
  Partials     1091     1091
Impacted Files Coverage Δ
mesonbuild/backend/ninjabackend.py 88.24% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bff37a9...1e4cddc. Read the comment docs.

@jpakkane
Copy link
Member

The deps = gcc rules delete the depfile after it has been read into Ninja's database. This conflicts with the fact that rustc puts a target for the depfile itself within the depfile, and so the deleted depfile triggers a rebuild of the whole target.

This seems like a bug in rustc because it is different behaviour from every other compiler. Maybe this could be reported upstream and fixed properly there? Possibly we could report this to Ninja as it is the one deleting the depfile.

@acfoltzer
Copy link
Contributor Author

I took that commit out of the branch so that the crate-name can be merged before we figure out how to address the depfile. I can chat with the Rust folks, but are you aware of why Ninja deletes the file in this case?

@jpakkane
Copy link
Member

It's a performance optimisation. In Windows creating thousands of small files is very slow so Ninja deletes them immediately so they never touch the disk.

@acfoltzer
Copy link
Contributor Author

Gotcha. I'll see if I can get the Rust folks to change this behavior, or at least add an option to remove the depfile target from the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants