Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Rust 1.71.0 #2062

Merged
merged 7 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
BasedOnStyle: Google
IndentWidth: 4
...
21 changes: 21 additions & 0 deletions .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Formatting

on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize

jobs:
clang-format-checking:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.14
with:
source: '.'
extensions: 'h,c,cc,proto'
clangFormatVersion: 14
8 changes: 4 additions & 4 deletions crate_universe/src/context/platforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ pub fn resolve_cfg_platforms(
attr.deps
.configurations()
.into_iter()
.chain(attr.deps_dev.configurations().into_iter())
.chain(attr.proc_macro_deps.configurations().into_iter())
.chain(attr.proc_macro_deps_dev.configurations().into_iter())
.chain(attr.deps_dev.configurations())
.chain(attr.proc_macro_deps.configurations())
.chain(attr.proc_macro_deps_dev.configurations())
// Chain the build dependencies if some are defined
.chain(if let Some(attr) = &ctx.build_script_attrs {
attr.deps
.configurations()
.into_iter()
.chain(attr.proc_macro_deps.configurations().into_iter())
.chain(attr.proc_macro_deps.configurations())
.collect::<BTreeSet<Option<&String>>>()
.into_iter()
} else {
Expand Down
24 changes: 12 additions & 12 deletions crate_universe/src/splicing/cargo_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ mod test {
let config = temp_dir.as_ref().join("config.toml");

fs::write(&config, textwrap::dedent(
r##"
r#"
# Makes artifactory the default registry and saves passing --registry parameter
[registry]
default = "art-crates-remote"
Expand All @@ -185,7 +185,7 @@ mod test {

[net]
git-fetch-with-cli = true
"##,
"#,
)).unwrap();

let config = CargoConfig::try_from_path(&config).unwrap();
Expand Down Expand Up @@ -224,7 +224,7 @@ mod test {
let config = temp_dir.as_ref().join("config.toml");

fs::write(&config, textwrap::dedent(
r##"
r#"
[registries]
art-crates-remote = { index = "https://artprod.mycompany/artifactory/git/cargo-remote.git" }

Expand All @@ -233,7 +233,7 @@ mod test {

[source.some-mirror]
registry = "https://artmirror.mycompany/artifactory/cargo-mirror.git"
"##,
"#,
)).unwrap();

let config = CargoConfig::try_from_path(&config).unwrap();
Expand All @@ -249,13 +249,13 @@ mod test {
let config = temp_dir.as_ref().join("config.toml");

fs::write(&config, textwrap::dedent(
r##"
r#"
[registries]
art-crates-remote = { index = "https://artprod.mycompany/artifactory/git/cargo-remote.git" }

[source.crates-io]
replace-with = "art-crates-remote"
"##,
"#,
)).unwrap();

let config = CargoConfig::try_from_path(&config).unwrap();
Expand All @@ -273,10 +273,10 @@ mod test {
fs::write(
&config,
textwrap::dedent(
r##"
r#"
[source.some-mirror]
registry = "https://artmirror.mycompany/artifactory/cargo-mirror.git"
"##,
"#,
),
)
.unwrap();
Expand Down Expand Up @@ -319,7 +319,7 @@ mod test {
let config = temp_dir.as_ref().join("config.toml");

fs::write(&config, textwrap::dedent(
r##"
r#"
[registries]
art-crates-remote = { index = "https://artprod.mycompany/artifactory/git/cargo-remote.git" }

Expand All @@ -328,7 +328,7 @@ mod test {

[source.some-mirror]
registry = "https://artmirror.mycompany/artifactory/cargo-mirror.git"
"##,
"#,
)).unwrap();

let config = CargoConfig::try_from_path(&config).unwrap();
Expand Down Expand Up @@ -360,7 +360,7 @@ mod test {
let config = temp_dir.as_ref().join("config.toml");

fs::write(&config, textwrap::dedent(
r##"
r#"
[registries]
art-crates-remote = { index = "https://artprod.mycompany/artifactory/git/cargo-remote.git" }

Expand All @@ -369,7 +369,7 @@ mod test {

[source.some-mirror]
registry = "https://artmirror.mycompany/artifactory/cargo-mirror.git"
"##,
"#,
)).unwrap();

let config = CargoConfig::try_from_path(&config).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions crate_universe/src/splicing/splicer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl<'a> SplicerKind<'a> {
fs::create_dir(&dot_cargo_dir)?;
symlink_roots(&real_path, &dot_cargo_dir, Some(&["config", "config.toml"]))?;
} else {
for config in vec![
for config in [
dot_cargo_dir.join("config"),
dot_cargo_dir.join("config.toml"),
] {
Expand All @@ -364,7 +364,7 @@ impl<'a> SplicerKind<'a> {
}

// Make sure no other config files exist
for config in vec![
for config in [
workspace_dir.join("config"),
workspace_dir.join("config.toml"),
dot_cargo_dir.join("config"),
Expand All @@ -384,7 +384,7 @@ impl<'a> SplicerKind<'a> {
let mut current_parent = workspace_dir.parent();
while let Some(parent) = current_parent {
let dot_cargo_dir = parent.join(".cargo");
for config in vec![
for config in [
dot_cargo_dir.join("config.toml"),
dot_cargo_dir.join("config"),
] {
Expand Down
2 changes: 1 addition & 1 deletion docs/cargo.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c
| <a id="cargo_bootstrap_repository-rust_toolchain_rustc_template"></a>rust_toolchain_rustc_template | The template to use for finding the host <code>rustc</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | <code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code> |
| <a id="cargo_bootstrap_repository-srcs"></a>srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
| <a id="cargo_bootstrap_repository-timeout"></a>timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | <code>600</code> |
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.70.0"</code> |
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.71.0"</code> |


<a id="cargo_dep_env"></a>
Expand Down
4 changes: 2 additions & 2 deletions docs/crate_universe.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ CARGO_BAZEL_REPIN=1 CARGO_BAZEL_REPIN_ONLY=crate_index bazel sync --only=crate_i
| <a id="crates_repository-repo_mapping"></a>repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.&lt;p&gt;For example, an entry <code>"@foo": "@bar"</code> declares that, for any time this repository depends on <code>@foo</code> (such as a dependency on <code>@foo//some:target</code>, it should actually resolve that dependency within globally-declared <code>@bar</code> (<code>@bar//some:target</code>). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
| <a id="crates_repository-rust_toolchain_cargo_template"></a>rust_toolchain_cargo_template | The template to use for finding the host <code>cargo</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), <code>{cfg}</code> (eg. 'exec'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | <code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code> |
| <a id="crates_repository-rust_toolchain_rustc_template"></a>rust_toolchain_rustc_template | The template to use for finding the host <code>rustc</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), <code>{cfg}</code> (eg. 'exec'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'cargo.exe') will be replaced in the string if present. | String | optional | <code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code> |
| <a id="crates_repository-rust_version"></a>rust_version | The version of Rust the currently registered toolchain is using. Eg. <code>1.56.0</code>, or <code>nightly/2021-09-08</code> | String | optional | <code>"1.70.0"</code> |
| <a id="crates_repository-rust_version"></a>rust_version | The version of Rust the currently registered toolchain is using. Eg. <code>1.56.0</code>, or <code>nightly/2021-09-08</code> | String | optional | <code>"1.71.0"</code> |
| <a id="crates_repository-splicing_config"></a>splicing_config | The configuration flags to use for splicing Cargo maniests. Use <code>//crate_universe:defs.bzl\%rsplicing_config</code> to generate the value for this field. If unset, the defaults defined there will be used. | String | optional | <code>""</code> |
| <a id="crates_repository-supported_platform_triples"></a>supported_platform_triples | A set of all platform triples to consider when generating dependencies. | List of strings | optional | <code>["aarch64-unknown-linux-gnu", "i686-apple-darwin", "i686-pc-windows-msvc", "i686-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "aarch64-apple-ios-sim", "aarch64-apple-ios", "aarch64-fuchsia", "aarch64-linux-android", "aarch64-pc-windows-msvc", "arm-unknown-linux-gnueabi", "armv7-linux-androideabi", "armv7-unknown-linux-gnueabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf", "s390x-unknown-linux-gnu", "thumbv7em-none-eabi", "thumbv8m.main-none-eabi", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-fuchsia", "x86_64-linux-android", "x86_64-unknown-freebsd", "x86_64-unknown-none"]</code> |

Expand Down Expand Up @@ -725,7 +725,7 @@ Define dependencies of the `cargo-bazel` Rust target

| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <a id="crate_universe_dependencies-rust_version"></a>rust_version | The version of rust to use when generating dependencies. | `"1.70.0"` |
| <a id="crate_universe_dependencies-rust_version"></a>rust_version | The version of rust to use when generating dependencies. | `"1.71.0"` |
| <a id="crate_universe_dependencies-bootstrap"></a>bootstrap | If true, a <code>cargo_bootstrap_repository</code> target will be generated. | `False` |


Expand Down
4 changes: 2 additions & 2 deletions docs/flatten.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c
| <a id="cargo_bootstrap_repository-rust_toolchain_rustc_template"></a>rust_toolchain_rustc_template | The template to use for finding the host <code>rustc</code> binary. <code>{version}</code> (eg. '1.53.0'), <code>{triple}</code> (eg. 'x86_64-unknown-linux-gnu'), <code>{arch}</code> (eg. 'aarch64'), <code>{vendor}</code> (eg. 'unknown'), <code>{system}</code> (eg. 'darwin'), <code>{channel}</code> (eg. 'stable'), and <code>{tool}</code> (eg. 'rustc.exe') will be replaced in the string if present. | String | optional | <code>"@rust_{system}_{arch}__{triple}__{channel}_tools//:bin/{tool}"</code> |
| <a id="cargo_bootstrap_repository-srcs"></a>srcs | Souce files of the crate to build. Passing source files here can be used to trigger rebuilds when changes are made | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
| <a id="cargo_bootstrap_repository-timeout"></a>timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | <code>600</code> |
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.70.0"</code> |
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.71.0"</code> |


<a id="cargo_dep_env"></a>
Expand Down Expand Up @@ -1899,7 +1899,7 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai
| <a id="rust_register_toolchains-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions when global allocator is used with cc_common.link. | `None` |
| <a id="rust_register_toolchains-iso_date"></a>iso_date | **Deprecated**: Use <code>versions</code> instead. | `None` |
| <a id="rust_register_toolchains-register_toolchains"></a>register_toolchains | If true, repositories will be generated to produce and register <code>rust_toolchain</code> targets. | `True` |
| <a id="rust_register_toolchains-rustfmt_version"></a>rustfmt_version | The version of rustfmt. | `"nightly/2023-06-01"` |
| <a id="rust_register_toolchains-rustfmt_version"></a>rustfmt_version | The version of rustfmt. | `"nightly/2023-07-13"` |
| <a id="rust_register_toolchains-rust_analyzer_version"></a>rust_analyzer_version | The version of Rustc to pair with rust-analyzer. | `None` |
| <a id="rust_register_toolchains-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. | `None` |
| <a id="rust_register_toolchains-extra_target_triples"></a>extra_target_triples | Additional rust-style targets that rust toolchains should support. | `["wasm32-unknown-unknown", "wasm32-wasi"]` |
Expand Down
2 changes: 1 addition & 1 deletion docs/rust_repositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ See `load_arbitrary_tool` in `@rules_rust//rust:repositories.bzl` for more detai
| <a id="rust_register_toolchains-global_allocator_library"></a>global_allocator_library | Target that provides allocator functions when global allocator is used with cc_common.link. | `None` |
| <a id="rust_register_toolchains-iso_date"></a>iso_date | **Deprecated**: Use <code>versions</code> instead. | `None` |
| <a id="rust_register_toolchains-register_toolchains"></a>register_toolchains | If true, repositories will be generated to produce and register <code>rust_toolchain</code> targets. | `True` |
| <a id="rust_register_toolchains-rustfmt_version"></a>rustfmt_version | The version of rustfmt. | `"nightly/2023-06-01"` |
| <a id="rust_register_toolchains-rustfmt_version"></a>rustfmt_version | The version of rustfmt. | `"nightly/2023-07-13"` |
| <a id="rust_register_toolchains-rust_analyzer_version"></a>rust_analyzer_version | The version of Rustc to pair with rust-analyzer. | `None` |
| <a id="rust_register_toolchains-sha256s"></a>sha256s | A dict associating tool subdirectories to sha256 hashes. | `None` |
| <a id="rust_register_toolchains-extra_target_triples"></a>extra_target_triples | Additional rust-style targets that rust toolchains should support. | `["wasm32-unknown-unknown", "wasm32-wasi"]` |
Expand Down
38 changes: 20 additions & 18 deletions examples/android/allocator_library.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,31 @@
__attribute__((weak)) uint8_t __rust_alloc_error_handler_should_panic = 0;

extern "C" uint8_t *__rdl_alloc(uintptr_t size, uintptr_t align);
extern "C" __attribute__((weak))
uint8_t *__rust_alloc(uintptr_t size, uintptr_t align) {
return __rdl_alloc(size, align);
extern "C" __attribute__((weak)) uint8_t *__rust_alloc(uintptr_t size,
uintptr_t align) {
return __rdl_alloc(size, align);
}
extern "C" void __rdl_dealloc(uint8_t *ptr, uintptr_t size, uintptr_t align);
extern "C" __attribute__((weak))
void __rust_dealloc(uint8_t *ptr, uintptr_t size, uintptr_t align) {
__rdl_dealloc(ptr, size, align);
extern "C" __attribute__((weak)) void __rust_dealloc(uint8_t *ptr,
uintptr_t size,
uintptr_t align) {
__rdl_dealloc(ptr, size, align);
}
extern "C" uint8_t *__rdl_realloc(uint8_t *ptr, uintptr_t old_size, uintptr_t align,
uintptr_t new_size);
extern "C" __attribute__((weak))
uint8_t *__rust_realloc(uint8_t *ptr, uintptr_t old_size, uintptr_t align,
uintptr_t new_size) {
return __rdl_realloc(ptr, old_size, align, new_size);
extern "C" uint8_t *__rdl_realloc(uint8_t *ptr, uintptr_t old_size,
uintptr_t align, uintptr_t new_size);
extern "C" __attribute__((weak)) uint8_t *__rust_realloc(uint8_t *ptr,
uintptr_t old_size,
uintptr_t align,
uintptr_t new_size) {
return __rdl_realloc(ptr, old_size, align, new_size);
}
extern "C" uint8_t *__rdl_alloc_zeroed(uintptr_t size, uintptr_t align);
extern "C" __attribute__((weak))
uint8_t *__rust_alloc_zeroed(uintptr_t size, uintptr_t align) {
return __rdl_alloc_zeroed(size, align);
extern "C" __attribute__((weak)) uint8_t *__rust_alloc_zeroed(uintptr_t size,
uintptr_t align) {
return __rdl_alloc_zeroed(size, align);
}
extern "C" void __rdl_oom(uintptr_t size, uintptr_t align);
extern "C" __attribute__((weak))
void __rust_alloc_error_handler(uintptr_t size, uintptr_t align) {
__rdl_oom(size, align);
extern "C" __attribute__((weak)) void __rust_alloc_error_handler(
uintptr_t size, uintptr_t align) {
__rdl_oom(size, align);
}
4 changes: 1 addition & 3 deletions examples/android/android_link_hack.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// https://github.com/bazelbuild/rules_rust/issues/1271
extern void android_link_hack(void);

void call_link_hack(void) {
android_link_hack();
}
void call_link_hack(void) { android_link_hack(); }

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/ffi/c_calling_rust/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
extern int32_t my_favorite_number();

int main(int argc, char** argv) {
assert(my_favorite_number() == 4);
return 0;
assert(my_favorite_number() == 4);
return 0;
}
Loading
Loading