Skip to content

Commit 019f871

Browse files
authored
Added Rust 1.66.0 (#1705)
* Added Rust 1.66.0 * Regenerate documentation
1 parent 1469cd7 commit 019f871

File tree

23 files changed

+311
-39
lines changed

23 files changed

+311
-39
lines changed

cargo/cargo_build_script_runner/bin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn run_buildrs() -> Result<(), String> {
3232
let exec_root = env::current_dir().expect("Failed to get current directory");
3333
let manifest_dir_env = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR was not set");
3434
let rustc_env = env::var("RUSTC").expect("RUSTC was not set");
35-
let manifest_dir = exec_root.join(&manifest_dir_env);
35+
let manifest_dir = exec_root.join(manifest_dir_env);
3636
let rustc = exec_root.join(&rustc_env);
3737
let Options {
3838
progname,
@@ -48,15 +48,15 @@ fn run_buildrs() -> Result<(), String> {
4848
input_dep_env_paths,
4949
} = parse_args()?;
5050

51-
let out_dir_abs = exec_root.join(&out_dir);
51+
let out_dir_abs = exec_root.join(out_dir);
5252
// For some reason Google's RBE does not create the output directory, force create it.
5353
create_dir_all(&out_dir_abs)
5454
.unwrap_or_else(|_| panic!("Failed to make output directory: {:?}", out_dir_abs));
5555

5656
let target_env_vars =
5757
get_target_env_vars(&rustc_env).expect("Error getting target env vars from rustc");
5858

59-
let mut command = Command::new(exec_root.join(&progname));
59+
let mut command = Command::new(exec_root.join(progname));
6060
command
6161
.current_dir(&manifest_dir)
6262
.envs(target_env_vars)

crate_universe/src/context.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ impl Context {
5151
let crates: BTreeMap<CrateId, CrateContext> = annotations
5252
.metadata
5353
.crates
54-
.iter()
55-
// Convert the crate annotations into more renderable contexts
56-
.map(|(_, annotation)| {
54+
.values()
55+
.map(|annotation| {
5756
let context = CrateContext::new(
5857
annotation,
5958
&annotations.metadata.packages,
@@ -281,8 +280,8 @@ impl Context {
281280
pub fn flat_workspace_member_deps(&self) -> BTreeMap<CrateId, Option<String>> {
282281
let workspace_member_dependencies: BTreeSet<CrateDependency> = self
283282
.workspace_members
284-
.iter()
285-
.map(|(id, _)| &self.crates[id])
283+
.keys()
284+
.map(|id| &self.crates[id])
286285
.flat_map(|ctx| {
287286
// Build an interator of all dependency CrateIds.
288287
// TODO: This expansion is horribly verbose and should be refactored but closures

crate_universe/src/rendering/template_engine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ impl TemplateEngine {
239239
context.insert("context", ctx);
240240

241241
ctx.crates
242-
.iter()
243-
.map(|(id, _)| {
242+
.keys()
243+
.map(|id| {
244244
let aliases = ctx.crate_aliases(id, false, false);
245245
let build_aliases = ctx.crate_aliases(id, true, false);
246246

crate_universe/src/splicing/splicer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl<'a> SplicerKind<'a> {
396396
fs::create_dir_all(&dot_cargo_dir)?;
397397
}
398398

399-
fs::copy(cargo_config_path, &dot_cargo_dir.join("config.toml"))?;
399+
fs::copy(cargo_config_path, dot_cargo_dir.join("config.toml"))?;
400400
}
401401

402402
Ok(())
@@ -488,8 +488,8 @@ impl Splicer {
488488
// Load all manifests
489489
let manifests = splicing_manifest
490490
.manifests
491-
.iter()
492-
.map(|(path, _)| {
491+
.keys()
492+
.map(|path| {
493493
let m = read_manifest(path)
494494
.with_context(|| format!("Failed to read manifest at {}", path.display()))?;
495495
Ok((path.clone(), m))
@@ -615,7 +615,7 @@ pub fn write_root_manifest(path: &Path, manifest: cargo_toml::Manifest) -> Resul
615615
}
616616

617617
// TODO(https://gitlab.com/crates.rs/cargo_toml/-/issues/3)
618-
let value = toml::Value::try_from(&manifest)?;
618+
let value = toml::Value::try_from(manifest)?;
619619
fs::write(path, toml::to_string(&value)?)
620620
.context(format!("Failed to write manifest to {}", path.display()))
621621
}
@@ -1165,7 +1165,7 @@ mod test {
11651165
fs::create_dir_all(external_manifest.parent().unwrap()).unwrap();
11661166
fs::write(
11671167
&external_manifest,
1168-
&textwrap::dedent(
1168+
textwrap::dedent(
11691169
r#"
11701170
[package]
11711171
name = "external_workspace_member"
@@ -1211,8 +1211,8 @@ mod test {
12111211

12121212
// Modify the root manifest to remove the rendered package
12131213
fs::write(
1214-
&cache_dir.as_ref().join("Cargo.toml"),
1215-
&textwrap::dedent(
1214+
cache_dir.as_ref().join("Cargo.toml"),
1215+
textwrap::dedent(
12161216
r#"
12171217
[workspace]
12181218
members = [

crate_universe/src/utils/starlark/label.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ mod test {
304304
let actual_file = subdir.join("greatgrandchild");
305305
create_dir_all(subdir).unwrap();
306306
{
307-
File::create(&workspace).unwrap();
308-
File::create(&build_file).unwrap();
307+
File::create(workspace).unwrap();
308+
File::create(build_file).unwrap();
309309
File::create(&actual_file).unwrap();
310310
}
311311
let label = Label::from_absolute_path(&actual_file).unwrap();
@@ -322,7 +322,7 @@ mod test {
322322
let actual_file = subdir.join("greatgrandchild");
323323
create_dir_all(subdir).unwrap();
324324
{
325-
File::create(&build_file).unwrap();
325+
File::create(build_file).unwrap();
326326
File::create(&actual_file).unwrap();
327327
}
328328
let err = Label::from_absolute_path(&actual_file)
@@ -340,7 +340,7 @@ mod test {
340340
let actual_file = subdir.join("greatgrandchild");
341341
create_dir_all(subdir).unwrap();
342342
{
343-
File::create(&workspace).unwrap();
343+
File::create(workspace).unwrap();
344344
File::create(&actual_file).unwrap();
345345
}
346346
let err = Label::from_absolute_path(&actual_file)

docs/cargo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c
3636
| <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> |
3737
| <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> |
3838
| <a id="cargo_bootstrap_repository-timeout"></a>timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | <code>600</code> |
39-
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.65.0"</code> |
39+
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.66.0"</code> |
4040

4141

4242
<a id="cargo_dep_env"></a>

docs/crate_universe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ that is called behind the scenes to update dependencies.
292292
| <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 | |
293293
| <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> |
294294
| <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> |
295-
| <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.65.0"</code> |
295+
| <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.66.0"</code> |
296296
| <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> |
297297
| <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>["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", "aarch64-apple-ios-sim", "aarch64-pc-windows-msvc", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabi", "armv7-linux-androideabi", "i686-linux-android", "i686-unknown-freebsd", "powerpc-unknown-linux-gnu", "s390x-unknown-linux-gnu", "wasm32-unknown-unknown", "wasm32-wasi", "x86_64-apple-ios", "x86_64-linux-android", "x86_64-unknown-freebsd", "riscv32imc-unknown-none-elf", "riscv64gc-unknown-none-elf"]</code> |
298298

@@ -623,7 +623,7 @@ Define dependencies of the `cargo-bazel` Rust target
623623

624624
| Name | Description | Default Value |
625625
| :------------- | :------------- | :------------- |
626-
| <a id="crate_universe_dependencies-rust_version"></a>rust_version | The version of rust to use when generating dependencies. | `"1.65.0"` |
626+
| <a id="crate_universe_dependencies-rust_version"></a>rust_version | The version of rust to use when generating dependencies. | `"1.66.0"` |
627627
| <a id="crate_universe_dependencies-bootstrap"></a>bootstrap | If true, a <code>cargo_bootstrap_repository</code> target will be generated. | `False` |
628628

629629

docs/flatten.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ A rule for bootstrapping a Rust binary using [Cargo](https://doc.rust-lang.org/c
102102
| <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> |
103103
| <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> |
104104
| <a id="cargo_bootstrap_repository-timeout"></a>timeout | Maximum duration of the Cargo build command in seconds | Integer | optional | <code>600</code> |
105-
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.65.0"</code> |
105+
| <a id="cargo_bootstrap_repository-version"></a>version | The version of cargo the resolver should use | String | optional | <code>"1.66.0"</code> |
106106

107107

108108
<a id="cargo_dep_env"></a>

examples/crate_universe/cargo_aliases/cargo-bazel-lock.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"checksum": "6dcd6fba667c2a840bf66b00bccf9b13845e9f1fc9052d45a17e472e4dc449e2",
2+
"checksum": "65c0eb8b3b139244ffb2542508ffa52acac2de117584247b90ab67c3bd9ba1ba",
33
"crates": {
44
"aho-corasick 0.7.20": {
55
"name": "aho-corasick",

examples/crate_universe/cargo_workspace/cargo-bazel-lock.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"checksum": "d4bb99369d5f0fa1d593884a4d0ced3d54c8b952d130be207b8b679fcb6ea19f",
2+
"checksum": "b819ab7a9515daeda37fef72ae16248adc6932c0e099da7064a227fb0dd096d0",
33
"crates": {
44
"ansi_term 0.12.1": {
55
"name": "ansi_term",

0 commit comments

Comments
 (0)