Commit Graph

9 Commits

Author SHA1 Message Date
Lukas Piatkowski
b0bc02a308 Re-sync with internal repository 2019-11-13 20:16:37 +01:00
Andres Suarez
cf36295fa4 Yearless license header
Summary:
This diff updates all license headers to use the new text and style.
Also, a few internal files were missing the header, but now they have it.
`fbcode/common/rust/netstring/` had the internal header, but now it has
GPLV2PLUS - since that goes to Mononoke's Github too.

Differential Revision: D17881539

fbshipit-source-id: b70d2ee41d2019fc7c2fe458627f0f7c01978186
2019-10-11 13:52:34 -07:00
David Tolnay
713973975d Replace *fbinit::FACEBOOK with #[fbinit::main]
Summary:
This diff moves initFacebook calls that used to happen just before FFI calls to instead happen at the beginning of main.

The basic assumption of initFacebook is that it happens at the beginning of main before there are additional threads. It must be allowed to modify process-global state like env vars or gflags without the possibility of a data race from other code concurrently reading those things. As such, the previous approach of calling initFacebook through `*fbinit::FACEBOOK` near FFI calls was prone to race conditions.

The new approach is based on attribute macros added in D17245802.

 ---

The primary remaining situations that still require `*fbinit::FACEBOOK` are when we don't directly control the function arguments surrounding the call to C++, such as in lazy_static:

    lazy_static! {
        static ref S: Ty = {
            let _ = *fbinit::FACEBOOK;
            /* call C++ */
        };
    }

and quickcheck:

    quickcheck! {
        fn f(/* args that impl Arbitrary */) {
            let _ = *fbinit::FACEBOOK;
            /* call C++ */
        }
    }

I will revisit these in a separate diff. They are a small fraction of total uses of fbinit.

Reviewed By: Imxset21

Differential Revision: D17328504

fbshipit-source-id: f80edb763e7f42b3216552dd32f1ea0e6cc8fd12
2019-09-13 20:17:29 -07:00
David Tolnay
577a31b2a1 Delete extern crate lines
Summary:
`extern crate` is usually no longer needed in 2018 edition of Rust. This diff removes `extern crate` lines from fbcode where possible, replacing #[macro_use] with individual import of macros.

Before:

```
#[macro_use]
extern crate futures_ext;
extern crate serde_json;
```

After:

```
use futures_ext::try_boxfuture;
```

Reviewed By: Imxset21

Differential Revision: D17313537

fbshipit-source-id: 70462a2c161375017b77fa44aba166884ad2fdc3
2019-09-11 22:01:58 -07:00
Stanislau Hlebik
ce6ce44d50 mononoke: rename Manifest/Entry to HgManifest/HgEntry
Summary:
We now have two Manifest and two Entry traits and it makes it very confusing.
The old Manifest trait (and related EmptyManifest struct and Entry trait) are
mercurial-specific, while new Manifest trait is generic over all kinds of
manifests (unodes, mercurial etc).

In ideal state we should have only new Manifest trait, but it'd require quite a
big refactoring. In short term let's at least rename Manifest to HgManifest and
Entry to HgEntry to make distinction clearer.

Reviewed By: krallin

Differential Revision: D16886032

fbshipit-source-id: 80e3999fae3e89347448579caf7aafec56705500
2019-08-20 01:12:49 -07:00
Greg Cowan
041770b090 Transition fbcode Rust crates to 2018 edition
Summary: Marking all Cargo.tomls in fbcode as 2018 edition.

Reviewed By: jsgf

Differential Revision: D15951175

fbshipit-source-id: edf18449c214ee1ff285d6a2cb61839aaf58a8cd
2019-06-24 13:15:17 -07:00
Pavel Aslanov
a0a3a421f2 make HgEntryId an enum
Summary: `HgEntryId` is much more useful in a typed from (enum of `(FileType, HgFileNodeId)` and `HgManifestId`), most of the time we now which type entry should contain and it makes it harder to make and error, all other use cases which require just hash should use `HgNodeHash` instead. This diff includes minimal changes which are necessary to make it work. Some of the cases which do sequence of `Entry::get_hash().into_nondehash() -> HgManifestId::new() | HgFileNodeId::new()` are left for future diffs.

Reviewed By: farnz

Differential Revision: D15866081

fbshipit-source-id: 5be9ecc30dbfd0a49ae6c5d084cdfe2dac351dac
2019-06-18 11:11:52 -07:00
Jeremy Fitzhardinge
aafc38da2b Convert scm/mononoke/bonsai_utils to Rust 2018
Summary:
Rust 2018 updates to:
  //scm/mononoke/bonsai_utils:bonsai_utils
  //scm/mononoke/bonsai_utils:bonsai_utils-test
  //scm/mononoke/bonsai_utils:bonsai_utils-test-rust-build-info-lib
  //scm/mononoke/bonsai_utils:bonsai_utils-unittest

Reviewed By: StanislavGlebik

Differential Revision: D15465968

fbshipit-source-id: 2b2a22ef853d43a4a255999d1e2593f7e35738b5
2019-05-24 10:07:44 -07:00
Kostia Balytskyi
e561682ecd mononoke: rename crates to contain underscores instead of dashes
Summary: Let's not use dashes in crate names.

Reviewed By: StanislavGlebik

Differential Revision: D14341596

fbshipit-source-id: 85a7ded60cf2e326997ac70ee47a29116af97590
2019-03-06 07:18:28 -08:00