Files
brave-core/docs/rust.md
T
cdesouza-chromium b694664f80 [cr137-follow-up] Correct crate patches to point to brave/ (#29132)
This change corrects all crate patches, changing them to point to
`brave/`. This eliminates the need of patching `gnrt vendor` to address
this patch mismatch.

Patches should be created now with:

```sh
git format-patch \
    --start-number=101 \
    --src-prefix=a/brave/ \
    --dst-prefix=b/brave/ \
    --output-directory \
        third_party/rust/chromium_crates_io/patches/some-crate/ \
    HEAD^
```

Resolves https://github.com/brave/brave-browser/issues/46201
2025-05-21 09:16:14 +01:00

1.3 KiB
Raw Blame History

Rust usage:

When integrating Rust code into brave-core, keep the following points in mind:

  • Chromiums networking stack must be used
  • The deps being added (and the deps recursively being added) must be approved via an issue posted at brave/reviews
  • The new code does not duplicate things already done in Chromium
  • https://chromium.googlesource.com/chromium/src/+/main/docs/adding_to_third_party.md#rust also applies generally to all Rust code in brave-core
  • Look at existing deps in third_party/rust and try to match up versions whenever possible. We are trying to avoid having multiple copies of the same third party libs

Patching crates

There can be cases where patching crates is necessary. To create a patch file, make changes to a crate and create a patch with:

git format-patch \
    --start-number=101 \
    --src-prefix=a/brave/ \
    --dst-prefix=b/brave/ \
    --output-directory \
        third_party/rust/chromium_crates_io/patches/some-crate/ \
    HEAD^

For general instructions on how this works in upstream Chromium, check these instructions.