-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
dep-info rmeta path is wrong #68839
Comments
Can you please elaborate on why this does not affect cargo and how cargo set the output file name? It seems the crate type is parsed from rust/src/librustc_session/config.rs Lines 1844 to 1865 in 1581278
It is a vector. I am not sure how to determine whether I need to add the prefix |
I'm not sure I understand the relevance of the note about parsing crate types. This is where Cargo parses the dep-info file. It only looks at the first line, and ignores the value before the You can look at #49289 to start to investigate why binaries emit a filename with the |
According to the documentation for --emit, the default filename for an rmeta file should be CRATE_NAME.rmeta. That would suggest that the actual problem is the file name itself, which I believe is set here. Changing that would likely be breaking for anyone who doesn't use Cargo, though. A workaround for this problem is to specify the output path for the metadata file. e.g. --emit=metadata=path/to/libfoo.rmeta. The dep-info is generated correctly when that is done. |
Oh, looks like the |
Fix docs for default rmeta filename. The docs for the default filename for `--emit=metadata` was wrong, it was missing the `lib` prefix. The current implementation for that default is [here](https://github.com/rust-lang/rust/blob/f2661cfe341f88bea919daf52a07015dceaf7a6a/compiler/rustc_session/src/output.rs#L140). Perhaps somewhat confusing, but `lib` is used for all crate types. cc rust-lang#68839 (comment)
PR with fix: #114750 |
The path to the rmeta file in the dep-info file is wrong. It is missing the
lib
prefix.rustc --emit=dep-info,metadata --crate-type lib foo.rs
foo.d
will containfoo.rmeta: foo.rs
, but I think it should belibfoo.rmeta: foo.rs
because the filename islibfoo.rmeta
.The crate type doesn't matter. A "bin" type will also emit
foo.rmeta
, but bin types (confusingly) also uselibfoo.rmeta
.(This doesn't really affect Cargo, as it ignores these filenames.)
The text was updated successfully, but these errors were encountered: