-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
cargo fix issue (absolute path) #6415
Comments
Thanks for the report @D4nte! Is there code we could poke around and test out? If not, can you try also running with the |
Hi @alexcrichton. We will opensource very soon so you can poke around and test. Yes I have ran with I will update once our code is open sourced, should be before EOY. |
Ok, thanks! |
Hi, the code can be found at https://github/comit-network/comit-rs. Feel free to try out from commit |
@alexcrichton This looks like a problem with the locking implementation. A fix is being applied twice causing corrupted output. The issue is that the fixes appear for the same file for two different integration tests (which are sharing a "common.rs"). Offhand I don't have any good suggestions. Maybe only do one target at a time? |
Here is a test to demonstrate. #[test]
fn fix_with_common() {
let p = project()
.file("src/lib.rs", "")
.file("tests/t1.rs", "mod common; #[test] fn t1() { common::try(); }")
.file("tests/t2.rs", "mod common; #[test] fn t2() { common::try(); }")
.file("tests/common/mod.rs", "pub fn try() {}")
.build();
p.cargo("fix --edition --allow-no-vcs").run();
assert_eq!(p.read_file("tests/common/mod.rs"), "pub fn r#try() {}");
} |
Man @ehuss you're too good at investigating these now! Makes sense to me, and agreed that our only recourse is probably to serialize everything within the crate. I think that'd be a relatively small change to the lock server implementation though. |
OK, I'll take a look. |
cargo fix: fix targets with shared sources. If `cargo fix` attempts to fix multiple targets concurrently that have shared source files, it would apply fixes multiple times causing corruption of the source code. Fix this by locking on the package path instead of the target filename, essentially serializing all targets within a package. Fixes #6415.
Problem
vendor/bam/tests/common/buy.rs
before cargo fix:vendor/bam/tests/common/buy.rs
after cargo fix:Steps
See command above
Possible Solution(s)
Once
cargo fix --edition
is done, I am not getting warnings when doingcargo check
orcargo build
with Rust 2018 so no work around needed.Notes
Output of
cargo version
:Let me know if you need anything else.
The text was updated successfully, but these errors were encountered: