Skip to content

Commit 8109c3b

Browse files
committed
fix few comment typos in compiler
1 parent cdb89d6 commit 8109c3b

File tree

30 files changed

+36
-36
lines changed

30 files changed

+36
-36
lines changed

compiler/rustc_ast/src/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ impl Expr {
12011201
}
12021202
}
12031203

1204-
/// Returns an expression with (when possible) *one* outter brace removed
1204+
/// Returns an expression with (when possible) *one* outer brace removed
12051205
pub fn maybe_unwrap_block(&self) -> &Expr {
12061206
if let ExprKind::Block(block, None) = &self.kind
12071207
&& let [stmt] = block.stmts.as_slice()

compiler/rustc_borrowck/src/diagnostics/opaque_suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
3131
diag: &mut Diag<'_>,
3232
) {
3333
// We look at all the locals. Why locals? Because it's the best thing
34-
// I could think of that's correlated with the *instantiated* higer-ranked
34+
// I could think of that's correlated with the *instantiated* higher-ranked
3535
// binder for calls, since we don't really store those anywhere else.
3636
for ty in self.body.local_decls.iter().map(|local| local.ty) {
3737
if !ty.has_opaque_types() {

compiler/rustc_codegen_llvm/src/va_arg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ fn emit_xtensa_va_arg<'ll, 'tcx>(
365365

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

370370
// if from_regsave {
371371
// unsafe { *regsave_value_ptr }

compiler/rustc_codegen_ssa/src/back/link.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
30303030
// Supported architecture names can be found in the source:
30313031
// https://github.com/apple-oss-distributions/ld64/blob/ld64-951.9/src/abstraction/MachOFileAbstraction.hpp#L578-L648
30323032
//
3033-
// Intentially verbose to ensure that the list always matches correctly
3033+
// Intentionally verbose to ensure that the list always matches correctly
30343034
// with the list in the source above.
30353035
let ld64_arch = match llvm_arch {
30363036
"armv7k" => "armv7k",
@@ -3098,7 +3098,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
30983098
// We do not currently know the actual SDK version though, so we have a few options:
30993099
// 1. Use the minimum version supported by rustc.
31003100
// 2. Use the same as the deployment target.
3101-
// 3. Use an arbitary recent version.
3101+
// 3. Use an arbitrary recent version.
31023102
// 4. Omit the version.
31033103
//
31043104
// The first option is too low / too conservative, and means that users will not get the

compiler/rustc_codegen_ssa/src/back/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option<write::Object<'static
408408
/// Mach-O files contain information about:
409409
/// - The platform/OS they were built for (macOS/watchOS/Mac Catalyst/iOS simulator etc).
410410
/// - The minimum OS version / deployment target.
411-
/// - The version of the SDK they were targetting.
411+
/// - The version of the SDK they were targeting.
412412
///
413413
/// In the past, this was accomplished using the LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS,
414414
/// LC_VERSION_MIN_TVOS or LC_VERSION_MIN_WATCHOS load commands, which each contain information

compiler/rustc_codegen_ssa/src/traits/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub trait BuilderMethods<'a, 'tcx>:
8989
//
9090
// This function is opt-in for back ends.
9191
//
92-
// The default implementation calls `self.expect()` before emiting the branch
92+
// The default implementation calls `self.expect()` before emitting the branch
9393
// by calling `self.cond_br()`
9494
fn cond_br_with_expect(
9595
&mut self,

compiler/rustc_const_eval/src/util/check_validity_requirement.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn check_validity_requirement_strict<'tcx>(
6868
// require dereferenceability also require non-null, we don't actually get any false negatives
6969
// due to this.
7070
// The value we are validating is temporary and discarded at the end of this function, so
71-
// there is no point in reseting provenance and padding.
71+
// there is no point in resetting provenance and padding.
7272
Ok(cx
7373
.validate_operand(
7474
&allocated.into(),

compiler/rustc_data_structures/src/vec_cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ unsafe impl<K: Idx, #[may_dangle] V, I> Drop for VecCache<K, V, I> {
244244
// we are also guaranteed to just need to deallocate any large arrays (not iterate over
245245
// contents).
246246
//
247-
// Confirm no need to deallocate invidual entries. Note that `V: Copy` is asserted on
247+
// Confirm no need to deallocate individual entries. Note that `V: Copy` is asserted on
248248
// insert/lookup but not necessarily construction, primarily to avoid annoyingly propagating
249249
// the bounds into struct definitions everywhere.
250250
assert!(!std::mem::needs_drop::<K>());

compiler/rustc_errors/src/emitter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2522,7 +2522,7 @@ impl HumanEmitter {
25222522
buffer.puts(*row_num, max_line_num_len + 1, "+ ", Style::Addition);
25232523
}
25242524
[] => {
2525-
// FIXME: needed? Doesn't get excercised in any test.
2525+
// FIXME: needed? Doesn't get exercised in any test.
25262526
self.draw_col_separator_no_space(buffer, *row_num, max_line_num_len + 1);
25272527
}
25282528
_ => {

compiler/rustc_errors/src/markdown/parse.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ fn parse_with_end_pat<'a>(
346346
None
347347
}
348348

349-
/// Resturn `(match, residual)` to end of line. The EOL is returned with the
349+
/// Return `(match, residual)` to end of line. The EOL is returned with the
350350
/// residual.
351351
fn parse_to_newline(buf: &[u8]) -> (&[u8], &[u8]) {
352352
buf.iter().position(|ch| *ch == b'\n').map_or((buf, &[]), |pos| buf.split_at(pos))
@@ -358,7 +358,7 @@ fn normalize<'a>(MdStream(stream): MdStream<'a>, linkdefs: &mut Vec<MdTree<'a>>)
358358
let new_defs = stream.iter().filter(|tt| matches!(tt, MdTree::LinkDef { .. }));
359359
linkdefs.extend(new_defs.cloned());
360360

361-
// Run plaintest expansions on types that need it, call this function on nested types
361+
// Run plaintext expansions on types that need it, call this function on nested types
362362
for item in stream {
363363
match item {
364364
MdTree::PlainText(txt) => expand_plaintext(txt, &mut new_stream, MdTree::PlainText),

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2633,7 +2633,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
26332633
}
26342634

26352635
/// Returns the parameters of a function, with their generic parameters if those are the full
2636-
/// type of that parameter. Returns `None` if the function body is unavailable (eg is an instrinsic).
2636+
/// type of that parameter. Returns `None` if the function body is unavailable (eg is an intrinsic).
26372637
fn get_hir_params_with_generics(
26382638
&self,
26392639
def_id: DefId,

compiler/rustc_lint/src/if_let_rescope.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl IfLetRescope {
211211
}
212212
}
213213
}
214-
// At this point, any `if let` fragment in the cascade is definitely preceeded by `else`,
214+
// At this point, any `if let` fragment in the cascade is definitely preceded by `else`,
215215
// so a opening bracket is mandatory before each `match`.
216216
add_bracket_to_match_head = true;
217217
if let Some(alt) = alt {

compiler/rustc_lint/src/unqualified_local_imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ declare_lint! {
3131
///
3232
/// This lint is meant to be used with the (unstable) rustfmt setting `group_imports = "StdExternalCrate"`.
3333
/// That setting makes rustfmt group `self::`, `super::`, and `crate::` imports separately from those
34-
/// refering to other crates. However, rustfmt cannot know whether `use c::S;` refers to a local module `c`
34+
/// referring to other crates. However, rustfmt cannot know whether `use c::S;` refers to a local module `c`
3535
/// or an external crate `c`, so it always gets categorized as an import from another crate.
3636
/// To ensure consistent grouping of imports from the local crate, all local imports must
3737
/// start with `self::`, `super::`, or `crate::`. This lint can be used to enforce that style.

compiler/rustc_lint_defs/src/builtin.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4442,7 +4442,7 @@ declare_lint! {
44424442

44434443
declare_lint! {
44444444
/// The `refining_impl_trait_reachable` lint detects `impl Trait` return
4445-
/// types in method signatures that are refined by a publically reachable
4445+
/// types in method signatures that are refined by a publicly reachable
44464446
/// trait implementation, meaning the implementation adds information about
44474447
/// the return type that is not present in the trait.
44484448
///
@@ -4483,7 +4483,7 @@ declare_lint! {
44834483
///
44844484
/// `refining_impl_trait` is a lint group composed of two lints:
44854485
///
4486-
/// * `refining_impl_trait_reachable`, for refinements that are publically
4486+
/// * `refining_impl_trait_reachable`, for refinements that are publicly
44874487
/// reachable outside a crate, and
44884488
/// * `refining_impl_trait_internal`, for refinements that are only visible
44894489
/// within a crate.
@@ -4539,7 +4539,7 @@ declare_lint! {
45394539
///
45404540
/// `refining_impl_trait` is a lint group composed of two lints:
45414541
///
4542-
/// * `refining_impl_trait_reachable`, for refinements that are publically
4542+
/// * `refining_impl_trait_reachable`, for refinements that are publicly
45434543
/// reachable outside a crate, and
45444544
/// * `refining_impl_trait_internal`, for refinements that are only visible
45454545
/// within a crate.

compiler/rustc_llvm/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ fn main() {
220220
let mut cmd = Command::new(&llvm_config);
221221
cmd.arg(llvm_link_arg).arg("--libs");
222222

223-
// Don't link system libs if cross-compiling unless targetting Windows.
223+
// Don't link system libs if cross-compiling unless targeting Windows.
224224
// On Windows system DLLs aren't linked directly, instead import libraries are used.
225225
// These import libraries are independent of the host.
226226
if !is_crossed || target.contains("windows") {

compiler/rustc_middle/src/mir/syntax.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ pub enum StatementKind<'tcx> {
362362
/// computing these locals.
363363
///
364364
/// If the local is already allocated, calling `StorageLive` again will implicitly free the
365-
/// local and then allocate fresh uninitilized memory. If a local is already deallocated,
365+
/// local and then allocate fresh uninitialized memory. If a local is already deallocated,
366366
/// calling `StorageDead` again is a NOP.
367367
StorageLive(Local),
368368

compiler/rustc_middle/src/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1688,7 +1688,7 @@ impl<'tcx> Ty<'tcx> {
16881688
/// This is particularly useful for getting the type of the result of
16891689
/// [`UnOp::PtrMetadata`](crate::mir::UnOp::PtrMetadata).
16901690
///
1691-
/// Panics if `self` is not dereferencable.
1691+
/// Panics if `self` is not dereferenceable.
16921692
#[track_caller]
16931693
pub fn pointee_metadata_ty_or_projection(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
16941694
let Some(pointee_ty) = self.builtin_deref(true) else {

compiler/rustc_mir_build/src/check_tail_calls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'tcx> TailCallCkVisitor<'_, 'tcx> {
117117
self.report_arguments_mismatch(expr.span, caller_sig, callee_sig);
118118
}
119119

120-
// FIXME(explicit_tail_calls): this currenly fails for cases where opaques are used.
120+
// FIXME(explicit_tail_calls): this currently fails for cases where opaques are used.
121121
// e.g.
122122
// ```
123123
// fn a() -> impl Sized { become b() } // ICE

compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ fn extend_type_not_partial_eq<'tcx>(
373373
struct UsedParamsNeedInstantiationVisitor<'tcx> {
374374
tcx: TyCtxt<'tcx>,
375375
typing_env: ty::TypingEnv<'tcx>,
376-
/// The user has written `impl PartialEq for Ty` which means it's non-structual.
376+
/// The user has written `impl PartialEq for Ty` which means it's non-structural.
377377
adts_with_manual_partialeq: FxHashSet<Span>,
378378
/// The type has no `PartialEq` implementation, neither manual or derived.
379379
adts_without_partialeq: FxHashSet<Span>,
380-
/// The user has written `impl PartialEq for Ty` which means it's non-structual,
380+
/// The user has written `impl PartialEq for Ty` which means it's non-structural,
381381
/// but we don't have a span to point at, so we'll just add them as a `note`.
382382
manual: Vec<Ty<'tcx>>,
383383
/// The type has no `PartialEq` implementation, neither manual or derived, but

compiler/rustc_mir_transform/src/lint_tail_expr_drop_order.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ fn true_significant_drop_ty<'tcx>(
214214
}
215215
}
216216

217-
/// Returns the list of types with a "potentially sigificant" that may be dropped
217+
/// Returns the list of types with a "potentially significant" that may be dropped
218218
/// by dropping a value of type `ty`.
219219
#[instrument(level = "debug", skip(tcx, typing_env))]
220220
fn extract_component_raw<'tcx>(

compiler/rustc_monomorphize/src/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ fn collect_items_rec<'tcx>(
529529
});
530530
}
531531
// Only updating `usage_map` for used items as otherwise we may be inserting the same item
532-
// multiple times (if it is first 'mentioned' and then later actuall used), and the usage map
532+
// multiple times (if it is first 'mentioned' and then later actually used), and the usage map
533533
// logic does not like that.
534534
// This is part of the output of collection and hence only relevant for "used" items.
535535
// ("Mentioned" items are only considered internally during collection.)

compiler/rustc_monomorphize/src/partitioning.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ fn mono_item_visibility<'tcx>(
881881
// * First is weak lang items. These are basically mechanisms for
882882
// libcore to forward-reference symbols defined later in crates like
883883
// the standard library or `#[panic_handler]` definitions. The
884-
// definition of these weak lang items needs to be referencable by
884+
// definition of these weak lang items needs to be referenceable by
885885
// libcore, so we're no longer a candidate for internalization.
886886
// Removal of these functions can't be done by LLVM but rather must be
887887
// done by the linker as it's a non-local decision.

compiler/rustc_next_trait_solver/src/solve/effect_goals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ where
7373
/// Register additional assumptions for aliases corresponding to `~const` item bounds.
7474
///
7575
/// Unlike item bounds, they are not simply implied by the well-formedness of the alias.
76-
/// Instead, they only hold if the const conditons on the alias also hold. This is why
76+
/// Instead, they only hold if the const conditions on the alias also hold. This is why
7777
/// we also register the const conditions of the alias after matching the goal against
7878
/// the assumption.
7979
fn consider_additional_alias_assumptions(

compiler/rustc_parse/src/parser/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ impl<'a> Parser<'a> {
795795
// When there are a few keywords in the last ten elements of `self.expected_tokens` and the current
796796
// token is an identifier, it's probably a misspelled keyword.
797797
// This handles code like `async Move {}`, misspelled `if` in match guard, misspelled `else` in `if`-`else`
798-
// and mispelled `where` in a where clause.
798+
// and misspelled `where` in a where clause.
799799
if !expected_keywords.is_empty()
800800
&& !curr_ident.is_used_keyword()
801801
&& let Some(misspelled_kw) = find_similar_kw(curr_ident, &expected_keywords)

compiler/rustc_pattern_analysis/src/usefulness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
//! [`Constructor::is_covered_by`].
103103
//!
104104
//! Note 1: variable bindings (like the `x` in `Some(x)`) match anything, so we treat them as wildcards.
105-
//! Note 2: this only applies to matcheable values. For example a value of type `Rc<u64>` can't be
105+
//! Note 2: this only applies to matchable values. For example a value of type `Rc<u64>` can't be
106106
//! deconstructed that way.
107107
//!
108108
//!

compiler/rustc_resolve/src/late.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4253,7 +4253,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
42534253

42544254
#[inline]
42554255
/// If we're actually rustdoc then avoid giving a name resolution error for `cfg()` items or
4256-
// an invalid `use foo::*;` was found, which can cause unbounded ammounts of "item not found"
4256+
// an invalid `use foo::*;` was found, which can cause unbounded amounts of "item not found"
42574257
// errors. We silence them all.
42584258
fn should_report_errs(&self) -> bool {
42594259
!(self.r.tcx.sess.opts.actually_rustdoc && self.in_func_body)

compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4430,7 +4430,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
44304430
candidate_impls: &[ImplCandidate<'tcx>],
44314431
span: Span,
44324432
) {
4433-
// We can only suggest the slice coersion for function and binary operation arguments,
4433+
// We can only suggest the slice coercion for function and binary operation arguments,
44344434
// since the suggestion would make no sense in turbofish or call
44354435
let (ObligationCauseCode::BinOp { .. } | ObligationCauseCode::FunctionArg { .. }) =
44364436
obligation.cause.code()

compiler/rustc_trait_selection/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> {
649649
// Do not suggest constraining the `&self` param, but rather the return type.
650650
// If that is wrong (because it is not sufficient), a follow up error will tell the
651651
// user to fix it. This way we lower the chances of *over* constraining, but still
652-
// get the cake of "correctly" contrained in two steps.
652+
// get the cake of "correctly" constrained in two steps.
653653
visitor.visit_ty(self.ty_sup);
654654
}
655655
visitor.visit_ty(self.ty_sub);

compiler/rustc_trait_selection/src/traits/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ pub enum EvaluateConstErr {
492492
/// some unevaluated constant with either generic parameters or inference variables in its
493493
/// generic arguments.
494494
HasGenericsOrInfers,
495-
/// The type this constant evalauted to is not valid for use in const generics. This should
495+
/// The type this constant evaluated to is not valid for use in const generics. This should
496496
/// always result in an error when checking the constant is correctly typed for the parameter
497497
/// it is an argument to, so a bug is delayed when encountering this.
498498
InvalidConstParamTy(ErrorGuaranteed),
@@ -599,7 +599,7 @@ pub fn try_evaluate_const<'tcx>(
599599
// even though it is not something we should ever actually encounter.
600600
//
601601
// Array repeat expr counts are allowed to syntactically use generic parameters
602-
// but must not actually depend on them in order to evalaute succesfully. This means
602+
// but must not actually depend on them in order to evalaute successfully. This means
603603
// that it is actually fine to evalaute them in their own environment rather than with
604604
// the actually provided generic arguments.
605605
tcx.dcx().delayed_bug(

compiler/rustc_type_ir/src/infer_ctxt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{self as ty, Interner};
1212
/// slightly different typing rules depending on the current context. See the
1313
/// doc comment for each variant for how and why they are used.
1414
///
15-
/// In most cases you can get the correct typing mode automically via:
15+
/// In most cases you can get the correct typing mode automatically via:
1616
/// - `mir::Body::typing_mode`
1717
/// - `rustc_lint::LateContext::typing_mode`
1818
///

0 commit comments

Comments
 (0)