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

Prevent rustc overwriting input files #46814

Merged
merged 3 commits into from
Dec 22, 2017
Merged

Prevent rustc overwriting input files #46814

merged 3 commits into from
Dec 22, 2017

Conversation

varkor
Copy link
Member

@varkor varkor commented Dec 18, 2017

If rustc is invoked on a file that would be overwritten by the
compilation, the compilation now fails, to avoid accidental loss. This
resolves #13019. Kudos to @estebank, whose patch I finished off.

If rustc is invoked on a file that would be overwritten by the
compilation, the compilation now fails, to avoid accidental loss. This
resolves rust-lang#13019.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@eddyb
Copy link
Member

eddyb commented Dec 18, 2017

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned eddyb Dec 18, 2017
@alexcrichton
Copy link
Member

Thanks for the PR! Would it be possible to perhaps avoid duplicating the invocation of build_output_filenames and reuse it being created elsewhere? Other than that though looks great!

@varkor
Copy link
Member Author

varkor commented Dec 18, 2017

Which invocation of build_output_filenames would be most appropriate to reuse? The one in driver.rs seems to be the only one that is guaranteed to be called — but then the input filename would probably need to be passed to compile_input as well. Is it preferable to add an extra parameter here to avoid the extra invocation?

@eddyb
Copy link
Member

eddyb commented Dec 18, 2017

@varkor Yes, feel free to change rustc_driver APIs.

@varkor
Copy link
Member Author

varkor commented Dec 19, 2017

Done, thanks!

@alexcrichton
Copy link
Member

Thanks! Looks like there's a test that's failing though?

@varkor
Copy link
Member Author

varkor commented Dec 19, 2017

Ah, let an invocation slip through the net. Fixed.

@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Contributor

bors commented Dec 19, 2017

📌 Commit 3a29f28 has been approved by alexcrichton

@kennytm kennytm added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Dec 19, 2017
@frewsxcv
Copy link
Member

@bors rollup

kennytm added a commit to kennytm/rust that referenced this pull request Dec 21, 2017
Prevent rustc overwriting input files

If rustc is invoked on a file that would be overwritten by the
compilation, the compilation now fails, to avoid accidental loss. This
resolves rust-lang#13019. Kudos to @estebank, whose patch I finished off.
bors added a commit that referenced this pull request Dec 21, 2017
Rollup of 14 pull requests

- Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918
- Failed merges:
@bors bors merged commit 3a29f28 into rust-lang:master Dec 22, 2017
@varkor varkor deleted the contrib-7 branch December 22, 2017 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustc overwrites input file when it has no extension
7 participants