Closed Bug 1372743 Opened 7 years ago Closed 7 years ago

Rust build documentation missing step to update lock file

Categories

(Developer Documentation Graveyard :: General, defect, P2)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pellenbogen, Assigned: pellenbogen)

Details

Attachments

(1 file)

The documentation for adding a rust crate is missing the step to run "cargo update -p gkrust_shared". Without running this you may get the error "error: the lock file needs to be updated but --locked was passed to prevent this"
Where is this documentation hosted, or which documentation are you referring to?
I'm only asking, because some we can simply edit our self :-)
Attachment #8877346 - Flags: review?(giles)
Comment on attachment 8877346 [details]
Bug 1372743: Add updating Cargo.lock file in 'toolkit/library/rust' using 'cargo update' as step in the docs to add a rust crate.

https://reviewboard.mozilla.org/r/148716/#review153166

::: build/docs/rust.rst:18
(Diff revision 2)
>  ===============================
>  
>  Rust crates that you want to link into libxul should be listed in the
>  ``dependencies`` section of `toolkit/library/rust/shared/Cargo.toml <https://dxr.mozilla.org/mozilla-central/source/toolkit/library/rust/shared/Cargo.toml>`_.
> -You'll also need to add an ``extern crate`` reference to `toolkit/library/rust/shared/lib.rs <https://dxr.mozilla.org/mozilla-central/source/toolkit/library/rust/shared/lib.rs>`_.
> +After adding your crate, execute ``cargo update -p gkrust_shared`` in
> +``toolkit/library/rust`` to update the Cargo.lock file.  You'll also

This needs to be in `toolkit/library/rust/shared` I think.

That applies to where to add the `extern crate` reference too, so you're fixing two bugs! :)
Attachment #8877346 - Flags: review?(giles) → review+
Comment on attachment 8877346 [details]
Bug 1372743: Add updating Cargo.lock file in 'toolkit/library/rust' using 'cargo update' as step in the docs to add a rust crate.

https://reviewboard.mozilla.org/r/148716/#review153166

> This needs to be in `toolkit/library/rust/shared` I think.
> 
> That applies to where to add the `extern crate` reference too, so you're fixing two bugs! :)

There is no Cargo.lock in shared though. The new command is to update `toolkit/library/rust/Cargo.lock`. Im not sure running cargo `update -p gkrust_shared` in the shared directory will do that.

I think the docs do say to add `extern crate` in the shared directory as they are now. The current render is [here](https://gecko.readthedocs.io/en/latest/build/buildsystem/rust.html), which may be more readable.
Comment on attachment 8877346 [details]
Bug 1372743: Add updating Cargo.lock file in 'toolkit/library/rust' using 'cargo update' as step in the docs to add a rust crate.

https://reviewboard.mozilla.org/r/148716/#review153678

With that change it's good to land.
Comment on attachment 8877346 [details]
Bug 1372743: Add updating Cargo.lock file in 'toolkit/library/rust' using 'cargo update' as step in the docs to add a rust crate.

https://reviewboard.mozilla.org/r/148716/#review153166

> There is no Cargo.lock in shared though. The new command is to update `toolkit/library/rust/Cargo.lock`. Im not sure running cargo `update -p gkrust_shared` in the shared directory will do that.
> 
> I think the docs do say to add `extern crate` in the shared directory as they are now. The current render is [here](https://gecko.readthedocs.io/en/latest/build/buildsystem/rust.html), which may be more readable.

Aha, I tried the command and it failed, and tried it in shared and it succeeded (by creating a new Cargo.lock!). The actual problem was the underscore-vs-hythen thing.
Pushed by rgiles@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a1766008e1e4
Add updating Cargo.lock file in 'toolkit/library/rust' using 'cargo update' as step in the docs to add a rust crate. r=rillian
Comment on attachment 8877346 [details]
Bug 1372743: Add updating Cargo.lock file in 'toolkit/library/rust' using 'cargo update' as step in the docs to add a rust crate.

https://reviewboard.mozilla.org/r/148716/#review153166

> Aha, I tried the command and it failed, and tried it in shared and it succeeded (by creating a new Cargo.lock!). The actual problem was the underscore-vs-hythen thing.

I made the underscore mistake when I tried the first time then made the mistake again when updating the docs. doh.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: