Closed as not planned
Description
In an empty directory, run:
cargo new --lib a
cargo new --lib b
cargo new --lib a/c
echo 'b = {path = "../b"}' >> a/Cargo.toml
echo 'c = {path = "./c"}' >> a/Cargo.toml
cat > a/src/lib.rs <<END
pub fn foo() {}
pub mod bar {
use foo;
pub fn baz() { foo() }
}
END
cp a/src/lib.rs b/src/lib.rs
cp a/src/lib.rs a/c/src/lib.rs
(cd a && cargo +nightly fix --edition -j1)
find -name lib.rs | xargs grep use
rm -r a b
This creates three crates with identical code, with one depending on the other two through path
Cargo dependencies. cargo fix
is able to silently fix the "root" crate, for the other two it only prints warnings.
Output with nightly-2018-11-01
which contains cargo 1.31.0-nightly (2d0863f65 2018-10-20)
which depends on rustfix = "0.4.2"
:
Created library `a` project
Created library `b` project
Created library `a/c` project
Checking b v0.1.0 (/tmp/foo/b)
warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> /tmp/foo/b/src/lib.rs:4:9
|
4 | use foo;
| ^^^ help: use `crate`: `crate::foo`
|
= note: `-W absolute-paths-not-starting-with-crate` implied by `-W rust-2018-compatibility`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
Checking c v0.1.0 (/tmp/foo/a/c)
warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
--> c/src/lib.rs:4:9
|
4 | use foo;
| ^^^ help: use `crate`: `crate::foo`
|
= note: `-W absolute-paths-not-starting-with-crate` implied by `-W rust-2018-compatibility`
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
= note: for more information, see issue #53130 <https://github.com/rust-lang/rust/issues/53130>
Checking a v0.1.0 (/tmp/foo/a)
Fixing src/lib.rs (1 fix)
Finished dev [unoptimized + debuginfo] target(s) in 0.44s
./b/src/lib.rs: use foo;
./a/c/src/lib.rs: use foo;
./a/src/lib.rs: use crate::foo;