Skip to content

setup typos check in CI #134006

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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This workflow runs spellcheck job

name: Spellcheck
on:
pull_request:
branches:
- "**"

jobs:
spellcheck:
name: run spellchecker
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v4

- name: check typos
# sync version with src/tools/tidy/src/ext_tool_checks.rs
uses: crate-ci/[email protected]
with:
# sync target files with src/tools/tidy/src/ext_tool_checks.rs
files: ./compiler ./library ./src/bootstrap ./src/librustdoc
config: ./typos.toml
1 change: 1 addition & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ path = [
"rustfmt.toml",
"rust-bors.toml",
"triagebot.toml",
"typos.toml",
"x",
"x.ps1",
"x.py",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1245,7 +1245,7 @@
}
}

/// Returns an expression with (when possible) *one* outter brace removed
/// Returns an expression with (when possible) *one* outter outter brace removed

Check warning on line 1248 in compiler/rustc_ast/src/ast.rs

View workflow job for this annotation

GitHub Actions / run spellchecker

"outter" should be "outer".

Check warning on line 1248 in compiler/rustc_ast/src/ast.rs

View workflow job for this annotation

GitHub Actions / run spellchecker

"outter" should be "outer".
pub fn maybe_unwrap_block(&self) -> &Expr {
if let ExprKind::Block(block, None) = &self.kind
&& let [stmt] = block.stmts.as_slice()
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let ret = self.arena.alloc_from_iter(lowered_attrs);

// this is possible if an item contained syntactical attribute,
// but none of them parse succesfully or all of them were ignored
// but none of them parse successfully or all of them were ignored
// for not being built-in attributes at all. They could be remaining
// unexpanded attributes used as markers in proc-macro derives for example.
// This will have emitted some diagnostics for the misparse, but will then
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub(crate) trait AttributeParser: Default + 'static {
pub(crate) trait SingleAttributeParser: 'static {
const PATH: &'static [rustc_span::Symbol];

/// Caled when a duplicate attribute is found.
/// Called when a duplicate attribute is found.
///
/// `first_span` is the span of the first occurrence of this attribute.
// FIXME(jdonszelmann): default error
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/builder/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ fn generate_enzyme_call<'ll>(
let call = builder.call(enzyme_ty, ad_fn, &args, None);

// This part is a bit iffy. LLVM requires that a call to an inlineable function has some
// metadata attachted to it, but we just created this code oota. Given that the
// metadata attached to it, but we just created this code oota. Given that the
// differentiated function already has partly confusing metadata, and given that this
// affects nothing but the auttodiff IR, we take a shortcut and just steal metadata from the
// dummy code which we inserted at a higher level.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ unsafe extern "C" {
pub(crate) fn LLVMDumpValue(V: &Value);
pub(crate) fn LLVMGetFunctionCallConv(F: &Value) -> c_uint;
pub(crate) fn LLVMGetReturnType(T: &Type) -> &Type;
pub(crate) fn LLVMGetParams(Fnc: &Value, parms: *mut &Value);
pub(crate) fn LLVMGetParams(Fnc: &Value, params: *mut &Value);
pub(crate) fn LLVMGetNamedFunction(M: &Module, Name: *const c_char) -> Option<&Value>;
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/va_arg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ fn emit_xtensa_va_arg<'ll, 'tcx>(

// On big-endian, for values smaller than the slot size we'd have to align the read to the end
// of the slot rather than the start. While the ISA and GCC support big-endian, all the Xtensa
// targets supported by rustc are litte-endian so don't worry about it.
// targets supported by rustc are little-endian so don't worry about it.

// if from_regsave {
// unsafe { *regsave_value_ptr }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ codegen_ssa_thorin_missing_referenced_unit = unit {$unit} referenced by executab

codegen_ssa_thorin_missing_required_section = input object missing required section `{$section}`

codegen_ssa_thorin_mixed_input_encodings = input objects haved mixed encodings
codegen_ssa_thorin_mixed_input_encodings = input objects have mixed encodings

codegen_ssa_thorin_multiple_debug_info_section = multiple `.debug_info.dwo` sections

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2777,7 +2777,7 @@ fn add_upstream_rust_crates(

if sess.target.is_like_aix {
// Unlike ELF linkers, AIX doesn't feature `DT_SONAME` to override
// the dependency name when outputing a shared library. Thus, `ld` will
// the dependency name when outputting a shared library. Thus, `ld` will
// use the full path to shared libraries as the dependency if passed it
// by default unless `noipath` is passed.
// https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command.
Expand Down Expand Up @@ -3061,7 +3061,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
// Supported architecture names can be found in the source:
// https://github.com/apple-oss-distributions/ld64/blob/ld64-951.9/src/abstraction/MachOFileAbstraction.hpp#L578-L648
//
// Intentially verbose to ensure that the list always matches correctly
// Intentionally verbose to ensure that the list always matches correctly
// with the list in the source above.
let ld64_arch = match llvm_arch {
"armv7k" => "armv7k",
Expand Down Expand Up @@ -3129,7 +3129,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
// We do not currently know the actual SDK version though, so we have a few options:
// 1. Use the minimum version supported by rustc.
// 2. Use the same as the deployment target.
// 3. Use an arbitary recent version.
// 3. Use an arbitrary recent version.
// 4. Omit the version.
//
// The first option is too low / too conservative, and means that users will not get the
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
[sym::arm, sym::a32 | sym::t32]
if !tcx.sess.target.has_thumb_interworking =>
{
tcx.dcx().emit_err(errors::UnsuportedInstructionSet {
tcx.dcx().emit_err(errors::UnsupportedInstructionSet {
span: attr.span(),
});
None
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub(crate) struct NullOnExport {

#[derive(Diagnostic)]
#[diag(codegen_ssa_unsupported_instruction_set, code = E0779)]
pub(crate) struct UnsuportedInstructionSet {
pub(crate) struct UnsupportedInstructionSet {
#[primary_span]
pub span: Span,
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub(crate) fn provide(providers: &mut Providers) {
// The stability in the entry is at least as good as the new one, just keep it.
}
_ => {
// Overwrite stabilite.
// Overwrite stability.
occupied_entry.insert(stability);
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/traits/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub trait BuilderMethods<'a, 'tcx>:
//
// This function is opt-in for back ends.
//
// The default implementation calls `self.expect()` before emiting the branch
// The default implementation calls `self.expect()` before emitting the branch
// by calling `self.cond_br()`
fn cond_br_with_expect(
&mut self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn check_validity_requirement_strict<'tcx>(
// require dereferenceability also require non-null, we don't actually get any false negatives
// due to this.
// The value we are validating is temporary and discarded at the end of this function, so
// there is no point in reseting provenance and padding.
// there is no point in resetting provenance and padding.
cx.validate_operand(
&allocated.into(),
/*recursive*/ false,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/vec_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ unsafe impl<K: Idx, #[may_dangle] V, I> Drop for VecCache<K, V, I> {
// we are also guaranteed to just need to deallocate any large arrays (not iterate over
// contents).
//
// Confirm no need to deallocate invidual entries. Note that `V: Copy` is asserted on
// Confirm no need to deallocate individual entries. Note that `V: Copy` is asserted on
// insert/lookup but not necessarily construction, primarily to avoid annoyingly propagating
// the bounds into struct definitions everywhere.
assert!(!std::mem::needs_drop::<K>());
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/markdown/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ fn normalize<'a>(MdStream(stream): MdStream<'a>, linkdefs: &mut Vec<MdTree<'a>>)
let new_defs = stream.iter().filter(|tt| matches!(tt, MdTree::LinkDef { .. }));
linkdefs.extend(new_defs.cloned());

// Run plaintest expansions on types that need it, call this function on nested types
// Run plaintext expansions on types that need it, call this function on nested types
for item in stream {
match item {
MdTree::PlainText(txt) => expand_plaintext(txt, &mut new_stream, MdTree::PlainText),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ declare_features! (
(accepted, self_in_typedefs, "1.32.0", Some(49303)),
/// Allows `Self` struct constructor (RFC 2302).
(accepted, self_struct_ctor, "1.32.0", Some(51994)),
/// Shortern the tail expression lifetime
/// Shorten the tail expression lifetime
(accepted, shorter_tail_lifetimes, "1.84.0", Some(123739)),
/// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`.
(accepted, slice_patterns, "1.42.0", Some(62254)),
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ impl<'hir> ConstArg<'hir, AmbigArg> {
}

impl<'hir> ConstArg<'hir> {
/// Converts a `ConstArg` in an unambigous position to one in an ambiguous position. This is
/// Converts a `ConstArg` in an unambiguous position to one in an ambiguous position. This is
/// fallible as the [`ConstArgKind::Infer`] variant is not present in ambiguous positions.
///
/// Functions accepting ambiguous consts will not handle the [`ConstArgKind::Infer`] variant, if
Expand Down Expand Up @@ -368,7 +368,7 @@ pub enum GenericArg<'hir> {
Lifetime(&'hir Lifetime),
Type(&'hir Ty<'hir, AmbigArg>),
Const(&'hir ConstArg<'hir, AmbigArg>),
/// Inference variables in [`GenericArg`] are always represnted by
/// Inference variables in [`GenericArg`] are always represented by
/// `GenericArg::Infer` instead of the `Infer` variants on [`TyKind`] and
/// [`ConstArgKind`] as it is not clear until hir ty lowering whether a
/// `_` argument is a type or const argument.
Expand Down Expand Up @@ -3147,7 +3147,7 @@ impl<'hir> Ty<'hir, AmbigArg> {
}

impl<'hir> Ty<'hir> {
/// Converts a `Ty` in an unambigous position to one in an ambiguous position. This is
/// Converts a `Ty` in an unambiguous position to one in an ambiguous position. This is
/// fallible as the [`TyKind::Infer`] variant is not present in ambiguous positions.
///
/// Functions accepting ambiguous types will not handle the [`TyKind::Infer`] variant, if
Expand Down Expand Up @@ -4045,7 +4045,7 @@ impl fmt::Display for Constness {
}
}

/// The actualy safety specified in syntax. We may treat
/// The actually safety specified in syntax. We may treat
/// its safety different within the type system to create a
/// "sound by default" system that needs checking this enum
/// explicitly to allow unsafe operations.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ hir_analysis_trait_object_declared_with_no_traits =
at least one trait is required for an object type
.alias_span = this alias does not contain a trait

hir_analysis_traits_with_defualt_impl = traits with a default impl, like `{$traits}`, cannot be implemented for {$problematic_kind} `{$self_ty}`
hir_analysis_traits_with_default_impl = traits with a default impl, like `{$traits}`, cannot be implemented for {$problematic_kind} `{$self_ty}`
.note = a trait object implements `{$traits}` if and only if `{$traits}` is one of the trait object's trait bounds

hir_analysis_transparent_enum_variant = transparent enum needs exactly one variant, but has {$number}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ pub(crate) struct ImplForTyRequires {
}

#[derive(Diagnostic)]
#[diag(hir_analysis_traits_with_defualt_impl, code = E0321)]
#[diag(hir_analysis_traits_with_default_impl, code = E0321)]
#[note]
pub(crate) struct TraitsWithDefaultImpl<'a> {
#[primary_span]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
);

// FIXME(#97583): Print associated item bindings properly (i.e., not as equality predicates!).
// FIXME: Turn this into a structured, translateable & more actionable suggestion.
// FIXME: Turn this into a structured, translatable & more actionable suggestion.
let mut where_bounds = vec![];
for bound in [bound, bound2].into_iter().chain(matching_candidates) {
let bound_id = bound.def_id();
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let mut deferred_repeat_expr_checks = self.deferred_repeat_expr_checks.borrow_mut();
debug!("FnCtxt::check_repeat_exprs: {} deferred checks", deferred_repeat_expr_checks.len());
for (element, element_ty, count) in deferred_repeat_expr_checks.drain(..) {
// We want to emit an error if the const is not structurally resolveable as otherwise
// We want to emit an error if the const is not structurally resolvable as otherwise
// we can find up conservatively proving `Copy` which may infer the repeat expr count
// to something that never required `Copy` in the first place.
let count =
Expand Down Expand Up @@ -2399,7 +2399,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}

if !mismatched_params.is_empty() {
// For each mismatched paramter, create a two-way link to each matched parameter
// For each mismatched parameter, create a two-way link to each matched parameter
// of the same type.
let mut dependants = IndexVec::<ExpectedIdx, _>::from_fn_n(
|_| SmallVec::<[u32; 4]>::new(),
Expand Down Expand Up @@ -2442,7 +2442,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
spans.push_span_label(param.param.span(), "");
}
}
// Highligh each parameter being depended on for a generic type.
// Highlight each parameter being depended on for a generic type.
for ((&(_, param), deps), &(_, expected_ty)) in
params_with_generics.iter().zip(&dependants).zip(formal_and_expected_inputs)
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// This is maximally flexible, allowing e.g., `Some(mut x) | &Some(mut x)`.
// In that example, `Some(mut x)` results in `Peel` whereas `&Some(mut x)` in `Reset`.
| PatKind::Or(_)
// Like or-patterns, guard patterns just propogate to their subpatterns.
// Like or-patterns, guard patterns just propagate to their subpatterns.
| PatKind::Guard(..) => AdjustMode::Pass,
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>(
feed.output_filenames(Arc::new(outputs));

let res = f(tcx);
// FIXME maybe run finish even when a fatal error occured? or at least tcx.alloc_self_profile_query_strings()?
// FIXME maybe run finish even when a fatal error occurred? or at least tcx.alloc_self_profile_query_strings()?
tcx.finish();
res
},
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/default_could_be_derived.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultCouldBeDerived {
// }
// }
// where `something()` would have to be a call or path.
// We have nothing meaninful to do with this.
// We have nothing meaningful to do with this.
return;
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/if_let_rescope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl IfLetRescope {
}
}
}
// At this point, any `if let` fragment in the cascade is definitely preceeded by `else`,
// At this point, any `if let` fragment in the cascade is definitely preceded by `else`,
// so a opening bracket is mandatory before each `match`.
add_bracket_to_match_head = true;
if let Some(alt) = alt {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ declare_lint! {
///
/// ### Explanation
///
/// A public `use` declaration should not be used to publicly re-export a
/// A public `use` declaration should not be used to publically re-export a
/// private `extern crate`. `pub extern crate` should be used instead.
///
/// This was historically allowed, but is not the intended behavior
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ decl_derive! {
[PrintAttribute] =>
/// Derives `PrintAttribute` for `AttributeKind`.
/// This macro is pretty specific to `rustc_attr_data_structures` and likely not that useful in
/// other places. It's deriving something close to `Debug` without printing some extraenous
/// other places. It's deriving something close to `Debug` without printing some extraneous
/// things like spans.
print_attribute::print_attribute
}
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ pub struct Body<'tcx> {
/// us to see the difference and forego optimization on the inlined promoted items.
pub phase: MirPhase,

/// How many passses we have executed since starting the current phase. Used for debug output.
/// How many passes we have executed since starting the current phase. Used for debug output.
pub pass_count: usize,

pub source: MirSource<'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub enum StatementKind<'tcx> {
/// computing these locals.
///
/// If the local is already allocated, calling `StorageLive` again will implicitly free the
/// local and then allocate fresh uninitilized memory. If a local is already deallocated,
/// local and then allocate fresh uninitialized memory. If a local is already deallocated,
/// calling `StorageDead` again is a NOP.
StorageLive(Local),

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ rustc_queries! {
/// Returns whether the type alias given by `DefId` is lazy.
///
/// I.e., if the type alias expands / ought to expand to a [weak] [alias type]
/// instead of the underyling aliased type.
/// instead of the underlying aliased type.
///
/// Relevant for features `lazy_type_alias` and `type_alias_impl_trait`.
///
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/significant_drop_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn true_significant_drop_ty<'tcx>(
}
}

/// Returns the list of types with a "potentially sigificant" that may be dropped
/// Returns the list of types with a "potentially significant" that may be dropped
/// by dropping a value of type `ty`.
#[instrument(level = "trace", skip(tcx, typing_env))]
pub fn extract_component_raw<'tcx>(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ impl<'tcx> Ty<'tcx> {
/// This is particularly useful for getting the type of the result of
/// [`UnOp::PtrMetadata`](crate::mir::UnOp::PtrMetadata).
///
/// Panics if `self` is not dereferencable.
/// Panics if `self` is not dereferenceable.
#[track_caller]
pub fn pointee_metadata_ty_or_projection(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
let Some(pointee_ty) = self.builtin_deref(true) else {
Expand Down
Loading
Loading