On Wed, Nov 9, 2016, at 11:41 AM, Kartikaya Gupta wrote:
> I'm actually trying to debug a rust issue right now and have some
> questions. I've done the |mach vendor rust| step and got all the
> vendored crates. Now let's say that in one of the dependencies (the
> 'cmake' crate in my case) there's some sort of behaviour that I'd like
> to investigate/debug. If I edit the third_party/rust/cmake/src/lib.rs
> in-place, the build fails because of a hash mismatch. The error
> suggests forking the repo and using [replace] instead - so I tried do
> that by copying the cmake folder to third_party/rust/cmake-fork and
> putting a [replace] section in toolkit/library/rust/Cargo.toml to
> point to it. However if I do that the force-cargo-build step in the
> build fails saying the lock file needs updating but --locked was
> passed.
> 
> Am I on the right track here, or is there some other easier way to
> modify one of the vendored crates for local debugging?

You are on the right track here, you're just getting bitten by the fact
that we pass `--frozen` to `cargo build` (cargo's output is a bit
confusing there, `--frozen` implies `--locked`). This is just to assert
that we don't hit the network while building. We've talked about adding
something like `--enable-rust-developer-mode` to make these workflows
easier (until cargo supports a more flexible model[1]) but it hasn't
happened yet. For now you can either comment out the line in rules.mk[2]
that passes `--frozen`, or manually run `cargo generate-lockfile
--manifest-path=toolkit/library/rust/Cargo.toml` to update the lockfile.

I explicitly tested the workflow you're trying to use with replace[3]
and it worked OK for me.

-Ted

1. https://github.com/rust-lang/cargo/issues/3066
2.
https://dxr.mozilla.org/mozilla-central/rev/783356f1476eafd8e4d6fa5f3919cf6167e84f8d/config/rules.mk#916
3.
https://github.com/luser/vendor-test/commit/1e146ca6be23e7585473c8a9febcb2a6310911d9
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to