diff --git a/RELEASES.md b/RELEASES.md
index 6aba476103e7f..802f03d719d58 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -556,7 +556,7 @@ Language
- [Undeprecate lint `unstable_features` and make use of it in the compiler.](https://github.com/rust-lang/rust/pull/118639/)
- [Make inductive cycles in coherence ambiguous always.](https://github.com/rust-lang/rust/pull/118649/)
- [Get rid of type-driven traversal in const-eval interning](https://github.com/rust-lang/rust/pull/119044/),
- only as a [future compatiblity lint](https://github.com/rust-lang/rust/pull/122204) for now.
+ only as a [future compatibility lint](https://github.com/rust-lang/rust/pull/122204) for now.
- [Deny braced macro invocations in let-else.](https://github.com/rust-lang/rust/pull/119062/)
diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs
index 800773482041a..ac527df474aff 100644
--- a/compiler/rustc_ast_lowering/src/delegation.rs
+++ b/compiler/rustc_ast_lowering/src/delegation.rs
@@ -72,7 +72,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
fn has_self(&self, def_id: DefId, span: Span) -> bool {
if let Some(local_sig_id) = def_id.as_local() {
// The value may be missing due to recursive delegation.
- // Error will be emmited later during HIR ty lowering.
+ // Error will be emitted later during HIR ty lowering.
self.resolver.delegation_fn_sigs.get(&local_sig_id).map_or(false, |sig| sig.has_self)
} else {
match self.tcx.def_kind(def_id) {
@@ -139,7 +139,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
fn param_count(&self, sig_id: DefId) -> (usize, bool /*c_variadic*/) {
if let Some(local_sig_id) = sig_id.as_local() {
// Map may be filled incorrectly due to recursive delegation.
- // Error will be emmited later during HIR ty lowering.
+ // Error will be emitted later during HIR ty lowering.
match self.resolver.delegation_fn_sigs.get(&local_sig_id) {
Some(sig) => (sig.param_count, sig.c_variadic),
None => (0, false),
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
index 9951f9fcda69c..c817b6fac7134 100644
--- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
@@ -1179,7 +1179,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
for field in &variant.fields {
// In practice unless there are more than one field with the same type, we'll be
// suggesting a single field at a type, because we don't aggregate multiple borrow
- // checker errors involving the functional record update sytnax into a single one.
+ // checker errors involving the functional record update syntax into a single one.
let field_ty = field.ty(self.infcx.tcx, args);
let ident = field.ident(self.infcx.tcx);
if field_ty == ty && fields.iter().all(|field| field.ident.name != ident.name) {
diff --git a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs
index de3ff8378bcc7..6186904e5fbb6 100644
--- a/compiler/rustc_borrowck/src/type_check/liveness/trace.rs
+++ b/compiler/rustc_borrowck/src/type_check/liveness/trace.rs
@@ -218,7 +218,7 @@ impl<'a, 'me, 'typeck, 'flow, 'tcx> LivenessResults<'a, 'me, 'typeck, 'flow, 'tc
// This collect is more necessary than immediately apparent
// because these facts go into `add_drop_live_facts_for()`,
// which also writes to `all_facts`, and so this is genuinely
- // a simulatneous overlapping mutable borrow.
+ // a simultaneous overlapping mutable borrow.
// FIXME for future hackers: investigate whether this is
// actually necessary; these facts come from Polonius
// and probably maybe plausibly does not need to go back in.
diff --git a/compiler/rustc_codegen_gcc/src/debuginfo.rs b/compiler/rustc_codegen_gcc/src/debuginfo.rs
index d770da5a8c44f..c2adca34748d6 100644
--- a/compiler/rustc_codegen_gcc/src/debuginfo.rs
+++ b/compiler/rustc_codegen_gcc/src/debuginfo.rs
@@ -51,7 +51,7 @@ impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> {
}
/// Generate the `debug_context` in an MIR Body.
-/// # Souce of Origin
+/// # Source of Origin
/// Copied from `create_scope_map.rs` of rustc_codegen_llvm
fn compute_mir_scopes<'gcc, 'tcx>(
cx: &CodegenCx<'gcc, 'tcx>,
@@ -86,7 +86,7 @@ fn compute_mir_scopes<'gcc, 'tcx>(
/// Update the `debug_context`, adding new scope to it,
/// if it's not added as is denoted in `instantiated`.
///
-/// # Souce of Origin
+/// # Source of Origin
/// Copied from `create_scope_map.rs` of rustc_codegen_llvm
/// FIXME(tempdragon/?): Add Scope Support Here.
fn make_mir_scope<'gcc, 'tcx>(
diff --git a/compiler/rustc_codegen_gcc/src/lib.rs b/compiler/rustc_codegen_gcc/src/lib.rs
index 94f016234f921..7b0d594ddc167 100644
--- a/compiler/rustc_codegen_gcc/src/lib.rs
+++ b/compiler/rustc_codegen_gcc/src/lib.rs
@@ -357,7 +357,7 @@ impl Deref for SyncContext {
unsafe impl Send for SyncContext {}
// FIXME(antoyo): that shouldn't be Sync. Parallel compilation is currently disabled with "-Zno-parallel-llvm".
-// TODO: disable it here by returing false in CodegenBackend::supports_parallel().
+// TODO: disable it here by returning false in CodegenBackend::supports_parallel().
unsafe impl Sync for SyncContext {}
impl WriteBackendMethods for GccCodegenBackend {
diff --git a/compiler/rustc_codegen_gcc/tools/generate_intrinsics.py b/compiler/rustc_codegen_gcc/tools/generate_intrinsics.py
index 90fb7bfad27c3..8efed3e43af85 100644
--- a/compiler/rustc_codegen_gcc/tools/generate_intrinsics.py
+++ b/compiler/rustc_codegen_gcc/tools/generate_intrinsics.py
@@ -45,7 +45,7 @@ def convert_to_string(content):
return content
-def extract_instrinsics_from_llvm(llvm_path, intrinsics):
+def extract_intrinsics_from_llvm(llvm_path, intrinsics):
command = ["llvm-tblgen", "llvm/IR/Intrinsics.td"]
cwd = os.path.join(llvm_path, "llvm/include")
print("=> Running command `{}` from `{}`".format(command, cwd))
@@ -88,7 +88,7 @@ def append_translation(json_data, p, array):
append_intrinsic(array, content[1], content[3])
-def extract_instrinsics_from_llvmint(llvmint, intrinsics):
+def extract_intrinsics_from_llvmint(llvmint, intrinsics):
archs = [
"AMDGPU",
"aarch64",
@@ -152,9 +152,9 @@ def update_intrinsics(llvm_path, llvmint, llvmint2):
intrinsics_llvmint = {}
all_intrinsics = {}
- extract_instrinsics_from_llvm(llvm_path, intrinsics_llvm)
- extract_instrinsics_from_llvmint(llvmint, intrinsics_llvmint)
- extract_instrinsics_from_llvmint(llvmint2, intrinsics_llvmint)
+ extract_intrinsics_from_llvm(llvm_path, intrinsics_llvm)
+ extract_intrinsics_from_llvmint(llvmint, intrinsics_llvmint)
+ extract_intrinsics_from_llvmint(llvmint2, intrinsics_llvmint)
intrinsics = {}
# We give priority to translations from LLVM over the ones from llvmint.
diff --git a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
index 069b62af5e748..b5acfabfde25e 100644
--- a/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
+++ b/compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
@@ -422,7 +422,7 @@ fn prepare_usage_sets<'tcx>(tcx: TyCtxt<'tcx>) -> UsageSets<'tcx> {
(instance.def_id(), body)
});
- // Functions whose coverage statments were found inlined into other functions.
+ // Functions whose coverage statements were found inlined into other functions.
let mut used_via_inlining = FxHashSet::default();
// Functions that were instrumented, but had all of their coverage statements
// removed by later MIR transforms (e.g. UnreachablePropagation).
diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
index f0bc4354f9a75..5103b2f31582b 100644
--- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
+++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
@@ -701,7 +701,7 @@ fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: ty::Const<'tcx>, output: &mut S
match ty.kind() {
ty::Int(ity) => {
// FIXME: directly extract the bits from a valtree instead of evaluating an
- // alreay evaluated `Const` in order to get the bits.
+ // already evaluated `Const` in order to get the bits.
let bits = ct.eval_bits(tcx, ty::ParamEnv::reveal_all());
let val = Integer::from_int_ty(&tcx, *ity).size().sign_extend(bits) as i128;
write!(output, "{val}")
diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs
index 61e8007e10ecf..82438eb5e7828 100644
--- a/compiler/rustc_const_eval/src/interpret/call.rs
+++ b/compiler/rustc_const_eval/src/interpret/call.rs
@@ -20,7 +20,7 @@ use super::{
};
use crate::fluent_generated as fluent;
-/// An argment passed to a function.
+/// An argument passed to a function.
#[derive(Clone, Debug)]
pub enum FnArg<'tcx, Prov: Provenance = CtfeProvenance> {
/// Pass a copy of the given operand.
@@ -123,7 +123,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
self.tcx.has_attr(def.did(), sym::rustc_nonnull_optimization_guaranteed)
};
let inner = self.unfold_transparent(inner, /* may_unfold */ |def| {
- // Stop at NPO tpyes so that we don't miss that attribute in the check below!
+ // Stop at NPO types so that we don't miss that attribute in the check below!
def.is_struct() && !is_npo(def)
});
Ok(match inner.ty.kind() {
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index 7a6bbdfdcb5e5..dd744c51f23be 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -574,7 +574,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
// be computed as the type references non-existing names.
// See .
} else {
- // Looks like the const is not captued by `required_consts`, that's bad.
+ // Looks like the const is not captured by `required_consts`, that's bad.
span_bug!(span, "interpret const eval failure of {val:?} which is not in required_consts");
}
}
diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs
index 97326fe99a21a..45a5eb9bd52fc 100644
--- a/compiler/rustc_const_eval/src/interpret/memory.rs
+++ b/compiler/rustc_const_eval/src/interpret/memory.rs
@@ -827,7 +827,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
let (size, align) = if nested {
// Nested anonymous statics are untyped, so let's get their
- // size and alignment from the allocaiton itself. This always
+ // size and alignment from the allocation itself. This always
// succeeds, as the query is fed at DefId creation time, so no
// evaluation actually occurs.
let alloc = self.tcx.eval_static_initializer(def_id).unwrap();
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs
index ede6a51c712b9..d7d033e516295 100644
--- a/compiler/rustc_const_eval/src/interpret/place.rs
+++ b/compiler/rustc_const_eval/src/interpret/place.rs
@@ -186,7 +186,7 @@ pub(super) enum Place {
/// `Local` places always refer to the current stack frame, so they are unstable under
/// function calls/returns and switching betweens stacks of different threads!
/// We carry around the address of the `locals` buffer of the correct stack frame as a sanity
- /// chec to be able to catch some cases of using a dangling `Place`.
+ /// check to be able to catch some cases of using a dangling `Place`.
///
/// This variant shall not be used for unsized types -- those must always live in memory.
Local { local: mir::Local, offset: Option, locals_addr: usize },
diff --git a/compiler/rustc_const_eval/src/interpret/stack.rs b/compiler/rustc_const_eval/src/interpret/stack.rs
index 0f6bf5c03364c..b6e83715e3989 100644
--- a/compiler/rustc_const_eval/src/interpret/stack.rs
+++ b/compiler/rustc_const_eval/src/interpret/stack.rs
@@ -1,5 +1,5 @@
//! Manages the low-level pushing and popping of stack frames and the (de)allocation of local variables.
-//! For hadling of argument passing and return values, see the `call` module.
+//! For handling of argument passing and return values, see the `call` module.
use std::cell::Cell;
use std::{fmt, mem};
diff --git a/compiler/rustc_data_structures/src/base_n.rs b/compiler/rustc_data_structures/src/base_n.rs
index 1c2321623e491..0c3d7613d4f1f 100644
--- a/compiler/rustc_data_structures/src/base_n.rs
+++ b/compiler/rustc_data_structures/src/base_n.rs
@@ -42,7 +42,7 @@ impl fmt::Display for BaseNString {
}
// This trait just lets us reserve the exact right amount of space when doing fixed-length
-// case-insensitve encoding. Add any impls you need.
+// case-insensitive encoding. Add any impls you need.
pub trait ToBaseN: Into {
fn encoded_len(base: usize) -> usize;
diff --git a/compiler/rustc_data_structures/src/graph/scc/mod.rs b/compiler/rustc_data_structures/src/graph/scc/mod.rs
index 2a457ffb70b08..06fedef00fc3f 100644
--- a/compiler/rustc_data_structures/src/graph/scc/mod.rs
+++ b/compiler/rustc_data_structures/src/graph/scc/mod.rs
@@ -477,7 +477,7 @@ where
// will know when we hit the state where previous_node == node.
loop {
// Back at the beginning, we can return. Note that we return the root state.
- // This is becuse for components being explored, we would otherwise get a
+ // This is because for components being explored, we would otherwise get a
// `node_state[n] = InCycleWith{ parent: n }` and that's wrong.
if previous_node == node {
return root_state;
diff --git a/compiler/rustc_data_structures/src/hashes.rs b/compiler/rustc_data_structures/src/hashes.rs
index f98c8de1eb097..8f4639fc2e666 100644
--- a/compiler/rustc_data_structures/src/hashes.rs
+++ b/compiler/rustc_data_structures/src/hashes.rs
@@ -3,11 +3,11 @@
//! or 16 bytes of the hash.
//!
//! The types in this module represent 64-bit or 128-bit hashes produced by a `StableHasher`.
-//! `Hash64` and `Hash128` expose some utilty functions to encourage users to not extract the inner
+//! `Hash64` and `Hash128` expose some utility functions to encourage users to not extract the inner
//! hash value as an integer type and accidentally apply varint encoding to it.
//!
//! In contrast with `Fingerprint`, users of these types cannot and should not attempt to construct
-//! and decompose these types into constitutent pieces. The point of these types is only to
+//! and decompose these types into constituent pieces. The point of these types is only to
//! connect the fact that they can only be produced by a `StableHasher` to their
//! `Encode`/`Decode` impls.
diff --git a/compiler/rustc_data_structures/src/sync/worker_local.rs b/compiler/rustc_data_structures/src/sync/worker_local.rs
index 4950481d311f0..b6efcada10b77 100644
--- a/compiler/rustc_data_structures/src/sync/worker_local.rs
+++ b/compiler/rustc_data_structures/src/sync/worker_local.rs
@@ -19,7 +19,7 @@ impl RegistryId {
/// index within the registry. This panics if the current thread is not associated with this
/// registry.
///
- /// Note that there's a race possible where the identifer in `THREAD_DATA` could be reused
+ /// Note that there's a race possible where the identifier in `THREAD_DATA` could be reused
/// so this can succeed from a different registry.
#[cfg(parallel_compiler)]
fn verify(self) -> usize {
@@ -50,7 +50,7 @@ struct ThreadData {
}
thread_local! {
- /// A thread local which contains the identifer of `REGISTRY` but allows for faster access.
+ /// A thread local which contains the identifier of `REGISTRY` but allows for faster access.
/// It also holds the index of the current thread.
static THREAD_DATA: ThreadData = const { ThreadData {
registry_id: Cell::new(RegistryId(ptr::null())),
@@ -66,7 +66,7 @@ impl Registry {
/// Gets the registry associated with the current thread. Panics if there's no such registry.
pub fn current() -> Self {
- REGISTRY.with(|registry| registry.get().cloned().expect("No assocated registry"))
+ REGISTRY.with(|registry| registry.get().cloned().expect("No associated registry"))
}
/// Registers the current thread with the registry so worker locals can be used on it.
@@ -92,7 +92,7 @@ impl Registry {
}
}
- /// Gets the identifer of this registry.
+ /// Gets the identifier of this registry.
fn id(&self) -> RegistryId {
RegistryId(&*self.0)
}
diff --git a/compiler/rustc_error_codes/src/error_codes/E0582.md b/compiler/rustc_error_codes/src/error_codes/E0582.md
index b2cdb509c95c0..c4aaa17706add 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0582.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0582.md
@@ -44,7 +44,7 @@ where
```
The latter scenario encounters this error because `Foo::Assoc<'a>` could be
implemented by a type that does not use the `'a` parameter, so there is no
-guarentee that `X::Assoc<'a>` actually uses `'a`.
+guarantee that `X::Assoc<'a>` actually uses `'a`.
To fix this we can pass a dummy parameter:
```
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 3303e4ee752c2..41a94cc2b6fde 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -484,7 +484,7 @@ pub struct Subdiag {
/// - The `EmissionGuarantee`, which determines the type returned from `emit`.
///
/// Each constructed `Diag` must be consumed by a function such as `emit`,
-/// `cancel`, `delay_as_bug`, or `into_diag`. A panic occurrs if a `Diag`
+/// `cancel`, `delay_as_bug`, or `into_diag`. A panic occurs if a `Diag`
/// is dropped without being consumed by one of these functions.
///
/// If there is some state in a downstream crate you would like to access in
diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 2bc29dabd18a1..2b135df91a4bb 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -2300,7 +2300,7 @@ impl HumanEmitter {
// For example, for the following:
// |
// 2 - .await
- // 2 + (note the left over whitepsace)
+ // 2 + (note the left over whitespace)
// |
// We really want
// |
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs
index 99ee8fb17d7dc..27f9e2249b337 100644
--- a/compiler/rustc_errors/src/lib.rs
+++ b/compiler/rustc_errors/src/lib.rs
@@ -817,7 +817,7 @@ impl<'a> DiagCtxtHandle<'a> {
);
}
// We delay a bug here so that `-Ztreat-err-as-bug -Zeagerly-emit-delayed-bugs`
- // can be used to create a backtrace at the stashing site insted of whenever the
+ // can be used to create a backtrace at the stashing site instead of whenever the
// diagnostic context is dropped and thus delayed bugs are emitted.
Error => Some(self.span_delayed_bug(span, format!("stashing {key:?}"))),
DelayedBug => {
diff --git a/compiler/rustc_errors/src/markdown/parse.rs b/compiler/rustc_errors/src/markdown/parse.rs
index b1db44dd215b8..8dd146c1c337f 100644
--- a/compiler/rustc_errors/src/markdown/parse.rs
+++ b/compiler/rustc_errors/src/markdown/parse.rs
@@ -487,7 +487,7 @@ fn is_break_ty(val: &MdTree<'_>) -> bool {
|| matches!(val, MdTree::PlainText(txt) if txt.trim().is_empty())
}
-/// Perform tranformations to text. This splits paragraphs, replaces patterns,
+/// Perform transformations to text. This splits paragraphs, replaces patterns,
/// and corrects newlines.
///
/// To avoid allocating strings (and using a different heavier tt type), our
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs
index 7ea037ca8b2b6..01597bd45bd9f 100644
--- a/compiler/rustc_feature/src/unstable.rs
+++ b/compiler/rustc_feature/src/unstable.rs
@@ -248,7 +248,7 @@ declare_features! (
/// Allows using the `vectorcall` ABI.
(unstable, abi_vectorcall, "1.7.0", Some(124485)),
/// Allows features specific to auto traits.
- /// Renamed from `optin_builtin_traits`.
+ /// Renamed from `option_builtin_traits`.
(unstable, auto_traits, "1.50.0", Some(13231)),
/// Allows using `box` in patterns (RFC 469).
(unstable, box_patterns, "1.0.0", Some(29641)),
@@ -585,7 +585,7 @@ declare_features! (
(unstable, rust_cold_cc, "1.63.0", Some(97544)),
/// Allows use of x86 SHA512, SM3 and SM4 target-features and intrinsics
(unstable, sha512_sm_x86, "CURRENT_RUSTC_VERSION", Some(126624)),
- /// Shortern the tail expression lifetime
+ /// Shorten the tail expression lifetime
(unstable, shorter_tail_lifetimes, "1.79.0", Some(123739)),
/// Allows the use of SIMD types in functions declared in `extern` blocks.
(unstable, simd_ffi, "1.0.0", Some(27731)),
diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
index 359b4729e50a6..f83eac7cd6c4d 100644
--- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs
+++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs
@@ -1016,7 +1016,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) -> Result<(),
sym::adt_const_params,
)])
}
- // Implments `ConstParamTy`, suggest adding the feature to enable.
+ // Implements `ConstParamTy`, suggest adding the feature to enable.
Ok(..) => Some(vec![(adt_const_params_feature_string, sym::adt_const_params)]),
};
if let Some(features) = may_suggest_feature {
diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs
index 9f01f7be80af4..30fc06829ed8e 100644
--- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs
+++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs
@@ -219,7 +219,7 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
// Later parts of the compiler rely on all DispatchFromDyn types to be ABI-compatible with raw
// pointers. This is enforced here: we only allow impls for references, raw pointers, and things
// that are effectively repr(transparent) newtypes around types that already hav a
- // DispatchedFromDyn impl. We cannot literally use repr(transparent) on those tpyes since some
+ // DispatchedFromDyn impl. We cannot literally use repr(transparent) on those types since some
// of them support an allocator, but we ensure that for the cases where the type implements this
// trait, they *do* satisfy the repr(transparent) rules, and then we assume that everything else
// in the compiler (in particular, all the call ABI logic) will treat them as repr(transparent)
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index 53105f337c4a8..92111805ab422 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -1037,7 +1037,7 @@ impl<'tcx> FieldUniquenessCheckContext<'tcx> {
/// Check the uniqueness of fields in a struct variant, and recursively
/// check the nested fields if it is an unnamed field with type of an
- /// annoymous adt.
+ /// anonymous adt.
fn check_field(&mut self, field: &hir::FieldDef<'_>) {
if field.ident.name != kw::Underscore {
self.check_field_decl(field.ident, field.span.into());
@@ -1491,7 +1491,7 @@ fn infer_return_ty_for_fn_sig<'tcx>(
Some(ty) => {
let fn_sig = tcx.typeck(def_id).liberated_fn_sigs()[hir_id];
// Typeck doesn't expect erased regions to be returned from `type_of`.
- // This is a heuristic approach. If the scope has region paramters,
+ // This is a heuristic approach. If the scope has region parameters,
// we should change fn_sig's lifetime from `ReErased` to `ReError`,
// otherwise to `ReStatic`.
let has_region_params = generics.params.iter().any(|param| match param.kind {
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs
index 70a3c744c78a2..bffe68f9b745f 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs
@@ -529,7 +529,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
/// Detect and reject early-bound & escaping late-bound generic params in the type of assoc const bindings.
///
-/// FIXME(const_generics): This is a temporary and semi-artifical restriction until the
+/// FIXME(const_generics): This is a temporary and semi-artificial restriction until the
/// arrival of *generic const generics*[^1].
///
/// It might actually be possible that we can already support early-bound generic params
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
index 36c26f91089c3..ac5bd825b18dd 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
@@ -986,7 +986,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
/// We **don't** support paths whose self type is an arbitrary type like `Struct::Ty` where
/// struct `Struct` impls an in-scope trait that defines an associated type called `Ty`.
/// For the latter case, we report ambiguity.
- /// While desirable to support, the implemention would be non-trivial. Tracked in [#22519].
+ /// While desirable to support, the implementation would be non-trivial. Tracked in [#22519].
///
/// At the time of writing, *inherent associated types* are also resolved here. This however
/// is [problematic][iat]. A proper implementation would be as non-trivial as the one
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index ac6707f931602..bd41414d8fccf 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -1085,12 +1085,12 @@ impl<'a> State<'a> {
&mut self,
qpath: &hir::QPath<'_>,
fields: &[hir::ExprField<'_>],
- wth: Option<&hir::Expr<'_>>,
+ with: Option<&hir::Expr<'_>>,
) {
self.print_qpath(qpath, true);
self.word("{");
self.commasep_cmnt(Consistent, fields, |s, field| s.print_expr_field(field), |f| f.span);
- if let Some(expr) = wth {
+ if let Some(expr) = with {
self.ibox(INDENT_UNIT);
if !fields.is_empty() {
self.word(",");
@@ -1320,8 +1320,8 @@ impl<'a> State<'a> {
hir::ExprKind::Repeat(element, ref count) => {
self.print_expr_repeat(element, count);
}
- hir::ExprKind::Struct(qpath, fields, wth) => {
- self.print_expr_struct(qpath, fields, wth);
+ hir::ExprKind::Struct(qpath, fields, with) => {
+ self.print_expr_struct(qpath, fields, with);
}
hir::ExprKind::Tup(exprs) => {
self.print_expr_tup(exprs);
diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs
index 1db2c865b4077..1e1e007862e1c 100644
--- a/compiler/rustc_hir_typeck/src/cast.rs
+++ b/compiler/rustc_hir_typeck/src/cast.rs
@@ -650,7 +650,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
// cannot distinguish. This would cause us to erroneously discard a cast which will
// lead to a borrowck error like #113257.
// We still did a coercion above to unify inference variables for `ptr as _` casts.
- // This does cause us to miss some trivial casts in the trival cast lint.
+ // This does cause us to miss some trivial casts in the trivial cast lint.
debug!(" -> PointerCast");
} else {
self.trivial_cast_lint(fcx);
diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs
index faeabdc082109..10a22eee7b74a 100644
--- a/compiler/rustc_hir_typeck/src/method/confirm.rs
+++ b/compiler/rustc_hir_typeck/src/method/confirm.rs
@@ -249,7 +249,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
}
/// Returns a set of generic parameters for the method *receiver* where all type and region
- /// parameters are instantiated with fresh variables. This generic paramters does not include any
+ /// parameters are instantiated with fresh variables. This generic parameters does not include any
/// parameters declared on the method itself.
///
/// Note that this generic parameters may include late-bound regions from the impl level. If so,
@@ -375,7 +375,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
IsMethodCall::Yes,
);
- // Create generic paramters for early-bound lifetime parameters,
+ // Create generic parameters for early-bound lifetime parameters,
// combining parameters from the type and those from the method.
assert_eq!(generics.parent_count, parent_args.len());
@@ -546,7 +546,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
debug!("instantiate_method_sig(pick={:?}, all_args={:?})", pick, all_args);
// Instantiate the bounds on the method with the
- // type/early-bound-regions instatiations performed. There can
+ // type/early-bound-regions instantiations performed. There can
// be no late-bound regions appearing here.
let def_id = pick.item.def_id;
let method_predicates = self.tcx.predicates_of(def_id).instantiate(self.tcx, all_args);
diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs
index 25f9340eeb717..07fea0e1921f6 100644
--- a/compiler/rustc_hir_typeck/src/pat.rs
+++ b/compiler/rustc_hir_typeck/src/pat.rs
@@ -2162,13 +2162,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expected = self.try_structurally_resolve_type(pat.span, expected);
if new_match_ergonomics {
- if let ByRef::Yes(inh_mut) = pat_info.binding_mode {
+ if let ByRef::Yes(in_mut) = pat_info.binding_mode {
if !ref_pat_eat_one_layer_2024 && let ty::Ref(_, _, r_mutbl) = *expected.kind() {
// Don't attempt to consume inherited reference
pat_info.binding_mode = pat_info.binding_mode.cap_ref_mutability(r_mutbl);
} else {
// ref pattern attempts to consume inherited reference
- if pat_mutbl > inh_mut {
+ if pat_mutbl > in_mut {
// Tried to match inherited `ref` with `&mut`
if !ref_pat_eat_one_layer_2024_structural {
let err_msg = "mismatched types";
diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs
index 986453397ffcc..5789e60ebbebe 100644
--- a/compiler/rustc_hir_typeck/src/upvar.rs
+++ b/compiler/rustc_hir_typeck/src/upvar.rs
@@ -228,7 +228,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// coroutine bodies can't borrow from their parent closure. To fix this,
// we force the inner coroutine to also be `move`. This only matters for
// coroutine-closures that are `move` since otherwise they themselves will
- // be borrowing from the outer environment, so there's no self-borrows occuring.
+ // be borrowing from the outer environment, so there's no self-borrows occurring.
if let UpvarArgs::Coroutine(..) = args
&& let hir::CoroutineKind::Desugared(_, hir::CoroutineSource::Closure) =
self.tcx.coroutine_kind(closure_def_id).expect("coroutine should have kind")
diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs
index 9d77afa5d2f03..1930e357fc9cc 100644
--- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs
+++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs
@@ -51,7 +51,7 @@ impl<'tcx> InferCtxt<'tcx> {
query_state,
|tcx, param_env, query_state| {
// FIXME(#118965): We don't canonicalize the static lifetimes that appear in the
- // `param_env` beacause they are treated differently by trait selection.
+ // `param_env` because they are treated differently by trait selection.
Canonicalizer::canonicalize(
param_env,
None,
diff --git a/compiler/rustc_infer/src/infer/opaque_types/mod.rs b/compiler/rustc_infer/src/infer/opaque_types/mod.rs
index 88db7237647cd..5ceaaf1a3c4fe 100644
--- a/compiler/rustc_infer/src/infer/opaque_types/mod.rs
+++ b/compiler/rustc_infer/src/infer/opaque_types/mod.rs
@@ -213,7 +213,7 @@ impl<'tcx> InferCtxt<'tcx> {
/// ```
///
/// As indicating in the comments above, each of those references
- /// is (in the compiler) basically generic paramters (`args`)
+ /// is (in the compiler) basically generic parameters (`args`)
/// applied to the type of a suitable `def_id` (which identifies
/// `Foo1` or `Foo2`).
///
diff --git a/compiler/rustc_infer/src/infer/relate/combine.rs b/compiler/rustc_infer/src/infer/relate/combine.rs
index 70b59322f5bee..f2ec1dd3df74a 100644
--- a/compiler/rustc_infer/src/infer/relate/combine.rs
+++ b/compiler/rustc_infer/src/infer/relate/combine.rs
@@ -153,7 +153,7 @@ impl<'tcx> InferCtxt<'tcx> {
// During coherence, opaque types should be treated as *possibly*
// equal to any other type (except for possibly itself). This is an
- // extremely heavy hammer, but can be relaxed in a fowards-compatible
+ // extremely heavy hammer, but can be relaxed in a forwards-compatible
// way later.
(&ty::Alias(ty::Opaque, _), _) | (_, &ty::Alias(ty::Opaque, _)) if self.intercrate => {
relation.register_predicates([ty::Binder::dummy(ty::PredicateKind::Ambiguous)]);
diff --git a/compiler/rustc_infer/src/infer/relate/generalize.rs b/compiler/rustc_infer/src/infer/relate/generalize.rs
index f257141ea6581..f2a511d7a886b 100644
--- a/compiler/rustc_infer/src/infer/relate/generalize.rs
+++ b/compiler/rustc_infer/src/infer/relate/generalize.rs
@@ -120,7 +120,7 @@ impl<'tcx> InferCtxt<'tcx> {
} else {
// NOTE: The `instantiation_variance` is not the same variance as
// used by the relation. When instantiating `b`, `target_is_expected`
- // is flipped and the `instantion_variance` is also flipped. To
+ // is flipped and the `instantiation_variance` is also flipped. To
// constrain the `generalized_ty` while using the original relation,
// we therefore only have to flip the arguments.
//
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs
index 779b98d073dab..c4a38047b5e3b 100644
--- a/compiler/rustc_interface/src/passes.rs
+++ b/compiler/rustc_interface/src/passes.rs
@@ -435,7 +435,7 @@ fn write_out_deps(tcx: TyCtxt<'_>, outputs: &OutputFilenames, out_filenames: &[P
escape_dep_filename(&file.prefer_local().to_string())
};
- // The entries will be used to declare dependencies beween files in a
+ // The entries will be used to declare dependencies between files in a
// Makefile-like output, so the iteration order does not matter.
#[allow(rustc::potential_query_instability)]
let extra_tracked_files =
diff --git a/compiler/rustc_lint/src/context/diagnostics/check_cfg.rs b/compiler/rustc_lint/src/context/diagnostics/check_cfg.rs
index fb3f40aa27108..ddaa819df1413 100644
--- a/compiler/rustc_lint/src/context/diagnostics/check_cfg.rs
+++ b/compiler/rustc_lint/src/context/diagnostics/check_cfg.rs
@@ -267,7 +267,7 @@ pub(super) fn unexpected_cfg_value(
// encouraged to do so.
let can_suggest_adding_value = !sess.psess.check_config.well_known_names.contains(&name)
// Except when working on rustc or the standard library itself, in which case we want to
- // suggest adding these cfgs to the "normal" place because of bootstraping reasons. As a
+ // suggest adding these cfgs to the "normal" place because of bootstrapping reasons. As a
// basic heuristic, we use the "cheat" unstable feature enable method and the
// non-ui-testing enabled option.
|| (matches!(sess.psess.unstable_features, rustc_feature::UnstableFeatures::Cheat)
diff --git a/compiler/rustc_lint/src/non_local_def.rs b/compiler/rustc_lint/src/non_local_def.rs
index 13a3c741fe39b..1546d79e4fd91 100644
--- a/compiler/rustc_lint/src/non_local_def.rs
+++ b/compiler/rustc_lint/src/non_local_def.rs
@@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
// > same expression-containing item.
//
// To achieve this we get try to get the paths of the _Trait_ and
- // _Type_, and we look inside thoses paths to try a find in one
+ // _Type_, and we look inside those paths to try a find in one
// of them a type whose parent is the same as the impl definition.
//
// If that's the case this means that this impl block declaration
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs
index c3b80e01c3624..761d30bac715a 100644
--- a/compiler/rustc_lint/src/unused.rs
+++ b/compiler/rustc_lint/src/unused.rs
@@ -734,7 +734,7 @@ trait UnusedDelimLint {
return false;
}
- // Check if we need parens for `match &( Struct { feild: }) {}`.
+ // Check if we need parens for `match &( Struct { field: }) {}`.
{
let mut innermost = inner;
loop {
diff --git a/compiler/rustc_middle/src/mir/consts.rs b/compiler/rustc_middle/src/mir/consts.rs
index 563647ad4e678..17cbf746a5509 100644
--- a/compiler/rustc_middle/src/mir/consts.rs
+++ b/compiler/rustc_middle/src/mir/consts.rs
@@ -240,7 +240,7 @@ impl<'tcx> Const<'tcx> {
match self {
Const::Ty(ty, ct) => {
match ct.kind() {
- // Dont use the outter ty as on invalid code we can wind up with them not being the same.
+ // Dont use the outer ty as on invalid code we can wind up with them not being the same.
// this then results in allowing const eval to add `1_i64 + 1_usize` in cases where the mir
// was originally `({N: usize} + 1_usize)` under `generic_const_exprs`.
ty::ConstKind::Value(ty, _) => ty,
@@ -271,7 +271,7 @@ impl<'tcx> Const<'tcx> {
Const::Ty(_, c) => match c.kind() {
ty::ConstKind::Value(ty, valtree) if ty.is_primitive() => {
// A valtree of a type where leaves directly represent the scalar const value.
- // Just checking whether it is a leaf is insufficient as e.g. references are leafs
+ // Just checking whether it is a leaf is insufficient as e.g. references are leaves
// but the leaf value is the value they point to, not the reference itself!
Some(valtree.unwrap_leaf().into())
}
diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs
index 69ce3e087350b..8c89c15f9611d 100644
--- a/compiler/rustc_middle/src/mir/interpret/error.rs
+++ b/compiler/rustc_middle/src/mir/interpret/error.rs
@@ -91,9 +91,9 @@ pub type EvalToAllocationRawResult<'tcx> = Result, ErrorHandled
pub type EvalStaticInitializerRawResult<'tcx> = Result, ErrorHandled>;
pub type EvalToConstValueResult<'tcx> = Result, ErrorHandled>;
/// `Ok(Err(ty))` indicates the constant was fine, but the valtree couldn't be constructed
-/// because the value containts something of type `ty` that is not valtree-compatible.
+/// because the value contains something of type `ty` that is not valtree-compatible.
/// The caller can then show an appropriate error; the query does not have the
-/// necssary context to give good user-facing errors for this case.
+/// necessary context to give good user-facing errors for this case.
pub type EvalToValTreeResult<'tcx> = Result, Ty<'tcx>>, ErrorHandled>;
#[cfg(target_pointer_width = "64")]
@@ -231,7 +231,7 @@ pub enum CheckInAllocMsg {
pub enum CheckAlignMsg {
/// The accessed pointer did not have proper alignment.
AccessedPtr,
- /// The access ocurred with a place that was based on a misaligned pointer.
+ /// The access occurred with a place that was based on a misaligned pointer.
BasedOn,
}
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index b6443778c936b..71b8cfcc46e3d 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -327,7 +327,7 @@ rustc_queries! {
}
}
- /// Returns the list of bounds that are required to be satsified
+ /// Returns the list of bounds that are required to be satisfied
/// by a implementation or definition. For associated types, these
/// must be satisfied for an implementation to be well-formed,
/// and for opaque types, these are required to be satisfied by
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 43dda252f835e..20828067c469c 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -1475,7 +1475,7 @@ impl<'tcx> TyCtxt<'tcx> {
/// provides a `TyCtxt`.
///
/// By only providing the `TyCtxt` inside of the closure we enforce that the type
- /// context and any interned alue (types, args, etc.) can only be used while `ty::tls`
+ /// context and any interned value (types, args, etc.) can only be used while `ty::tls`
/// has a valid reference to the context, to allow formatting values that need it.
pub fn create_global_ctxt(
s: &'tcx Session,
diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs
index 7d5f0f1e9c415..072951d131917 100644
--- a/compiler/rustc_middle/src/ty/instance.rs
+++ b/compiler/rustc_middle/src/ty/instance.rs
@@ -38,7 +38,7 @@ pub struct Instance<'tcx> {
pub args: GenericArgsRef<'tcx>,
}
-/// Describes why a `ReifyShim` was created. This is needed to distingish a ReifyShim created to
+/// Describes why a `ReifyShim` was created. This is needed to distinguish a ReifyShim created to
/// adjust for things like `#[track_caller]` in a vtable from a `ReifyShim` created to produce a
/// function pointer from a vtable entry.
/// Currently, this is only used when KCFI is enabled, as only KCFI needs to treat those two
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index e41ea7507efff..cd94c0afad0a9 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -1819,7 +1819,7 @@ impl<'tcx> TyCtxt<'tcx> {
self.get_attrs(did, attr).next().is_some()
}
- /// Determines whether an item is annotated with a multi-segement attribute
+ /// Determines whether an item is annotated with a multi-segment attribute
pub fn has_attrs_with_path(self, did: impl Into, attrs: &[Symbol]) -> bool {
self.get_attrs_by_path(did.into(), attrs).next().is_some()
}
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index b144fd0feb00e..89ef30fa768e0 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -1930,7 +1930,7 @@ impl<'tcx> Ty<'tcx> {
/// Returns `true` when the outermost type cannot be further normalized,
/// resolved, or instantiated. This includes all primitive types, but also
- /// things like ADTs and trait objects, sice even if their arguments or
+ /// things like ADTs and trait objects, since even if their arguments or
/// nested types may be further simplified, the outermost [`TyKind`] or
/// type constructor remains the same.
pub fn is_known_rigid(self) -> bool {
diff --git a/compiler/rustc_mir_transform/src/dead_store_elimination.rs b/compiler/rustc_mir_transform/src/dead_store_elimination.rs
index f473073083af4..39c8db184a5a2 100644
--- a/compiler/rustc_mir_transform/src/dead_store_elimination.rs
+++ b/compiler/rustc_mir_transform/src/dead_store_elimination.rs
@@ -32,7 +32,7 @@ pub fn eliminate<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let borrowed_locals = borrowed_locals(body);
// If the user requests complete debuginfo, mark the locals that appear in it as live, so
- // we don't remove assignements to them.
+ // we don't remove assignments to them.
let mut always_live = debuginfo_locals(body);
always_live.union(&borrowed_locals);
diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs
index a530dccf96b27..a6d626d3f8ff5 100644
--- a/compiler/rustc_mir_transform/src/dest_prop.rs
+++ b/compiler/rustc_mir_transform/src/dest_prop.rs
@@ -38,7 +38,7 @@
//! not contain any indirection through a pointer or any indexing projections.
//!
//! * `p` and `q` must have the **same type**. If we replace a local with a subtype or supertype,
-//! we may end up with a differnet vtable for that local. See the `subtyping-impacts-selection`
+//! we may end up with a different vtable for that local. See the `subtyping-impacts-selection`
//! tests for an example where that causes issues.
//!
//! * We need to make sure that the goal of "merging the memory" is actually structurally possible
diff --git a/compiler/rustc_mir_transform/src/known_panics_lint.rs b/compiler/rustc_mir_transform/src/known_panics_lint.rs
index 443d97d004e16..15d71ee2ac81f 100644
--- a/compiler/rustc_mir_transform/src/known_panics_lint.rs
+++ b/compiler/rustc_mir_transform/src/known_panics_lint.rs
@@ -914,7 +914,7 @@ impl<'tcx> Visitor<'tcx> for CanConstProp {
fn visit_place(&mut self, place: &Place<'tcx>, mut context: PlaceContext, loc: Location) {
use rustc_middle::mir::visit::PlaceContext::*;
- // Dereferencing just read the addess of `place.local`.
+ // Dereferencing just read the address of `place.local`.
if place.projection.first() == Some(&PlaceElem::Deref) {
context = NonMutatingUse(NonMutatingUseContext::Copy);
}
diff --git a/compiler/rustc_mir_transform/src/match_branches.rs b/compiler/rustc_mir_transform/src/match_branches.rs
index 47758b56f8c90..5240f1c887c5c 100644
--- a/compiler/rustc_mir_transform/src/match_branches.rs
+++ b/compiler/rustc_mir_transform/src/match_branches.rs
@@ -289,7 +289,7 @@ fn can_cast(
#[derive(Default)]
struct SimplifyToExp {
- transfrom_kinds: Vec,
+ transform_kinds: Vec,
}
#[derive(Clone, Copy)]
@@ -302,17 +302,17 @@ enum ExpectedTransformKind<'tcx, 'a> {
Cast { place: &'a Place<'tcx>, ty: Ty<'tcx> },
}
-enum TransfromKind {
+enum TransformKind {
Same,
Cast,
}
-impl From> for TransfromKind {
+impl From> for TransformKind {
fn from(compare_type: ExpectedTransformKind<'_, '_>) -> Self {
match compare_type {
- ExpectedTransformKind::Same(_) => TransfromKind::Same,
- ExpectedTransformKind::SameByEq { .. } => TransfromKind::Same,
- ExpectedTransformKind::Cast { .. } => TransfromKind::Cast,
+ ExpectedTransformKind::Same(_) => TransformKind::Same,
+ ExpectedTransformKind::SameByEq { .. } => TransformKind::Same,
+ ExpectedTransformKind::Cast { .. } => TransformKind::Cast,
}
}
}
@@ -475,7 +475,7 @@ impl<'tcx> SimplifyMatch<'tcx> for SimplifyToExp {
}
}
}
- self.transfrom_kinds = expected_transform_kinds.into_iter().map(|c| c.into()).collect();
+ self.transform_kinds = expected_transform_kinds.into_iter().map(|c| c.into()).collect();
Some(())
}
@@ -493,13 +493,13 @@ impl<'tcx> SimplifyMatch<'tcx> for SimplifyToExp {
let (_, first) = targets.iter().next().unwrap();
let first = &bbs[first];
- for (t, s) in iter::zip(&self.transfrom_kinds, &first.statements) {
+ for (t, s) in iter::zip(&self.transform_kinds, &first.statements) {
match (t, &s.kind) {
- (TransfromKind::Same, _) => {
+ (TransformKind::Same, _) => {
patch.add_statement(parent_end, s.kind.clone());
}
(
- TransfromKind::Cast,
+ TransformKind::Cast,
StatementKind::Assign(box (lhs, Rvalue::Use(Operand::Constant(f_c)))),
) => {
let operand = Operand::Copy(Place::from(discr_local));
diff --git a/compiler/rustc_mir_transform/src/promote_consts.rs b/compiler/rustc_mir_transform/src/promote_consts.rs
index f2610fd52bc12..0c940bac13c0b 100644
--- a/compiler/rustc_mir_transform/src/promote_consts.rs
+++ b/compiler/rustc_mir_transform/src/promote_consts.rs
@@ -498,7 +498,7 @@ impl<'tcx> Validator<'_, 'tcx> {
Some(x) if x != 0 => {} // okay
_ => return Err(Unpromotable), // value not known or 0 -- not okay
}
- // Furthermore, for signed divison, we also have to exclude `int::MIN / -1`.
+ // Furthermore, for signed division, we also have to exclude `int::MIN / -1`.
if lhs_ty.is_signed() {
match rhs_val.map(|x| x.to_int(sz)) {
Some(-1) | None => {
diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs
index 2b07c04a12130..8d0b47cb34a8f 100644
--- a/compiler/rustc_mir_transform/src/ref_prop.rs
+++ b/compiler/rustc_mir_transform/src/ref_prop.rs
@@ -345,7 +345,7 @@ fn fully_replacable_locals(ssa: &SsaLocals) -> BitSet {
replacable
}
-/// Utility to help performing subtitution of `*pattern` by `target`.
+/// Utility to help performing substitution of `*pattern` by `target`.
struct Replacer<'tcx> {
tcx: TyCtxt<'tcx>,
targets: IndexVec>,
diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs
index 9c820b888d910..8515ab45de217 100644
--- a/compiler/rustc_monomorphize/src/collector.rs
+++ b/compiler/rustc_monomorphize/src/collector.rs
@@ -397,7 +397,7 @@ fn collect_items_rec<'tcx>(
MonoItem::Static(def_id) => {
recursion_depth_reset = None;
- // Statics always get evaluted (which is possible because they can't be generic), so for
+ // Statics always get evaluated (which is possible because they can't be generic), so for
// `MentionedItems` collection there's nothing to do here.
if mode == CollectionMode::UsedItems {
let instance = Instance::mono(tcx, def_id);
diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs
index 2e521ddcec322..1c00f5f8b4173 100644
--- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs
@@ -238,7 +238,7 @@ where
(normalization_nested_goals.clone(), certainty)
}
- /// This returns the canoncial variable values to instantiate the bound variables of
+ /// This returns the canonical variable values to instantiate the bound variables of
/// the canonical response. This depends on the `original_values` for the
/// bound variables.
fn compute_query_response_instantiation_values>(
diff --git a/compiler/rustc_next_trait_solver/src/solve/mod.rs b/compiler/rustc_next_trait_solver/src/solve/mod.rs
index c65c5851e9b4f..536b502136ad3 100644
--- a/compiler/rustc_next_trait_solver/src/solve/mod.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/mod.rs
@@ -164,7 +164,7 @@ where
// - `Bound` cannot exist as we don't have a binder around the self Type
// - `Expr` is part of `feature(generic_const_exprs)` and is not implemented yet
ty::ConstKind::Param(_) | ty::ConstKind::Bound(_, _) | ty::ConstKind::Expr(_) => {
- panic!("unexpect const kind: {:?}", ct)
+ panic!("unexpected const kind: {:?}", ct)
}
}
}
diff --git a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
index 1314b7eb6ffc6..67b001d0cceda 100644
--- a/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
+++ b/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
@@ -628,7 +628,7 @@ where
}
// FIXME: This actually should destructure the `Result` we get from transmutability and
- // register candiates. We probably need to register >1 since we may have an OR of ANDs.
+ // register candidates. We probably need to register >1 since we may have an OR of ANDs.
ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {
let certainty = ecx.is_transmutable(
goal.param_env,
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs
index 8233f9a79435f..f87b564965469 100644
--- a/compiler/rustc_parse/src/parser/pat.rs
+++ b/compiler/rustc_parse/src/parser/pat.rs
@@ -402,7 +402,7 @@ impl<'a> Parser<'a> {
let non_assoc_span = expr.span;
// Parse an associative expression such as `+ expr`, `% expr`, ...
- // Assignements, ranges and `|` are disabled by [`Restrictions::IS_PAT`].
+ // Assignments, ranges and `|` are disabled by [`Restrictions::IS_PAT`].
if let Ok((expr, _)) =
snapshot.parse_expr_assoc_rest_with(0, false, expr).map_err(|err| err.cancel())
{
diff --git a/compiler/rustc_passes/src/dead.rs b/compiler/rustc_passes/src/dead.rs
index 7ae5c9040042c..7f1e906ffd737 100644
--- a/compiler/rustc_passes/src/dead.rs
+++ b/compiler/rustc_passes/src/dead.rs
@@ -439,7 +439,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
_ => intravisit::walk_item(self, item),
},
Node::TraitItem(trait_item) => {
- // mark corresponing ImplTerm live
+ // mark corresponding ImplTerm live
let trait_item_id = trait_item.owner_id.to_def_id();
if let Some(trait_id) = self.tcx.trait_of_item(trait_item_id) {
// mark the trait live
@@ -1035,7 +1035,7 @@ impl<'tcx> DeadVisitor<'tcx> {
};
let encl_def_id = parent_item.unwrap_or(first_item.def_id);
- // If parent of encl_def_id is an enum, use the parent ID intead.
+ // If parent of encl_def_id is an enum, use the parent ID instead.
let encl_def_id = get_parent_if_enum_variant(tcx, encl_def_id);
let ignored_derived_impls =
diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs
index 3a2a75a638f79..e4edd7befb76f 100644
--- a/compiler/rustc_pattern_analysis/src/constructor.rs
+++ b/compiler/rustc_pattern_analysis/src/constructor.rs
@@ -288,7 +288,7 @@ impl IntRange {
/// Best effort; will not know that e.g. `255u8..` is a singleton.
pub fn is_singleton(&self) -> bool {
// Since `lo` and `hi` can't be the same `Infinity` and `plus_one` never changes from finite
- // to infinite, this correctly only detects ranges that contain exacly one `Finite(x)`.
+ // to infinite, this correctly only detects ranges that contain exactly one `Finite(x)`.
self.lo.plus_one() == Some(self.hi)
}
diff --git a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs
index 2192940d4d716..af093db782cde 100644
--- a/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs
+++ b/compiler/rustc_pattern_analysis/tests/exhaustiveness.rs
@@ -22,7 +22,7 @@ fn check(patterns: Vec>) -> Vec> {
fn assert_exhaustive(patterns: Vec>) {
let witnesses = check(patterns);
if !witnesses.is_empty() {
- panic!("non-exaustive match: missing {witnesses:?}");
+ panic!("non-exhaustive match: missing {witnesses:?}");
}
}
diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs
index b6aa1d5a43bb8..eb3eddf34aa3e 100644
--- a/compiler/rustc_query_system/src/dep_graph/graph.rs
+++ b/compiler/rustc_query_system/src/dep_graph/graph.rs
@@ -1405,7 +1405,7 @@ fn panic_on_forbidden_read(data: &DepGraphData, dep_node_index: DepN
"Error: trying to record dependency on DepNode {dep_node} in a \
context that does not allow it (e.g. during query deserialization). \
The most common case of recording a dependency on a DepNode `foo` is \
- when the correspondng query `foo` is invoked. Invoking queries is not \
+ when the corresponding query `foo` is invoked. Invoking queries is not \
allowed as part of loading something from the incremental on-disk cache. \
See ."
)
diff --git a/compiler/rustc_resolve/messages.ftl b/compiler/rustc_resolve/messages.ftl
index 73d1a2ea49a13..6602c7889691f 100644
--- a/compiler/rustc_resolve/messages.ftl
+++ b/compiler/rustc_resolve/messages.ftl
@@ -11,7 +11,7 @@ resolve_added_macro_use =
resolve_ancestor_only =
visibilities can only be restricted to ancestor modules
-resolve_anonymous_livetime_non_gat_report_error =
+resolve_anonymous_lifetime_non_gat_report_error =
in the trait associated type is declared without lifetime parameters, so using a borrowed type for them requires that lifetime to come from the implemented type
.label = this lifetime must come from the implemented type
diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs
index 149c639efab86..87f8e51f28231 100644
--- a/compiler/rustc_resolve/src/ident.rs
+++ b/compiler/rustc_resolve/src/ident.rs
@@ -445,7 +445,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
}
}
Scope::DeriveHelpersCompat => {
- // FIXME: Try running this logic eariler, to allocate name bindings for
+ // FIXME: Try running this logic earlier, to allocate name bindings for
// legacy derive helpers when creating an attribute invocation with
// following derives. Legacy derive helpers are not common, so it shouldn't
// affect performance. It should also allow to remove the `derives`
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index a0386ddcbb37e..79c42456cf8c9 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -133,7 +133,7 @@ pub(crate) enum NoConstantGenericsReason {
/// Const arguments are only allowed to use generic parameters when:
/// - `feature(generic_const_exprs)` is enabled
/// or
- /// - the const argument is a sole const generic paramater, i.e. `foo::<{ N }>()`
+ /// - the const argument is a sole const generic parameter, i.e. `foo::<{ N }>()`
///
/// If neither of the above are true then this is used as the cause.
NonTrivialConstArg,
@@ -4486,7 +4486,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
/// There are a few places that we need to resolve an anon const but we did not parse an
/// anon const so cannot provide an `&'ast AnonConst`. Right now this is just unbraced
- /// const arguments that were parsed as type arguments, and `legact_const_generics` which
+ /// const arguments that were parsed as type arguments, and `legacy_const_generics` which
/// parse as normal function argument expressions. To avoid duplicating the code for resolving
/// an anon const we have this function which lets the caller manually call `resolve_expr` or
/// `smart_resolve_path`.
diff --git a/compiler/rustc_resolve/src/rustdoc.rs b/compiler/rustc_resolve/src/rustdoc.rs
index de4fc5c27d40a..976c4acb212f5 100644
--- a/compiler/rustc_resolve/src/rustdoc.rs
+++ b/compiler/rustc_resolve/src/rustdoc.rs
@@ -417,7 +417,7 @@ pub(crate) fn attrs_to_preprocessed_links(attrs: &[ast::Attribute]) -> Vec(doc: &'md str) -> Vec> {
let mut broken_link_callback = |link: BrokenLink<'md>| Some((link.reference, "".into()));
diff --git a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs
index 2f43199796cc6..5b2062e0b0ab3 100644
--- a/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs
+++ b/compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs
@@ -262,7 +262,7 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc
/// mangling.
///
/// typeid_for_instance is called at two locations, initially when declaring/defining functions and
-/// methods, and later during code generation at call sites, after type erasure might have ocurred.
+/// methods, and later during code generation at call sites, after type erasure might have occurred.
///
/// In the first call (i.e., when declaring/defining functions and methods), it encodes type ids for
/// an FnAbi or Instance, and these type ids are attached to functions and methods. (These type ids
@@ -270,7 +270,7 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc
/// these type ids.)
///
/// In the second call (i.e., during code generation at call sites), it encodes a type id for an
-/// FnAbi or Instance, after type erasure might have occured, and this type id is used for testing
+/// FnAbi or Instance, after type erasure might have occurred, and this type id is used for testing
/// if a function is member of the group derived from this type id. Therefore, in the first call to
/// typeid_for_fnabi (when type ids are attached to functions and methods), it can only include at
/// most as much information that would be available in the second call (i.e., during code
@@ -365,7 +365,7 @@ pub fn transform_instance<'tcx>(
// of the trait that defines the method.
if let Some((trait_ref, method_id, ancestor)) = implemented_method(tcx, instance) {
// Trait methods will have a Self polymorphic parameter, where the concreteized
- // implementatation will not. We need to walk back to the more general trait method
+ // implementation will not. We need to walk back to the more general trait method
let trait_ref = tcx.instantiate_and_normalize_erasing_regions(
instance.args,
ty::ParamEnv::reveal_all(),
diff --git a/compiler/rustc_serialize/src/opaque.rs b/compiler/rustc_serialize/src/opaque.rs
index d8609ccfe429f..c7c561156e35b 100644
--- a/compiler/rustc_serialize/src/opaque.rs
+++ b/compiler/rustc_serialize/src/opaque.rs
@@ -159,7 +159,7 @@ impl FileEncoder {
// We produce a post-mono error if N > BUF_SIZE.
let buf = unsafe { self.buffer_empty().first_chunk_mut::().unwrap_unchecked() };
let written = visitor(buf);
- // We have to ensure that an errant visitor cannot cause self.buffered to exeed BUF_SIZE.
+ // We have to ensure that an errant visitor cannot cause self.buffered to exceed BUF_SIZE.
if written > N {
Self::panic_invalid_write::(written);
}
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 945bab6887e69..908d50a041ef1 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -251,7 +251,7 @@ pub struct LinkSelfContained {
pub explicitly_set: Option,
/// The components that are enabled on the CLI, using the `+component` syntax or one of the
- /// `true` shorcuts.
+ /// `true` shortcuts.
enabled_components: LinkSelfContainedComponents,
/// The components that are disabled on the CLI, using the `-component` syntax or one of the
@@ -313,13 +313,13 @@ impl LinkSelfContained {
}
/// Returns whether the self-contained linker component was enabled on the CLI, using the
- /// `-C link-self-contained=+linker` syntax, or one of the `true` shorcuts.
+ /// `-C link-self-contained=+linker` syntax, or one of the `true` shortcuts.
pub fn is_linker_enabled(&self) -> bool {
self.enabled_components.contains(LinkSelfContainedComponents::LINKER)
}
/// Returns whether the self-contained linker component was disabled on the CLI, using the
- /// `-C link-self-contained=-linker` syntax, or one of the `false` shorcuts.
+ /// `-C link-self-contained=-linker` syntax, or one of the `false` shortcuts.
pub fn is_linker_disabled(&self) -> bool {
self.disabled_components.contains(LinkSelfContainedComponents::LINKER)
}
@@ -360,7 +360,7 @@ impl LinkerFeaturesCli {
// Duplicate flags are reduced as we go, the last occurrence wins:
// `+feature,-feature,+feature` only enables the feature, and does not record it as both
// enabled and disabled on the CLI.
- // We also only expose `+/-lld` at the moment, as it's currenty the only implemented linker
+ // We also only expose `+/-lld` at the moment, as it's currently the only implemented linker
// feature and toggling `LinkerFeatures::CC` would be a noop.
match feature {
"+lld" => {
@@ -1102,7 +1102,7 @@ bitflags::bitflags! {
const MACRO = 1 << 0;
/// Apply remappings to printed compiler diagnostics
const DIAGNOSTICS = 1 << 1;
- /// Apply remappings to debug informations
+ /// Apply remappings to debug information
const DEBUGINFO = 1 << 3;
/// An alias for `macro` and `debuginfo`. This ensures all paths in compiled
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs
index 70430d82ab55b..e660c410ce645 100644
--- a/compiler/rustc_session/src/session.rs
+++ b/compiler/rustc_session/src/session.rs
@@ -1474,7 +1474,7 @@ impl RemapFileNameExt for rustc_span::FileName {
"one and only one scope should be passed to for_scope"
);
if sess.opts.unstable_opts.remap_path_scope.contains(scope) {
- self.prefer_remapped_unconditionaly()
+ self.prefer_remapped_unconditionally()
} else {
self.prefer_local()
}
diff --git a/compiler/rustc_smir/src/rustc_internal/mod.rs b/compiler/rustc_smir/src/rustc_internal/mod.rs
index e997ea25ec863..a3aa589cb643e 100644
--- a/compiler/rustc_smir/src/rustc_internal/mod.rs
+++ b/compiler/rustc_smir/src/rustc_internal/mod.rs
@@ -397,7 +397,7 @@ macro_rules! run_driver {
}};
}
-/// Simmilar to rustc's `FxIndexMap`, `IndexMap` with extra
+/// Similar to rustc's `FxIndexMap`, `IndexMap` with extra
/// safety features added.
pub struct IndexMap {
index_map: fx::FxIndexMap,
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs
index 5e1b1b44bc2a2..463e0dbc30ce5 100644
--- a/compiler/rustc_span/src/hygiene.rs
+++ b/compiler/rustc_span/src/hygiene.rs
@@ -1358,7 +1358,7 @@ pub fn decode_syntax_context SyntaxContext
let mut inner = context.inner.lock();
if let Some(ctxt) = inner.remapped_ctxts.get(raw_id as usize).copied().flatten() {
- // This has already beeen decoded.
+ // This has already been decoded.
return ctxt;
}
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs
index 7b020f11cdda0..195e76d2391f6 100644
--- a/compiler/rustc_span/src/lib.rs
+++ b/compiler/rustc_span/src/lib.rs
@@ -271,7 +271,7 @@ impl RealFileName {
}
}
- /// Return the path remmapped or not depending on the [`FileNameDisplayPreference`].
+ /// Return the path remapped or not depending on the [`FileNameDisplayPreference`].
///
/// For the purpose of this function, local and short preference are equal.
pub fn to_path(&self, display_pref: FileNameDisplayPreference) -> &Path {
@@ -386,7 +386,7 @@ impl FileName {
}
}
- pub fn prefer_remapped_unconditionaly(&self) -> FileNameDisplay<'_> {
+ pub fn prefer_remapped_unconditionally(&self) -> FileNameDisplay<'_> {
FileNameDisplay { inner: self, display_pref: FileNameDisplayPreference::Remapped }
}
@@ -1683,7 +1683,7 @@ impl fmt::Debug for SourceFile {
/// is because SourceFiles for the local crate are allocated very early in the
/// compilation process when the `StableCrateId` is not yet known. If, due to
/// some refactoring of the compiler, the `StableCrateId` of the local crate
-/// were to become available, it would be better to uniformely make this a
+/// were to become available, it would be better to uniformly make this a
/// hash of `(filename, stable_crate_id)`.
///
/// When `SourceFile`s are exported in crate metadata, the `StableSourceFileId`
diff --git a/compiler/rustc_symbol_mangling/src/hashed.rs b/compiler/rustc_symbol_mangling/src/hashed.rs
index 8e2f94991cf90..07c5f54479232 100644
--- a/compiler/rustc_symbol_mangling/src/hashed.rs
+++ b/compiler/rustc_symbol_mangling/src/hashed.rs
@@ -14,7 +14,7 @@ pub(super) fn mangle<'tcx>(
) -> String {
// The symbol of a generic function may be scattered in multiple downstream dylibs.
// If the symbol of a generic function still contains `crate name`, hash conflicts between the
- // generic funcion and other symbols of the same `crate` cannot be detected in time during
+ // generic function and other symbols of the same `crate` cannot be detected in time during
// construction. This symbol conflict is left over until it occurs during run time.
// In this case, `instantiating-crate name` is used to replace `crate name` can completely
// eliminate the risk of the preceding potential hash conflict.
diff --git a/compiler/rustc_target/src/abi/call/xtensa.rs b/compiler/rustc_target/src/abi/call/xtensa.rs
index addbe6989254c..0994ff4798805 100644
--- a/compiler/rustc_target/src/abi/call/xtensa.rs
+++ b/compiler/rustc_target/src/abi/call/xtensa.rs
@@ -26,7 +26,7 @@ where
// so defer to `classify_arg_ty`.
let mut arg_gprs_left = NUM_RET_GPRS;
classify_arg_ty(arg, &mut arg_gprs_left, MAX_RET_IN_REGS_SIZE);
- // Ret args cannot be passed via stack, we lower to indirect and let the backend handle the invisble reference
+ // Ret args cannot be passed via stack, we lower to indirect and let the backend handle the invisible reference
match arg.mode {
super::PassMode::Indirect { attrs: _, meta_attrs: _, ref mut on_stack } => {
*on_stack = false;
diff --git a/compiler/rustc_target/src/spec/base/windows_msvc.rs b/compiler/rustc_target/src/spec/base/windows_msvc.rs
index bd0318f31832a..6f886ec8a250f 100644
--- a/compiler/rustc_target/src/spec/base/windows_msvc.rs
+++ b/compiler/rustc_target/src/spec/base/windows_msvc.rs
@@ -29,7 +29,7 @@ pub fn opts() -> TargetOptions {
// they bring in.
//
// See also https://learn.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=msvc-170#lib
- // for documention on including library dependencies in C/C++ code.
+ // for documentation on including library dependencies in C/C++ code.
no_default_libraries: false,
has_thread_local: true,
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index d5f227a84a4ca..a7305ca05626a 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -2148,7 +2148,7 @@ pub struct TargetOptions {
pub is_like_aix: bool,
/// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS,
/// in particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
- /// Also indiates whether to use Apple-specific ABI changes, such as extending function
+ /// Also indicates whether to use Apple-specific ABI changes, such as extending function
/// parameters to 32-bits.
pub is_like_osx: bool,
/// Whether the target toolchain is like Solaris's.
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs
index 489bae4fedf17..1a2533ecd7475 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs
@@ -53,7 +53,7 @@ pub fn target() -> Target {
options.entry_name = "__main_void".into();
// Default to PIC unlike base wasm. This makes precompiled objects such as
- // the standard library more suitable to be used with shared libaries a la
+ // the standard library more suitable to be used with shared libraries a la
// emscripten's dynamic linking convention.
options.relocation_model = RelocModel::Pic;
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
index 3fdfca50dceba..de93434bd6011 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs
@@ -170,7 +170,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
{
return guar;
}
- // Silence redundant errors on binding acccess that are already
+ // Silence redundant errors on binding access that are already
// reported on the binding definition (#56607).
if let Err(guar) = self.fn_arg_obligation(&obligation) {
return guar;
@@ -900,7 +900,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
let mut suggested = false;
let mut chain = vec![];
- // The following logic is simlar to `point_at_chain`, but that's focused on associated types
+ // The following logic is similar to `point_at_chain`, but that's focused on associated types
let mut expr = expr;
while let hir::ExprKind::MethodCall(path_segment, rcvr_expr, args, span) = expr.kind {
// Point at every method call in the chain with the `Result` type.
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs
index efbc2695fd95e..41b0ee56a4cb5 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs
@@ -878,7 +878,7 @@ impl<'tcx> OnUnimplementedFormatString {
}
}
// we cannot return errors from processing the format string as hard error here
- // as the diagnostic namespace gurantees that malformed input cannot cause an error
+ // as the diagnostic namespace guarantees that malformed input cannot cause an error
//
// if we encounter any error while processing we nevertheless want to show it as warning
// so that users are aware that something is not correct
@@ -986,10 +986,10 @@ impl<'tcx> OnUnimplementedFormatString {
})
.collect();
// we cannot return errors from processing the format string as hard error here
- // as the diagnostic namespace gurantees that malformed input cannot cause an error
+ // as the diagnostic namespace guarantees that malformed input cannot cause an error
//
// if we encounter any error while processing the format string
- // we don't want to show the potentially half assembled formated string,
+ // we don't want to show the potentially half assembled formatted string,
// therefore we fall back to just showing the input string in this case
//
// The actual parser errors are emitted earlier
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
index f2c457aa377fb..5c663e0bf4b5b 100644
--- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs
@@ -4663,7 +4663,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
// because this suggest adding both return type in
// the `FnSig` and a default return value in the body, so it
// is not suitable for foreign function without a local body,
- // and neighter for trait method which may be also implemented
+ // and neither for trait method which may be also implemented
// in other place, so shouldn't change it's FnSig.
fn choose_suggest_items<'tcx, 'hir>(
tcx: TyCtxt<'tcx>,
diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs
index bf4b0482081d9..4acbca994aaa3 100644
--- a/compiler/rustc_trait_selection/src/traits/coherence.rs
+++ b/compiler/rustc_trait_selection/src/traits/coherence.rs
@@ -723,7 +723,7 @@ impl<'a, 'tcx> ProofTreeVisitor<'tcx> for AmbiguityCausesVisitor<'a, 'tcx> {
// FIXME: While this matches the behavior of the
// old solver, it is not the only way in which the unknowable
// candidates *weaken* coherence, they can also force otherwise
- // sucessful normalization to be ambiguous.
+ // successful normalization to be ambiguous.
Ok(Certainty::Maybe(_) | Certainty::Yes) => {
ambiguity_cause = None;
break;
diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs
index f72ae94fffc7a..16ba06f8667ff 100644
--- a/compiler/rustc_trait_selection/src/traits/fulfill.rs
+++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs
@@ -472,7 +472,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
};
match infcx.at(&obligation.cause, obligation.param_env).eq(
- // Only really excercised by generic_const_exprs
+ // Only really exercised by generic_const_exprs
DefineOpaqueTypes::Yes,
ct_ty,
ty,
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 91fe19c20f77b..12497e32b2db4 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -991,7 +991,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
};
match self.infcx.at(&obligation.cause, obligation.param_env).eq(
- // Only really excercised by generic_const_exprs
+ // Only really exercised by generic_const_exprs
DefineOpaqueTypes::Yes,
ct_ty,
ty,
diff --git a/compiler/rustc_transmute/src/maybe_transmutable/mod.rs b/compiler/rustc_transmute/src/maybe_transmutable/mod.rs
index 2762b4e638405..a76ef7f0d189b 100644
--- a/compiler/rustc_transmute/src/maybe_transmutable/mod.rs
+++ b/compiler/rustc_transmute/src/maybe_transmutable/mod.rs
@@ -242,7 +242,7 @@ where
// }
// ...if `refs_answer` was computed lazily. The below early
// returns can be deleted without impacting the correctness of
- // the algoritm; only its performance.
+ // the algorithm; only its performance.
debug!(?bytes_answer);
match bytes_answer {
Answer::No(_) if !self.assume.validity => return bytes_answer,
diff --git a/compiler/rustc_type_ir/src/binder.rs b/compiler/rustc_type_ir/src/binder.rs
index d42efbc91e196..f20beb797500e 100644
--- a/compiler/rustc_type_ir/src/binder.rs
+++ b/compiler/rustc_type_ir/src/binder.rs
@@ -776,7 +776,7 @@ impl<'a, I: Interner> ArgFolder<'a, I> {
}
/// It is sometimes necessary to adjust the De Bruijn indices during instantiation. This occurs
- /// when we are instantating a type with escaping bound vars into a context where we have
+ /// when we are instantiating a type with escaping bound vars into a context where we have
/// passed through binders. That's quite a mouthful. Let's see an example:
///
/// ```
diff --git a/compiler/rustc_type_ir/src/inherent.rs b/compiler/rustc_type_ir/src/inherent.rs
index 958360faede57..59a83ea5412d5 100644
--- a/compiler/rustc_type_ir/src/inherent.rs
+++ b/compiler/rustc_type_ir/src/inherent.rs
@@ -162,7 +162,7 @@ pub trait Ty>:
/// Returns `true` when the outermost type cannot be further normalized,
/// resolved, or instantiated. This includes all primitive types, but also
- /// things like ADTs and trait objects, sice even if their arguments or
+ /// things like ADTs and trait objects, since even if their arguments or
/// nested types may be further simplified, the outermost [`ty::TyKind`] or
/// type constructor remains the same.
fn is_known_rigid(self) -> bool {
diff --git a/compiler/rustc_type_ir/src/relate.rs b/compiler/rustc_type_ir/src/relate.rs
index 578436b622a87..9c725f34d8e5b 100644
--- a/compiler/rustc_type_ir/src/relate.rs
+++ b/compiler/rustc_type_ir/src/relate.rs
@@ -550,7 +550,7 @@ pub fn structurally_relate_tys>(
/// Any semantic equality, e.g. of unevaluated consts, and inference variables have
/// to be handled by the caller.
///
-/// FIXME: This is not totally structual, which probably should be fixed.
+/// FIXME: This is not totally structural, which probably should be fixed.
/// See the HACKs below.
pub fn structurally_relate_consts>(
relation: &mut R,
diff --git a/compiler/rustc_type_ir/src/solve/mod.rs b/compiler/rustc_type_ir/src/solve/mod.rs
index 00fc6ba1c5c8f..96c939a898bd9 100644
--- a/compiler/rustc_type_ir/src/solve/mod.rs
+++ b/compiler/rustc_type_ir/src/solve/mod.rs
@@ -132,7 +132,7 @@ pub enum GoalSource {
/// results in better error messages by avoiding spurious errors.
/// We do not erase overflow constraints in `normalizes-to` goals unless
/// they are from an impl where-clause. This is necessary due to
- /// backwards compatability, cc trait-system-refactor-initiatitive#70.
+ /// backwards compatibility, cc trait-system-refactor-initiatitive#70.
ImplWhereBound,
/// Instantiating a higher-ranked goal and re-proving it.
InstantiateHigherRanked,
diff --git a/compiler/stable_mir/src/abi.rs b/compiler/stable_mir/src/abi.rs
index 9d3b40e5eea7b..317bec3050c74 100644
--- a/compiler/stable_mir/src/abi.rs
+++ b/compiler/stable_mir/src/abi.rs
@@ -70,7 +70,7 @@ pub struct TyAndLayout {
/// The layout of a type in memory.
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)]
pub struct LayoutShape {
- /// The fields location withing the layout
+ /// The fields location within the layout
pub fields: FieldsShape,
/// Encodes information about multi-variant layouts.
diff --git a/compiler/stable_mir/src/ty.rs b/compiler/stable_mir/src/ty.rs
index 2f36aa5182965..5bad3d5ae7a3c 100644
--- a/compiler/stable_mir/src/ty.rs
+++ b/compiler/stable_mir/src/ty.rs
@@ -267,7 +267,7 @@ impl Span {
with(|c| c.get_filename(self))
}
- /// Return lines that corespond to this `Span`
+ /// Return lines that correspond to this `Span`
pub fn get_lines(&self) -> LineInfo {
with(|c| c.get_lines(self))
}
diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs
index f6f773cc42a4f..c7908578522a5 100644
--- a/library/alloc/src/collections/btree/map.rs
+++ b/library/alloc/src/collections/btree/map.rs
@@ -3302,7 +3302,7 @@ impl<'a, K: Ord, V, A: Allocator + Clone> CursorMutKey<'a, K, V, A> {
Some(kv)
}
- /// Removes the precending element from the `BTreeMap`.
+ /// Removes the preceding element from the `BTreeMap`.
///
/// The element that was removed is returned. The cursor position is
/// unchanged (after the removed element).
@@ -3408,7 +3408,7 @@ impl<'a, K: Ord, V, A: Allocator + Clone> CursorMut<'a, K, V, A> {
self.inner.remove_next()
}
- /// Removes the precending element from the `BTreeMap`.
+ /// Removes the preceding element from the `BTreeMap`.
///
/// The element that was removed is returned. The cursor position is
/// unchanged (after the removed element).
diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs
index 973e7c660670c..2b5bebcd8cd08 100644
--- a/library/alloc/src/collections/btree/set.rs
+++ b/library/alloc/src/collections/btree/set.rs
@@ -2298,7 +2298,7 @@ impl<'a, T: Ord, A: Allocator + Clone> CursorMut<'a, T, A> {
self.inner.remove_next().map(|(k, _)| k)
}
- /// Removes the precending element from the `BTreeSet`.
+ /// Removes the preceding element from the `BTreeSet`.
///
/// The element that was removed is returned. The cursor position is
/// unchanged (after the removed element).
@@ -2384,7 +2384,7 @@ impl<'a, T: Ord, A: Allocator + Clone> CursorMutKey<'a, T, A> {
self.inner.remove_next().map(|(k, _)| k)
}
- /// Removes the precending element from the `BTreeSet`.
+ /// Removes the preceding element from the `BTreeSet`.
///
/// The element that was removed is returned. The cursor position is
/// unchanged (after the removed element).
diff --git a/library/alloc/src/raw_vec.rs b/library/alloc/src/raw_vec.rs
index 9c8fa7ceff4e5..61ddcd581a45d 100644
--- a/library/alloc/src/raw_vec.rs
+++ b/library/alloc/src/raw_vec.rs
@@ -425,7 +425,7 @@ impl RawVecInner {
match Self::try_allocate_in(capacity, AllocInit::Uninitialized, alloc, elem_layout) {
Ok(this) => {
unsafe {
- // Make it more obvious that a subsquent Vec::reserve(capacity) will not allocate.
+ // Make it more obvious that a subsequent Vec::reserve(capacity) will not allocate.
hint::assert_unchecked(!this.needs_to_grow(0, capacity, elem_layout));
}
this
diff --git a/library/core/benches/num/int_pow/mod.rs b/library/core/benches/num/int_pow/mod.rs
index 063d722bdd1b5..20f7b0375d4d1 100644
--- a/library/core/benches/num/int_pow/mod.rs
+++ b/library/core/benches/num/int_pow/mod.rs
@@ -25,7 +25,7 @@ macro_rules! pow_bench_template {
let mut exp_iter = black_box(&exp_array).into_iter();
(0..ITERATIONS).fold((0 as IntType, false), |acc, _| {
- // Sometimes constants don't propogate all the way to the
+ // Sometimes constants don't propagate all the way to the
// inside of the loop, so we call a custom expression every cycle
// rather than iter::repeat(CONST)
let base: IntType = $base_macro!(base_iter);
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs
index 61c713c9e81cf..c63f261edabfa 100644
--- a/library/core/src/array/mod.rs
+++ b/library/core/src/array/mod.rs
@@ -37,7 +37,7 @@ pub use iter::IntoIter;
///
/// # Example
///
-/// Creating muliple copies of a `String`:
+/// Creating multiple copies of a `String`:
/// ```rust
/// #![feature(array_repeat)]
///
diff --git a/library/core/src/future/async_drop.rs b/library/core/src/future/async_drop.rs
index 8971a2c0aafd1..07917c8dd365d 100644
--- a/library/core/src/future/async_drop.rs
+++ b/library/core/src/future/async_drop.rs
@@ -41,7 +41,7 @@ impl Future for AsyncDropOwning {
let dtor = Pin::new_unchecked(
this.dtor.get_or_insert_with(|| async_drop_in_place(this.value.as_mut_ptr())),
);
- // AsyncDestuctors are idempotent so Self gets idempotency as well
+ // AsyncDestructors are idempotent so Self gets idempotency as well
dtor.poll(cx)
}
}
@@ -157,7 +157,7 @@ async unsafe fn surface_drop_in_place(ptr: *mut T) {
unsafe { crate::ops::fallback_surface_drop(&mut *ptr) }
}
-/// Wraps a future to continue outputing `Poll::Ready(())` once after
+/// Wraps a future to continue outputting `Poll::Ready(())` once after
/// wrapped future completes by returning `Poll::Ready(())` on poll. This
/// is useful for constructing async destructors to guarantee this
/// "fuse" property
@@ -223,7 +223,7 @@ where
/// # Safety
///
/// Same as `async_drop_in_place` except is lazy to avoid creating
-/// multiple mutable refernces.
+/// multiple mutable references.
#[lang = "async_drop_defer"]
async unsafe fn defer(to_drop: *mut T) {
// SAFETY: same safety requirements as `async_drop_in_place`
@@ -246,7 +246,7 @@ async unsafe fn either, M: IntoFuture