Skip to content

Commit

Permalink
autocargo: fix ambiguous type
Browse files Browse the repository at this point in the history
Summary:
the thrift library target `fbcode//thrift/annotation:all` defines `thrift_srcs = []`. in this case, a 'thrift_build.rs' will be generated that contains the line `let srcs = &[];`. this is of ambiguous type. fix this by ascription: `let srcs: &[&str]`.

before:
```counterexample
$ buck2 run fbcode//common/rust/cargo_from_buck/autocargo:autocargo && (cd fbcode/thrift/lib/rust/annotation/all && THRIFT1=$(buck2 build fbcode//thrift/compiler:thrift --show-full-simple-output) CARGO_TARGET_DIR=~/tmp cargo build)

error[E0282]: type annotations needed for `&[_; 0]`
  --> thrift_build.rs:41:9
   |
41 |     let srcs = &[];
   |         ^^^^   --- type must be known at this point
```

the `autocargo-verification` job should be expected to fail here. this is because it's `autocargo` itself that is being updated by this diff.

Reviewed By: Imxset21

Differential Revision: D57521067

fbshipit-source-id: 02f697a63898d5a27a611938d185ff4642edab2f
  • Loading branch information
Shayne Fletcher authored and facebook-github-bot committed May 18, 2024
1 parent 417d359 commit 38258e6
Show file tree
Hide file tree
Showing 52 changed files with 52 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("all__types");
conf.clients_crate("all__clients");
let srcs = &[];
let srcs: &[&str] = &[];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("all__types");
conf.clients_crate("all__clients");
let srcs = &[];
let srcs: &[&str] = &[];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("all__types");
conf.clients_crate("all__clients");
let srcs = &[];
let srcs: &[&str] = &[];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("all__types");
conf.clients_crate("all__clients");
let srcs = &[];
let srcs: &[&str] = &[];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ fn main() {
conf.types_crate("compat__types");
conf.clients_crate("compat__clients");
conf.options("deprecated_default_enum_min_i32");
let srcs = &["../../../../../annotation/compat.thrift"];
let srcs: &[&str] = &["../../../../../annotation/compat.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ fn main() {
conf.types_crate("compat__types");
conf.clients_crate("compat__clients");
conf.options("deprecated_default_enum_min_i32");
let srcs = &["../../../../../annotation/compat.thrift"];
let srcs: &[&str] = &["../../../../../annotation/compat.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ fn main() {
conf.types_crate("compat__types");
conf.clients_crate("compat__clients");
conf.options("deprecated_default_enum_min_i32");
let srcs = &["../../../../../annotation/compat.thrift"];
let srcs: &[&str] = &["../../../../../annotation/compat.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ fn main() {
conf.types_crate("compat__types");
conf.clients_crate("compat__clients");
conf.options("deprecated_default_enum_min_i32");
let srcs = &["../../../../annotation/compat.thrift"];
let srcs: &[&str] = &["../../../../annotation/compat.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ fn main() {
conf.types_crate("cpp__types");
conf.clients_crate("cpp__clients");
conf.options("deprecated_default_enum_min_i32");
let srcs = &["../../../../../annotation/cpp.thrift"];
let srcs: &[&str] = &["../../../../../annotation/cpp.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ fn main() {
conf.types_crate("cpp__types");
conf.clients_crate("cpp__clients");
conf.options("deprecated_default_enum_min_i32");
let srcs = &["../../../../../annotation/cpp.thrift"];
let srcs: &[&str] = &["../../../../../annotation/cpp.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ fn main() {
conf.types_crate("cpp__types");
conf.clients_crate("cpp__clients");
conf.options("deprecated_default_enum_min_i32");
let srcs = &["../../../../../annotation/cpp.thrift"];
let srcs: &[&str] = &["../../../../../annotation/cpp.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ fn main() {
conf.types_crate("cpp__types");
conf.clients_crate("cpp__clients");
conf.options("deprecated_default_enum_min_i32");
let srcs = &["../../../../annotation/cpp.thrift"];
let srcs: &[&str] = &["../../../../annotation/cpp.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("go__types");
conf.clients_crate("go__clients");
let srcs = &["../../../../../annotation/go.thrift"];
let srcs: &[&str] = &["../../../../../annotation/go.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("go__types");
conf.clients_crate("go__clients");
let srcs = &["../../../../../annotation/go.thrift"];
let srcs: &[&str] = &["../../../../../annotation/go.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("go__types");
conf.clients_crate("go__clients");
let srcs = &["../../../../../annotation/go.thrift"];
let srcs: &[&str] = &["../../../../../annotation/go.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("go__types");
conf.clients_crate("go__clients");
let srcs = &["../../../../annotation/go.thrift"];
let srcs: &[&str] = &["../../../../annotation/go.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("hack__types");
conf.clients_crate("hack__clients");
let srcs = &["../../../../../annotation/hack.thrift"];
let srcs: &[&str] = &["../../../../../annotation/hack.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("hack__types");
conf.clients_crate("hack__clients");
let srcs = &["../../../../../annotation/hack.thrift"];
let srcs: &[&str] = &["../../../../../annotation/hack.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("hack__types");
conf.clients_crate("hack__clients");
let srcs = &["../../../../../annotation/hack.thrift"];
let srcs: &[&str] = &["../../../../../annotation/hack.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("hack__types");
conf.clients_crate("hack__clients");
let srcs = &["../../../../annotation/hack.thrift"];
let srcs: &[&str] = &["../../../../annotation/hack.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("java__types");
conf.clients_crate("java__clients");
let srcs = &["../../../../../annotation/java.thrift"];
let srcs: &[&str] = &["../../../../../annotation/java.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("java__types");
conf.clients_crate("java__clients");
let srcs = &["../../../../../annotation/java.thrift"];
let srcs: &[&str] = &["../../../../../annotation/java.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("java__types");
conf.clients_crate("java__clients");
let srcs = &["../../../../../annotation/java.thrift"];
let srcs: &[&str] = &["../../../../../annotation/java.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("java__types");
conf.clients_crate("java__clients");
let srcs = &["../../../../annotation/java.thrift"];
let srcs: &[&str] = &["../../../../annotation/java.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("python__types");
conf.clients_crate("python__clients");
let srcs = &["../../../../../annotation/python.thrift"];
let srcs: &[&str] = &["../../../../../annotation/python.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("python__types");
conf.clients_crate("python__clients");
let srcs = &["../../../../../annotation/python.thrift"];
let srcs: &[&str] = &["../../../../../annotation/python.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("python__types");
conf.clients_crate("python__clients");
let srcs = &["../../../../../annotation/python.thrift"];
let srcs: &[&str] = &["../../../../../annotation/python.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("python__types");
conf.clients_crate("python__clients");
let srcs = &["../../../../annotation/python.thrift"];
let srcs: &[&str] = &["../../../../annotation/python.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("rust__types");
conf.clients_crate("rust__clients");
let srcs = &["../../../../../annotation/rust.thrift"];
let srcs: &[&str] = &["../../../../../annotation/rust.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("rust__types");
conf.clients_crate("rust__clients");
let srcs = &["../../../../../annotation/rust.thrift"];
let srcs: &[&str] = &["../../../../../annotation/rust.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("rust__types");
conf.clients_crate("rust__clients");
let srcs = &["../../../../../annotation/rust.thrift"];
let srcs: &[&str] = &["../../../../../annotation/rust.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("rust__types");
conf.clients_crate("rust__clients");
let srcs = &["../../../../annotation/rust.thrift"];
let srcs: &[&str] = &["../../../../annotation/rust.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("scope__types");
conf.clients_crate("scope__clients");
let srcs = &["../../../../../annotation/scope.thrift"];
let srcs: &[&str] = &["../../../../../annotation/scope.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("scope__types");
conf.clients_crate("scope__clients");
let srcs = &["../../../../../annotation/scope.thrift"];
let srcs: &[&str] = &["../../../../../annotation/scope.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("scope__types");
conf.clients_crate("scope__clients");
let srcs = &["../../../../../annotation/scope.thrift"];
let srcs: &[&str] = &["../../../../../annotation/scope.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("scope__types");
conf.clients_crate("scope__clients");
let srcs = &["../../../../annotation/scope.thrift"];
let srcs: &[&str] = &["../../../../annotation/scope.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("thrift__types");
conf.clients_crate("thrift__clients");
let srcs = &["../../../../../annotation/thrift.thrift"];
let srcs: &[&str] = &["../../../../../annotation/thrift.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("thrift__types");
conf.clients_crate("thrift__clients");
let srcs = &["../../../../../annotation/thrift.thrift"];
let srcs: &[&str] = &["../../../../../annotation/thrift.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("thrift__types");
conf.clients_crate("thrift__clients");
let srcs = &["../../../../../annotation/thrift.thrift"];
let srcs: &[&str] = &["../../../../../annotation/thrift.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("thrift__types");
conf.clients_crate("thrift__clients");
let srcs = &["../../../../annotation/thrift.thrift"];
let srcs: &[&str] = &["../../../../annotation/thrift.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("teststructs__types");
conf.clients_crate("teststructs__clients");
let srcs = &["../test_structs.thrift"];
let srcs: &[&str] = &["../test_structs.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("teststructs__types");
conf.clients_crate("teststructs__clients");
let srcs = &["../test_structs.thrift"];
let srcs: &[&str] = &["../test_structs.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("teststructs__types");
conf.clients_crate("teststructs__clients");
let srcs = &["../test_structs.thrift"];
let srcs: &[&str] = &["../test_structs.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ fn main() {
conf.base_path(base_path);
conf.types_crate("teststructs__types");
conf.clients_crate("teststructs__clients");
let srcs = &["test_structs.thrift"];
let srcs: &[&str] = &["test_structs.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.types_crate("test_if__types");
conf.clients_crate("test_if__clients");
conf.options("deprecated_default_enum_min_i32,serde");
let srcs = &["../../test_thrift.thrift"];
let srcs: &[&str] = &["../../test_thrift.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.types_crate("test_if__types");
conf.clients_crate("test_if__clients");
conf.options("deprecated_default_enum_min_i32,serde");
let srcs = &["../../test_thrift.thrift"];
let srcs: &[&str] = &["../../test_thrift.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.types_crate("test_if__types");
conf.clients_crate("test_if__clients");
conf.options("deprecated_default_enum_min_i32,serde");
let srcs = &["../../test_thrift.thrift"];
let srcs: &[&str] = &["../../test_thrift.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.types_crate("test_if__types");
conf.clients_crate("test_if__clients");
conf.options("deprecated_default_enum_min_i32,serde");
let srcs = &["../test_thrift.thrift"];
let srcs: &[&str] = &["../test_thrift.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.types_crate("test_deprecated_optional_with_default_is_some_if__types");
conf.clients_crate("test_deprecated_optional_with_default_is_some_if__clients");
conf.options("deprecated_optional_with_default_is_some");
let srcs = &["../test_deprecated_optional_with_default_is_some.thrift"];
let srcs: &[&str] = &["../test_deprecated_optional_with_default_is_some.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ fn main() {
conf.types_crate("test_deprecated_optional_with_default_is_some_if__types");
conf.clients_crate("test_deprecated_optional_with_default_is_some_if__clients");
conf.options("deprecated_optional_with_default_is_some");
let srcs = &["../test_deprecated_optional_with_default_is_some.thrift"];
let srcs: &[&str] = &["../test_deprecated_optional_with_default_is_some.thrift"];
conf.run(srcs).expect("Failed while running thrift compilation");
}

0 comments on commit 38258e6

Please sign in to comment.