Skip to content

cargo fix: "Cannot replace slice of data that was already replaced" #5785

Closed
@ExpHP

Description

@ExpHP

Source code

Instructions in README.md.


cargo fix output
$ touch src/lib.rs && cargo +nightly fix --prepare-for 2018 --all-targets --all-features --allow-dirty
    Updating registry `https://github.com/rust-lang/crates.io-index`
    Updating git repository `https://github.com/rust-lang-nursery/failure`                                                                  
    Updating git repository `https://github.com/withoutboats/display_derive`                                                                
    Checking rsp2-assert-close v0.1.0 (file:///home/lampam/asd/rsp2-test-case/rsp2-assert-close)                                            
    Checking rsp2-minimize v0.1.0 (file:///home/lampam/asd/rsp2-test-case/rsp2-minimize)
warning: error applying suggestions to `src/acgsd.rs`

The full error message was:

> Cannot replace slice of data that was already replacedThis likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see 
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/cargo/issues
quoting the full output of this command we'd be very appreciative!

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
   --> src/acgsd.rs:339:17
    |
339 |             use ::stop_condition::Cereal::{Simple,Logical};
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::stop_condition::Cereal::{Simple,Logical}`
    |
    = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
   --> src/acgsd.rs:340:17
    |
340 |             use ::stop_condition::LogicalExpression::All;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::stop_condition::LogicalExpression::All`
    |
    = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
   --> src/acgsd.rs:968:9
    |
968 |     use ::util::Never;
    |         ^^^^^^^^^^^^^ help: use `crate`: `crate::util::Never`
    |
    = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1008:13
     |
1008 |         use ::util::random::uniform_n;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::util::random::uniform_n`
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:978:17
     |
978  |             use ::test::one_dee::prelude::*;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::prelude::*`
...
1013 |         let result = super::acgsd(&settings, &initial_point, quadratic_test_fn!(&target)).unwrap();
     |                                                              --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:979:17
     |
979  |             use ::test::one_dee::Polynomial;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::Polynomial`
...
1013 |         let result = super::acgsd(&settings, &initial_point, quadratic_test_fn!(&target)).unwrap();
     |                                                              --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1021:13
     |
1021 |         use ::util::random::uniform_n;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::util::random::uniform_n`
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:978:17
     |
978  |             use ::test::one_dee::prelude::*;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::prelude::*`
...
1028 |         assert_eq!(super::acgsd(&s, &point, quadratic_test_fn!(&target)).unwrap().iterations, 0);
     |                                             --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:979:17
     |
979  |             use ::test::one_dee::Polynomial;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::Polynomial`
...
1028 |         assert_eq!(super::acgsd(&s, &point, quadratic_test_fn!(&target)).unwrap().iterations, 0);
     |                                             --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:978:17
     |
978  |             use ::test::one_dee::prelude::*;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::prelude::*`
...
1031 |         assert_eq!(super::acgsd(&s, &point, quadratic_test_fn!(&target)).unwrap().iterations, 0);
     |                                             --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:979:17
     |
979  |             use ::test::one_dee::Polynomial;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::Polynomial`
...
1031 |         assert_eq!(super::acgsd(&s, &point, quadratic_test_fn!(&target)).unwrap().iterations, 0);
     |                                             --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:978:17
     |
978  |             use ::test::one_dee::prelude::*;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::prelude::*`
...
1042 |         assert_eq!(super::acgsd(&s, &point, quadratic_test_fn!(&target)).unwrap().iterations, 2);
     |                                             --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:979:17
     |
979  |             use ::test::one_dee::Polynomial;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::Polynomial`
...
1042 |         assert_eq!(super::acgsd(&s, &point, quadratic_test_fn!(&target)).unwrap().iterations, 2);
     |                                             --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1053:13
     |
1053 |         use ::util::random::uniform_n;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::util::random::uniform_n`
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:978:17
     |
978  |             use ::test::one_dee::prelude::*;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::prelude::*`
...
1061 |         let potential = scale_y!(1e-40, quadratic_test_fn!(&target));
     |                                         --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:979:17
     |
979  |             use ::test::one_dee::Polynomial;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::Polynomial`
...
1061 |         let potential = scale_y!(1e-40, quadratic_test_fn!(&target));
     |                                         --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:978:17
     |
978  |             use ::test::one_dee::prelude::*;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::prelude::*`
...
1069 |         let potential = scale_y!(1e+40, quadratic_test_fn!(&target));
     |                                         --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:979:17
     |
979  |             use ::test::one_dee::Polynomial;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::Polynomial`
...
1069 |         let potential = scale_y!(1e+40, quadratic_test_fn!(&target));
     |                                         --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1081:21
     |
1081 |         let point = ::util::random::uniform_n(18, -10.0, 10.0);
     |                     ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::util::random::uniform_n`
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1095:13
     |
1095 |         use ::util::random::uniform_n;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::util::random::uniform_n`
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:978:17
     |
978  |             use ::test::one_dee::prelude::*;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::prelude::*`
...
1101 |         let result = super::acgsd(&settings, &start, quadratic_test_fn!(&target)).unwrap();
     |                                                      --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:979:17
     |
979  |             use ::test::one_dee::Polynomial;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::Polynomial`
...
1101 |         let result = super::acgsd(&settings, &start, quadratic_test_fn!(&target)).unwrap();
     |                                                      --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:978:17
     |
978  |             use ::test::one_dee::prelude::*;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::prelude::*`
...
1107 |         let result = super::acgsd(&settings, &start, quadratic_test_fn!(&target)).unwrap();
     |                                                      --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:979:17
     |
979  |             use ::test::one_dee::Polynomial;
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::one_dee::Polynomial`
...
1107 |         let result = super::acgsd(&settings, &start, quadratic_test_fn!(&target)).unwrap();
     |                                                      --------------------------- in this macro invocation
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1114:13
     |
1114 |         use ::test::n_dee::{Trid, OnceDifferentiable};
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::n_dee::{Trid, OnceDifferentiable}`
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1115:13
     |
1115 |         use ::util::random::uniform_n;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::util::random::uniform_n`
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1133:13
     |
1133 |         use ::test::n_dee::{HyperLennardJones, OnceDifferentiable, Sum};
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::test::n_dee::{HyperLennardJones, OnceDifferentiable, Sum}`
     |
     = 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 TBD

warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
    --> src/acgsd.rs:1134:13
     |
1134 |         use ::util::random as urand;
     |             ^^^^^^^^^^^^^^^^^^^^^^^ help: use `crate`: `crate::util::random as urand`
     |
     = 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 TBD

    Finished dev [unoptimized + debuginfo] target(s) in 18.75s

Also, if you are interested, the first commit e718f5bc1 contains an example of the second issue mentioned in this post. I haven't created an issue for that one because it didn't seem like there was anything actionable from cargo's end.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions