Skip to content

Commit 5851175

Browse files
authored
Fix typos in rust tools and util (#3577)
Fix more typos, bump the typos hook to the latest version available, and exclude `diff` types (we don't want to change patches).
1 parent 935e5ee commit 5851175

File tree

15 files changed

+31
-33
lines changed

15 files changed

+31
-33
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ repos:
1212
- id: buildifier-lint
1313
args: [--version, "v8.2.0", --warnings=all]
1414
- repo: https://github.com/crate-ci/typos
15-
rev: v1.35.3
15+
rev: v1.35.5
1616
hooks:
1717
- id: typos
1818
exclude: |
1919
(?x)^(
2020
crate_universe/test_data|
2121
examples|
22-
extensions|
23-
ffi|
24-
rust|
25-
tools|
26-
util
22+
extensions
2723
)
24+
exclude_types:
25+
- diff
2826
- repo: https://github.com/psf/black
2927
rev: 24.10.0
3028
hooks:

rust/platform/triple_mappings.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ _SYSTEM_TO_STDLIB_LINKFLAGS = {
282282
}
283283

284284
def cpu_arch_to_constraints(cpu_arch, *, system = None):
285-
"""Returns a list of contraint values which represents a triple's CPU.
285+
"""Returns a list of constraint values which represents a triple's CPU.
286286
287287
Args:
288288
cpu_arch (str): The architecture to match constraints for

rust/private/common.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _create_crate_info(**kwargs):
4242
provider to improve API stability.
4343
4444
Args:
45-
**kwargs: An inital set of keyword arguments.
45+
**kwargs: An initial set of keyword arguments.
4646
4747
Returns:
4848
CrateInfo: A provider

rust/private/providers.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ BuildInfo = provider(
7676
doc = "A provider containing `rustc` build settings for a given Crate.",
7777
fields = {
7878
"compile_data": "Depset[File]: Compile data provided by the build script that was not copied into `out_dir`.",
79-
"dep_env": "Optinal[File]: extra build script environment varibles to be set to direct dependencies.",
79+
"dep_env": "Optional[File]: extra build script environment variables to be set to direct dependencies.",
8080
"flags": "Optional[File]: file containing additional flags to pass to rustc",
8181
"link_search_paths": "Optional[File]: file containing search paths to pass to rustc and linker",
8282
"linker_flags": "Optional[File]: file containing flags to pass to the linker invoked by rustc or cc_common.link",

rust/private/repository_utils.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def BUILD_for_rust_toolchain(
303303
default_edition (str): Default Rust edition.
304304
include_rustfmt (bool): Whether rustfmt is present in the toolchain.
305305
include_llvm_tools (bool): Whether llvm-tools are present in the toolchain.
306-
stdlib_linkflags (list, optional): Overriden flags needed for linking to rust
306+
stdlib_linkflags (list, optional): Overridden flags needed for linking to rust
307307
stdlib, akin to BAZEL_LINKLIBS. Defaults to
308308
None.
309309
extra_rustc_flags (list, optional): Extra flags to pass to rustc in non-exec configuration.
@@ -812,7 +812,7 @@ def load_arbitrary_tool(
812812
is_reproducible = bool(ctx_sha256)
813813

814814
for subdirectory in tool_subdirectories:
815-
# As long as the sha256 value is consistent accross calls here the
815+
# As long as the sha256 value is consistent across calls here the
816816
# cost of downloading an artifact is negated as by Bazel's caching.
817817
result = ctx.download_and_extract(
818818
urls,
@@ -882,7 +882,7 @@ def _get_tool_extension(urls = None):
882882
return ""
883883

884884
def select_rust_version(versions):
885-
"""Select the highest priorty version for a list of Rust versions
885+
"""Select the highest priority version for a list of Rust versions
886886
887887
Priority order: `stable > nightly > beta`
888888

rust/private/rust.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _rust_library_impl(ctx):
8484
8585
This rule provides CcInfo, so it can be used everywhere Bazel
8686
expects rules_cc, but care must be taken to have the correct
87-
dependencies on an allocator and std implemetation as needed.
87+
dependencies on an allocator and std implementation as needed.
8888
8989
Args:
9090
ctx (ctx): The rule's context object
@@ -1563,7 +1563,7 @@ def rust_test_suite(name, srcs, shared_srcs = [], **kwargs):
15631563
name (str): The name of the `test_suite`.
15641564
srcs (list): All test sources, typically `glob(["tests/**/*.rs"])`.
15651565
shared_srcs (list): Optional argument for sources shared among tests, typically helper functions.
1566-
**kwargs (dict): Additional keyword arguments for the underyling [rust_test](#rust_test) targets. The
1566+
**kwargs (dict): Additional keyword arguments for the underlying [rust_test](#rust_test) targets. The
15671567
`tags` argument is also passed to the generated `test_suite` target.
15681568
"""
15691569
tests = []

rust/private/rustc.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,7 @@ def _add_lto_flags(ctx, toolchain, args, crate):
17181718
args.add_all(lto_args)
17191719

17201720
def _add_codegen_units_flags(toolchain, emit, args):
1721-
"""Adds flags to an Args object to configure codgen_units for 'rustc'.
1721+
"""Adds flags to an Args object to configure codegen_units for 'rustc'.
17221722
17231723
https://doc.rust-lang.org/rustc/codegen-options/index.html#codegen-units
17241724
@@ -1983,7 +1983,7 @@ def add_crate_link_flags(args, dep_info, force_all_deps_direct = False, use_meta
19831983
dep_info (DepInfo): The current target's dependency info
19841984
force_all_deps_direct (bool, optional): Whether to pass the transitive rlibs with --extern
19851985
to the commandline as opposed to -L.
1986-
use_metadata (bool, optional): Build command line arugments using metadata for crates that provide it.
1986+
use_metadata (bool, optional): Build command line arguments using metadata for crates that provide it.
19871987
"""
19881988

19891989
direct_crates = depset(
@@ -2083,7 +2083,7 @@ def _portable_link_flags(lib, use_pic, ambiguous_libs, get_lib_name, for_windows
20832083
# On linux, Rustc adds a -Bdynamic to the linker command line before the libraries specified
20842084
# with `-Clink-arg`, which leads to us linking against the `.so`s but not putting the
20852085
# corresponding value to the runtime library search paths, which results in a
2086-
# "cannot open shared object file: No such file or directory" error at exectuion time.
2086+
# "cannot open shared object file: No such file or directory" error at execution time.
20872087
# We can fix this by adding a `-Clink-arg=-Bstatic` on linux, but we don't have that option for
20882088
# macos. The proper solution for this issue would be to remove `libtest-{hash}.so` and `libstd-{hash}.so`
20892089
# from the toolchain. However, it is not enough to change the toolchain's `rust_std_{...}` filegroups

rust/private/rustdoc.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def rustdoc_compile_action(
152152
)
153153

154154
# Because rustdoc tests compile tests outside of the sandbox, the sysroot
155-
# must be updated to the `short_path` equivilant as it will now be
155+
# must be updated to the `short_path` equivalent as it will now be
156156
# a part of runfiles.
157157
if is_test:
158158
if "SYSROOT" in env:

rust/private/rustdoc/rustdoc_test_writer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ fn write_test_runner_unix(
175175
"#!/usr/bin/env bash".to_owned(),
176176
"".to_owned(),
177177
// TODO: Instead of creating a symlink to mimic the behavior of
178-
// --legacy_external_runfiles, this rule should be able to correcrtly
178+
// --legacy_external_runfiles, this rule should be able to correctly
179179
// sanitize the action args to run in a runfiles without this link.
180180
"if [[ ! -e 'external' ]]; then ln -s ../ external ; fi".to_owned(),
181181
"".to_owned(),
@@ -234,7 +234,7 @@ fn write_test_runner_windows(
234234
"@ECHO OFF".to_owned(),
235235
"".to_owned(),
236236
// TODO: Instead of creating a symlink to mimic the behavior of
237-
// --legacy_external_runfiles, this rule should be able to correcrtly
237+
// --legacy_external_runfiles, this rule should be able to correctly
238238
// sanitize the action args to run in a runfiles without this link.
239239
"powershell.exe -c \"if (!(Test-Path .\\external)) { New-Item -Path .\\external -ItemType SymbolicLink -Value ..\\ }\""
240240
.to_owned(),

rust/repositories.bzl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def _rust_toolchain_tools_repository_impl(ctx):
468468
if iso_date:
469469
rustfmt_iso_date = iso_date
470470
else:
471-
fail("`rustfmt_version` does not include an iso_date. The following reposiotry should either set `iso_date` or update `rustfmt_version` to include an iso_date suffix: {}".format(
471+
fail("`rustfmt_version` does not include an iso_date. The following repository should either set `iso_date` or update `rustfmt_version` to include an iso_date suffix: {}".format(
472472
ctx.name,
473473
))
474474
elif rustfmt_version.startswith(("nightly", "beta")):
@@ -819,7 +819,7 @@ def rust_analyzer_toolchain_repository(
819819
"""Assemble a remote rust_analyzer_toolchain target based on the given params.
820820
821821
Args:
822-
name (str): The name of the toolchain proxy repository contianing the registerable toolchain.
822+
name (str): The name of the toolchain proxy repository containing the registerable toolchain.
823823
version (str): The version of the tool among "nightly", "beta', or an exact version.
824824
exec_compatible_with (list, optional): A list of constraints for the execution platform for this toolchain.
825825
target_compatible_with (list, optional): A list of constraints for the target platform for this toolchain.
@@ -963,7 +963,7 @@ def rustfmt_toolchain_repository(
963963
"""Assemble a remote rustfmt_toolchain target based on the given params.
964964
965965
Args:
966-
name (str): The name of the toolchain proxy repository contianing the registerable toolchain.
966+
name (str): The name of the toolchain proxy repository containing the registerable toolchain.
967967
version (str): The version of the tool among "nightly", "beta', or an exact version.
968968
exec_triple (str): The platform triple Rustfmt is expected to run on.
969969
exec_compatible_with (list, optional): A list of constraints for the execution platform for this toolchain.
@@ -1058,7 +1058,7 @@ def _get_toolchain_repositories(
10581058
- name: The name of the toolchain repository.
10591059
- target_triple: The target triple of the toolchain.
10601060
- channel: The toolchain channel (nightly/stable).
1061-
- target_constraints: Bazel constrants assicated with the toolchain.
1061+
- target_constraints: Bazel constraints associated with the toolchain.
10621062
"""
10631063
extra_target_triples_list = extra_target_triples.keys() if type(extra_target_triples) == "dict" else extra_target_triples
10641064

@@ -1146,7 +1146,7 @@ def rust_repository_set(
11461146
11471147
Args:
11481148
name (str): The name of the generated repository
1149-
versions (list, optional): A list of toolchain versions to download. This paramter only accepts one versions
1149+
versions (list, optional): A list of toolchain versions to download. This parameter only accepts one versions
11501150
per channel. E.g. `["1.65.0", "nightly/2022-11-02", "beta/2020-12-30"]`.
11511151
exec_triple (str): The Rust-style target that this compiler runs on
11521152
target_settings (list of labels as strings, optional): A list of config_settings that must be satisfied by the target configuration in order for this set of toolchains to be selected during toolchain resolution.
@@ -1163,7 +1163,7 @@ def rust_repository_set(
11631163
Requires version to be "nightly".
11641164
extra_rustc_flags (dict, list, optional): Dictionary of target triples to list of extra flags to pass to rustc in non-exec configuration.
11651165
extra_exec_rustc_flags (list, optional): Extra flags to pass to rustc in exec configuration.
1166-
opt_level (dict, dict, optional): Dictionary of target triples to optimiztion config.
1166+
opt_level (dict, dict, optional): Dictionary of target triples to optimization config.
11671167
strip_level (dict, dict, optional): Dictionary of target triples to strip config.
11681168
sha256s (str, optional): A dict associating tool subdirectories to sha256 hashes. See
11691169
[rust_register_toolchains](#rust_register_toolchains) for more details.
@@ -1182,7 +1182,7 @@ def rust_repository_set(
11821182
toolchains. This is to avoid MAX_PATH issues.
11831183
11841184
Returns:
1185-
dict[str, dict]: A dict of informations about all generated toolchains.
1185+
dict[str, dict]: A dict of information about all generated toolchains.
11861186
"""
11871187

11881188
all_toolchain_details = {}

0 commit comments

Comments
 (0)