Skip to content

Commit 00de006

Browse files
committed
chore: Fix typos in 'compiler' (batch 2)
1 parent 78d5c04 commit 00de006

File tree

34 files changed

+54
-54
lines changed

34 files changed

+54
-54
lines changed

compiler/rustc_lint/src/context/diagnostics/check_cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub(super) fn unexpected_cfg_value(
267267
// encouraged to do so.
268268
let can_suggest_adding_value = !sess.psess.check_config.well_known_names.contains(&name)
269269
// Except when working on rustc or the standard library itself, in which case we want to
270-
// suggest adding these cfgs to the "normal" place because of bootstraping reasons. As a
270+
// suggest adding these cfgs to the "normal" place because of bootstrapping reasons. As a
271271
// basic heuristic, we use the "cheat" unstable feature enable method and the
272272
// non-ui-testing enabled option.
273273
|| (matches!(sess.psess.unstable_features, rustc_feature::UnstableFeatures::Cheat)

compiler/rustc_middle/src/mir/consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ impl<'tcx> Const<'tcx> {
240240
match self {
241241
Const::Ty(ty, ct) => {
242242
match ct.kind() {
243-
// Dont use the outter ty as on invalid code we can wind up with them not being the same.
243+
// Dont use the outer ty as on invalid code we can wind up with them not being the same.
244244
// this then results in allowing const eval to add `1_i64 + 1_usize` in cases where the mir
245245
// was originally `({N: usize} + 1_usize)` under `generic_const_exprs`.
246246
ty::ConstKind::Value(ty, _) => ty,

compiler/rustc_middle/src/mir/interpret/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled
9191
pub type EvalStaticInitializerRawResult<'tcx> = Result<ConstAllocation<'tcx>, ErrorHandled>;
9292
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
9393
/// `Ok(Err(ty))` indicates the constant was fine, but the valtree couldn't be constructed
94-
/// because the value containts something of type `ty` that is not valtree-compatible.
94+
/// because the value contains something of type `ty` that is not valtree-compatible.
9595
/// The caller can then show an appropriate error; the query does not have the
96-
/// necssary context to give good user-facing errors for this case.
96+
/// necessary context to give good user-facing errors for this case.
9797
pub type EvalToValTreeResult<'tcx> = Result<Result<ValTree<'tcx>, Ty<'tcx>>, ErrorHandled>;
9898

9999
#[cfg(target_pointer_width = "64")]
@@ -231,7 +231,7 @@ pub enum CheckInAllocMsg {
231231
pub enum CheckAlignMsg {
232232
/// The accessed pointer did not have proper alignment.
233233
AccessedPtr,
234-
/// The access ocurred with a place that was based on a misaligned pointer.
234+
/// The access occurred with a place that was based on a misaligned pointer.
235235
BasedOn,
236236
}
237237

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ rustc_queries! {
327327
}
328328
}
329329

330-
/// Returns the list of bounds that are required to be satsified
330+
/// Returns the list of bounds that are required to be satisfied
331331
/// by a implementation or definition. For associated types, these
332332
/// must be satisfied for an implementation to be well-formed,
333333
/// and for opaque types, these are required to be satisfied by

compiler/rustc_middle/src/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,7 @@ impl<'tcx> TyCtxt<'tcx> {
14751475
/// provides a `TyCtxt`.
14761476
///
14771477
/// By only providing the `TyCtxt` inside of the closure we enforce that the type
1478-
/// context and any interned alue (types, args, etc.) can only be used while `ty::tls`
1478+
/// context and any interned value (types, args, etc.) can only be used while `ty::tls`
14791479
/// has a valid reference to the context, to allow formatting values that need it.
14801480
pub fn create_global_ctxt(
14811481
s: &'tcx Session,

compiler/rustc_middle/src/ty/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct Instance<'tcx> {
3838
pub args: GenericArgsRef<'tcx>,
3939
}
4040

41-
/// Describes why a `ReifyShim` was created. This is needed to distingish a ReifyShim created to
41+
/// Describes why a `ReifyShim` was created. This is needed to distinguish a ReifyShim created to
4242
/// adjust for things like `#[track_caller]` in a vtable from a `ReifyShim` created to produce a
4343
/// function pointer from a vtable entry.
4444
/// Currently, this is only used when KCFI is enabled, as only KCFI needs to treat those two

compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ impl<'tcx> TyCtxt<'tcx> {
18191819
self.get_attrs(did, attr).next().is_some()
18201820
}
18211821

1822-
/// Determines whether an item is annotated with a multi-segement attribute
1822+
/// Determines whether an item is annotated with a multi-segment attribute
18231823
pub fn has_attrs_with_path(self, did: impl Into<DefId>, attrs: &[Symbol]) -> bool {
18241824
self.get_attrs_by_path(did.into(), attrs).next().is_some()
18251825
}

compiler/rustc_middle/src/ty/sty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1930,7 +1930,7 @@ impl<'tcx> Ty<'tcx> {
19301930

19311931
/// Returns `true` when the outermost type cannot be further normalized,
19321932
/// resolved, or instantiated. This includes all primitive types, but also
1933-
/// things like ADTs and trait objects, sice even if their arguments or
1933+
/// things like ADTs and trait objects, since even if their arguments or
19341934
/// nested types may be further simplified, the outermost [`TyKind`] or
19351935
/// type constructor remains the same.
19361936
pub fn is_known_rigid(self) -> bool {

compiler/rustc_mir_transform/src/dead_store_elimination.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn eliminate<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
3232
let borrowed_locals = borrowed_locals(body);
3333

3434
// If the user requests complete debuginfo, mark the locals that appear in it as live, so
35-
// we don't remove assignements to them.
35+
// we don't remove assignments to them.
3636
let mut always_live = debuginfo_locals(body);
3737
always_live.union(&borrowed_locals);
3838

compiler/rustc_mir_transform/src/dest_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
//! not contain any indirection through a pointer or any indexing projections.
3939
//!
4040
//! * `p` and `q` must have the **same type**. If we replace a local with a subtype or supertype,
41-
//! we may end up with a differnet vtable for that local. See the `subtyping-impacts-selection`
41+
//! we may end up with a different vtable for that local. See the `subtyping-impacts-selection`
4242
//! tests for an example where that causes issues.
4343
//!
4444
//! * We need to make sure that the goal of "merging the memory" is actually structurally possible

compiler/rustc_mir_transform/src/known_panics_lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ impl<'tcx> Visitor<'tcx> for CanConstProp {
914914
fn visit_place(&mut self, place: &Place<'tcx>, mut context: PlaceContext, loc: Location) {
915915
use rustc_middle::mir::visit::PlaceContext::*;
916916

917-
// Dereferencing just read the addess of `place.local`.
917+
// Dereferencing just read the address of `place.local`.
918918
if place.projection.first() == Some(&PlaceElem::Deref) {
919919
context = NonMutatingUse(NonMutatingUseContext::Copy);
920920
}

compiler/rustc_mir_transform/src/match_branches.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ fn can_cast(
289289

290290
#[derive(Default)]
291291
struct SimplifyToExp {
292-
transfrom_kinds: Vec<TransfromKind>,
292+
transform_kinds: Vec<TransformKind>,
293293
}
294294

295295
#[derive(Clone, Copy)]
@@ -302,17 +302,17 @@ enum ExpectedTransformKind<'tcx, 'a> {
302302
Cast { place: &'a Place<'tcx>, ty: Ty<'tcx> },
303303
}
304304

305-
enum TransfromKind {
305+
enum TransformKind {
306306
Same,
307307
Cast,
308308
}
309309

310-
impl From<ExpectedTransformKind<'_, '_>> for TransfromKind {
310+
impl From<ExpectedTransformKind<'_, '_>> for TransformKind {
311311
fn from(compare_type: ExpectedTransformKind<'_, '_>) -> Self {
312312
match compare_type {
313-
ExpectedTransformKind::Same(_) => TransfromKind::Same,
314-
ExpectedTransformKind::SameByEq { .. } => TransfromKind::Same,
315-
ExpectedTransformKind::Cast { .. } => TransfromKind::Cast,
313+
ExpectedTransformKind::Same(_) => TransformKind::Same,
314+
ExpectedTransformKind::SameByEq { .. } => TransformKind::Same,
315+
ExpectedTransformKind::Cast { .. } => TransformKind::Cast,
316316
}
317317
}
318318
}
@@ -475,7 +475,7 @@ impl<'tcx> SimplifyMatch<'tcx> for SimplifyToExp {
475475
}
476476
}
477477
}
478-
self.transfrom_kinds = expected_transform_kinds.into_iter().map(|c| c.into()).collect();
478+
self.transform_kinds = expected_transform_kinds.into_iter().map(|c| c.into()).collect();
479479
Some(())
480480
}
481481

@@ -493,13 +493,13 @@ impl<'tcx> SimplifyMatch<'tcx> for SimplifyToExp {
493493
let (_, first) = targets.iter().next().unwrap();
494494
let first = &bbs[first];
495495

496-
for (t, s) in iter::zip(&self.transfrom_kinds, &first.statements) {
496+
for (t, s) in iter::zip(&self.transform_kinds, &first.statements) {
497497
match (t, &s.kind) {
498-
(TransfromKind::Same, _) => {
498+
(TransformKind::Same, _) => {
499499
patch.add_statement(parent_end, s.kind.clone());
500500
}
501501
(
502-
TransfromKind::Cast,
502+
TransformKind::Cast,
503503
StatementKind::Assign(box (lhs, Rvalue::Use(Operand::Constant(f_c)))),
504504
) => {
505505
let operand = Operand::Copy(Place::from(discr_local));

compiler/rustc_mir_transform/src/promote_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ impl<'tcx> Validator<'_, 'tcx> {
498498
Some(x) if x != 0 => {} // okay
499499
_ => return Err(Unpromotable), // value not known or 0 -- not okay
500500
}
501-
// Furthermore, for signed divison, we also have to exclude `int::MIN / -1`.
501+
// Furthermore, for signed division, we also have to exclude `int::MIN / -1`.
502502
if lhs_ty.is_signed() {
503503
match rhs_val.map(|x| x.to_int(sz)) {
504504
Some(-1) | None => {

compiler/rustc_mir_transform/src/ref_prop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ fn fully_replacable_locals(ssa: &SsaLocals) -> BitSet<Local> {
345345
replacable
346346
}
347347

348-
/// Utility to help performing subtitution of `*pattern` by `target`.
348+
/// Utility to help performing substitution of `*pattern` by `target`.
349349
struct Replacer<'tcx> {
350350
tcx: TyCtxt<'tcx>,
351351
targets: IndexVec<Local, Value<'tcx>>,

compiler/rustc_monomorphize/src/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ fn collect_items_rec<'tcx>(
397397
MonoItem::Static(def_id) => {
398398
recursion_depth_reset = None;
399399

400-
// Statics always get evaluted (which is possible because they can't be generic), so for
400+
// Statics always get evaluated (which is possible because they can't be generic), so for
401401
// `MentionedItems` collection there's nothing to do here.
402402
if mode == CollectionMode::UsedItems {
403403
let instance = Instance::mono(tcx, def_id);

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ where
238238
(normalization_nested_goals.clone(), certainty)
239239
}
240240

241-
/// This returns the canoncial variable values to instantiate the bound variables of
241+
/// This returns the canonical variable values to instantiate the bound variables of
242242
/// the canonical response. This depends on the `original_values` for the
243243
/// bound variables.
244244
fn compute_query_response_instantiation_values<T: ResponseT<I>>(

compiler/rustc_next_trait_solver/src/solve/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ where
164164
// - `Bound` cannot exist as we don't have a binder around the self Type
165165
// - `Expr` is part of `feature(generic_const_exprs)` and is not implemented yet
166166
ty::ConstKind::Param(_) | ty::ConstKind::Bound(_, _) | ty::ConstKind::Expr(_) => {
167-
panic!("unexpect const kind: {:?}", ct)
167+
panic!("unexpected const kind: {:?}", ct)
168168
}
169169
}
170170
}

compiler/rustc_next_trait_solver/src/solve/trait_goals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ where
628628
}
629629

630630
// FIXME: This actually should destructure the `Result` we get from transmutability and
631-
// register candiates. We probably need to register >1 since we may have an OR of ANDs.
631+
// register candidates. We probably need to register >1 since we may have an OR of ANDs.
632632
ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {
633633
let certainty = ecx.is_transmutable(
634634
goal.param_env,

compiler/rustc_parse/src/parser/pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ impl<'a> Parser<'a> {
402402
let non_assoc_span = expr.span;
403403

404404
// Parse an associative expression such as `+ expr`, `% expr`, ...
405-
// Assignements, ranges and `|` are disabled by [`Restrictions::IS_PAT`].
405+
// Assignments, ranges and `|` are disabled by [`Restrictions::IS_PAT`].
406406
if let Ok((expr, _)) =
407407
snapshot.parse_expr_assoc_rest_with(0, false, expr).map_err(|err| err.cancel())
408408
{

compiler/rustc_passes/src/dead.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
439439
_ => intravisit::walk_item(self, item),
440440
},
441441
Node::TraitItem(trait_item) => {
442-
// mark corresponing ImplTerm live
442+
// mark corresponding ImplTerm live
443443
let trait_item_id = trait_item.owner_id.to_def_id();
444444
if let Some(trait_id) = self.tcx.trait_of_item(trait_item_id) {
445445
// mark the trait live
@@ -1035,7 +1035,7 @@ impl<'tcx> DeadVisitor<'tcx> {
10351035
};
10361036

10371037
let encl_def_id = parent_item.unwrap_or(first_item.def_id);
1038-
// If parent of encl_def_id is an enum, use the parent ID intead.
1038+
// If parent of encl_def_id is an enum, use the parent ID instead.
10391039
let encl_def_id = get_parent_if_enum_variant(tcx, encl_def_id);
10401040

10411041
let ignored_derived_impls =

compiler/rustc_pattern_analysis/src/constructor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl IntRange {
288288
/// Best effort; will not know that e.g. `255u8..` is a singleton.
289289
pub fn is_singleton(&self) -> bool {
290290
// Since `lo` and `hi` can't be the same `Infinity` and `plus_one` never changes from finite
291-
// to infinite, this correctly only detects ranges that contain exacly one `Finite(x)`.
291+
// to infinite, this correctly only detects ranges that contain exactly one `Finite(x)`.
292292
self.lo.plus_one() == Some(self.hi)
293293
}
294294

compiler/rustc_pattern_analysis/tests/exhaustiveness.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn check(patterns: Vec<DeconstructedPat<Cx>>) -> Vec<WitnessPat<Cx>> {
2222
fn assert_exhaustive(patterns: Vec<DeconstructedPat<Cx>>) {
2323
let witnesses = check(patterns);
2424
if !witnesses.is_empty() {
25-
panic!("non-exaustive match: missing {witnesses:?}");
25+
panic!("non-exhaustive match: missing {witnesses:?}");
2626
}
2727
}
2828

compiler/rustc_query_system/src/dep_graph/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ fn panic_on_forbidden_read<D: Deps>(data: &DepGraphData<D>, dep_node_index: DepN
14051405
"Error: trying to record dependency on DepNode {dep_node} in a \
14061406
context that does not allow it (e.g. during query deserialization). \
14071407
The most common case of recording a dependency on a DepNode `foo` is \
1408-
when the correspondng query `foo` is invoked. Invoking queries is not \
1408+
when the corresponding query `foo` is invoked. Invoking queries is not \
14091409
allowed as part of loading something from the incremental on-disk cache. \
14101410
See <https://github.com/rust-lang/rust/pull/91919>."
14111411
)

compiler/rustc_resolve/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resolve_added_macro_use =
1111
resolve_ancestor_only =
1212
visibilities can only be restricted to ancestor modules
1313
14-
resolve_anonymous_livetime_non_gat_report_error =
14+
resolve_anonymous_lifetime_non_gat_report_error =
1515
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
1616
.label = this lifetime must come from the implemented type
1717

compiler/rustc_resolve/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ pub(crate) struct LendingIteratorReportError {
894894
}
895895

896896
#[derive(Diagnostic)]
897-
#[diag(resolve_anonymous_livetime_non_gat_report_error)]
897+
#[diag(resolve_anonymous_lifetime_non_gat_report_error)]
898898
pub(crate) struct AnonymousLivetimeNonGatReportError {
899899
#[primary_span]
900900
#[label]

compiler/rustc_resolve/src/ident.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
445445
}
446446
}
447447
Scope::DeriveHelpersCompat => {
448-
// FIXME: Try running this logic eariler, to allocate name bindings for
448+
// FIXME: Try running this logic earlier, to allocate name bindings for
449449
// legacy derive helpers when creating an attribute invocation with
450450
// following derives. Legacy derive helpers are not common, so it shouldn't
451451
// affect performance. It should also allow to remove the `derives`

compiler/rustc_resolve/src/late.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub(crate) enum NoConstantGenericsReason {
133133
/// Const arguments are only allowed to use generic parameters when:
134134
/// - `feature(generic_const_exprs)` is enabled
135135
/// or
136-
/// - the const argument is a sole const generic paramater, i.e. `foo::<{ N }>()`
136+
/// - the const argument is a sole const generic parameter, i.e. `foo::<{ N }>()`
137137
///
138138
/// If neither of the above are true then this is used as the cause.
139139
NonTrivialConstArg,
@@ -4486,7 +4486,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
44864486

44874487
/// There are a few places that we need to resolve an anon const but we did not parse an
44884488
/// anon const so cannot provide an `&'ast AnonConst`. Right now this is just unbraced
4489-
/// const arguments that were parsed as type arguments, and `legact_const_generics` which
4489+
/// const arguments that were parsed as type arguments, and `legacy_const_generics` which
44904490
/// parse as normal function argument expressions. To avoid duplicating the code for resolving
44914491
/// an anon const we have this function which lets the caller manually call `resolve_expr` or
44924492
/// `smart_resolve_path`.

compiler/rustc_resolve/src/rustdoc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ pub(crate) fn attrs_to_preprocessed_links(attrs: &[ast::Attribute]) -> Vec<Box<s
417417
parse_links(&doc)
418418
}
419419

420-
/// Similiar version of `markdown_links` from rustdoc.
420+
/// Similar version of `markdown_links` from rustdoc.
421421
/// This will collect destination links and display text if exists.
422422
fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
423423
let mut broken_link_callback = |link: BrokenLink<'md>| Some((link.reference, "".into()));

compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc
262262
/// mangling.
263263
///
264264
/// typeid_for_instance is called at two locations, initially when declaring/defining functions and
265-
/// methods, and later during code generation at call sites, after type erasure might have ocurred.
265+
/// methods, and later during code generation at call sites, after type erasure might have occurred.
266266
///
267267
/// In the first call (i.e., when declaring/defining functions and methods), it encodes type ids for
268268
/// an FnAbi or Instance, and these type ids are attached to functions and methods. (These type ids
269269
/// are used later by the LowerTypeTests LLVM pass to aggregate functions in groups derived from
270270
/// these type ids.)
271271
///
272272
/// In the second call (i.e., during code generation at call sites), it encodes a type id for an
273-
/// FnAbi or Instance, after type erasure might have occured, and this type id is used for testing
273+
/// FnAbi or Instance, after type erasure might have occurred, and this type id is used for testing
274274
/// if a function is member of the group derived from this type id. Therefore, in the first call to
275275
/// typeid_for_fnabi (when type ids are attached to functions and methods), it can only include at
276276
/// 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>(
365365
// of the trait that defines the method.
366366
if let Some((trait_ref, method_id, ancestor)) = implemented_method(tcx, instance) {
367367
// Trait methods will have a Self polymorphic parameter, where the concreteized
368-
// implementatation will not. We need to walk back to the more general trait method
368+
// implementation will not. We need to walk back to the more general trait method
369369
let trait_ref = tcx.instantiate_and_normalize_erasing_regions(
370370
instance.args,
371371
ty::ParamEnv::reveal_all(),

compiler/rustc_serialize/src/opaque.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl FileEncoder {
159159
// We produce a post-mono error if N > BUF_SIZE.
160160
let buf = unsafe { self.buffer_empty().first_chunk_mut::<N>().unwrap_unchecked() };
161161
let written = visitor(buf);
162-
// We have to ensure that an errant visitor cannot cause self.buffered to exeed BUF_SIZE.
162+
// We have to ensure that an errant visitor cannot cause self.buffered to exceed BUF_SIZE.
163163
if written > N {
164164
Self::panic_invalid_write::<N>(written);
165165
}

0 commit comments

Comments
 (0)