Skip to content

--emit dep-info is a little difficult to use #28716

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

Closed
alexcrichton opened this issue Sep 28, 2015 · 3 comments
Closed

--emit dep-info is a little difficult to use #28716

alexcrichton opened this issue Sep 28, 2015 · 3 comments

Comments

@alexcrichton
Copy link
Member

The compiler's dep-info output doesn't work quite as one might expect when
coming from the land of gcc/clang, for example:

  1. If only a dep-info file is generated, the output filename is pretty
    unlikely to what's going to be compiled later on:

    $ rustc foo.rs --emit dep-info
    $ ls
    foo.d  foo.rs
    
  2. If a dep-info and link file are generated, you can't customize the output
    filename of the dep-info file:

    $ rustc foo.rs --emit dep-info,link -o foo.pp
    warning: ignoring specified output filename because multiple outputs were requested
    $ ls
    foo.d       foo.rs      libfoo.rlib
    

The compiler probably wants the ability to specify a dedicated location for the dep-info file during the same compilation of a staticlib or executable. For example, something like:

    --dep-file FILE     Configure output location of the dep-info output

This would allow customizing the output location as well as enabling dep-info to know what the actual output artifact is (e.g. of the link output type).

Some more info can be found on this bug.

@apasel422
Copy link
Contributor

Session's write_dependency_info field actually has an Option<PathBuf> that represents a specified output filename, but it doesn't appear to be set anywhere.

@apasel422
Copy link
Contributor

The comments in librustc_driver/driver.rs refer to some obsolete flags:

// Write out dependency rules to the dep-info file if requested with
// --dep-info
let deps_filename = match sess.opts.write_dependency_info {
    // Use filename from --dep-file argument if given

@alexcrichton
Copy link
Member Author

Yeah these flags have gone through some various iterations over time, and it's probably high time to refactor all this support in the compiler!

bors added a commit that referenced this issue Oct 2, 2015
This PR closes out #28716 and #28735 by making two changes to the compiler:

1. The `--emit` flag to the compiler now supports the ability to specify the output file name of a partuclar emit type. For example `--emit dep-info=bar.d,asm=foo.s,link` is now accepted.
2. The dep-info emission now emits a dummy target for all input file names to protect against deleted files.
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

No branches or pull requests

2 participants