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

Make --emit=metadata output metadata regardless of link #49289

Merged
merged 3 commits into from
Apr 14, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ pub(crate) fn link_binary(sess: &Session,
let mut out_filenames = Vec::new();
for &crate_type in sess.crate_types.borrow().iter() {
// Ignore executable crates if we have -Z no-trans, as they will error.
if (sess.opts.debugging_opts.no_trans ||
!sess.opts.output_types.should_trans()) &&
crate_type == config::CrateTypeExecutable {
if sess.opts.debugging_opts.no_trans && crate_type == config::CrateTypeExecutable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this is correct. This loop goes on to link the code units which have been generated, but if we are in !sess.opts.output_types.should_trans() mode, then there should be no code units to link. Also I think it is odd that emit=metadata and -Ztrans would have different behaviour, which is what is happening now.

However, it has been a long time since I wrote this, so I'm not really sure what should be done, sorry

Copy link
Member Author

@varkor varkor Mar 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you find it acceptable just to special-case !sess.opts.output_types.should_trans() && !sess.opts.output_types.contains_key(&OutputType::Metadata) as a quick fix for now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not sure, sorry. ping @rust-lang/compiler anybody know about this code?

continue;
}

Expand Down