Rust build documentation missing step to update lock file

RESOLVED FIXED

Status

Developer Documentation
General
P2
minor
RESOLVED FIXED
9 months ago
8 months ago

People

(Reporter: pellenbogen, Assigned: pellenbogen)

Tracking

Details

MozReview Requests

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

9 months ago
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 :-)
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
(Assignee)

Updated

9 months ago
Attachment #8877346 - Flags: review?(giles)

Comment 5

9 months ago
mozreview-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

::: 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+
(Assignee)

Comment 6

9 months ago
mozreview-review-reply
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 hidden (mozreview-request)

Comment 8

9 months ago
mozreview-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/#review153678

With that change it's good to land.

Comment 9

9 months ago
mozreview-review-reply
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.

Comment 10

9 months ago
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
(Assignee)

Comment 11

9 months ago
mozreview-review-reply
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.
https://hg.mozilla.org/mozilla-central/rev/a1766008e1e4
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.