Skip to content

Commit e888a57

Browse files
committed
Auto merge of #84334 - klensy:typo-compiler, r=jyn514
fix few typos in comments
2 parents 9d9c2c9 + f43ee8e commit e888a57

File tree

32 files changed

+39
-39
lines changed

32 files changed

+39
-39
lines changed

compiler/rustc_ast/src/ast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ pub enum ExprKind {
13461346
Field(P<Expr>, Ident),
13471347
/// An indexing operation (e.g., `foo[2]`).
13481348
Index(P<Expr>, P<Expr>),
1349-
/// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`; and `..` in destructuring assingment).
1349+
/// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`; and `..` in destructuring assignment).
13501350
Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits),
13511351
/// An underscore, used in destructuring assignment to ignore a value.
13521352
Underscore,

compiler/rustc_ast/src/tokenstream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl AttrAnnotatedTokenStream {
301301
/// tokens.
302302
///
303303
/// For example, `#[cfg(FALSE)] struct Foo {}` would
304-
/// have an `attrs` field contaiing the `#[cfg(FALSE)]` attr,
304+
/// have an `attrs` field containing the `#[cfg(FALSE)]` attr,
305305
/// and a `tokens` field storing the (unparesd) tokens `struct Foo {}`
306306
#[derive(Clone, Debug, Encodable, Decodable)]
307307
pub struct AttributesData {

compiler/rustc_errors/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ struct HandlerInner {
321321

322322
/// This set contains the `DiagnosticId` of all emitted diagnostics to avoid
323323
/// emitting the same diagnostic with extended help (`--teach`) twice, which
324-
/// would be uneccessary repetition.
324+
/// would be unnecessary repetition.
325325
taught_diagnostics: FxHashSet<DiagnosticId>,
326326

327327
/// Used to suggest rustc --explain <error code>

compiler/rustc_expand/src/mbe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ enum KleeneOp {
6969
ZeroOrMore,
7070
/// Kleene plus (`+`) for one or more repetitions
7171
OneOrMore,
72-
/// Kleene optional (`?`) for zero or one reptitions
72+
/// Kleene optional (`?`) for zero or one repetitions
7373
ZeroOrOne,
7474
}
7575

compiler/rustc_expand/src/mbe/transcribe.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub(super) fn transcribe<'a>(
209209
}
210210
} else {
211211
// 0 is the initial counter (we have done 0 repretitions so far). `len`
212-
// is the total number of reptitions we should generate.
212+
// is the total number of repetitions we should generate.
213213
repeats.push((0, len));
214214

215215
// The first time we encounter the sequence we push it to the stack. It
@@ -362,7 +362,7 @@ impl LockstepIterSize {
362362
/// appropriate meta-vars in `interpolations`.
363363
///
364364
/// Note that if `repeats` does not match the exact correct depth of a meta-var,
365-
/// `lookup_cur_matched` will return `None`, which is why this still works even in the presnece of
365+
/// `lookup_cur_matched` will return `None`, which is why this still works even in the presence of
366366
/// multiple nested matcher sequences.
367367
fn lockstep_iter_size(
368368
tree: &mbe::TokenTree,

compiler/rustc_infer/src/infer/combine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
191191
///
192192
/// This also tests if the given const `ct` contains an inference variable which was previously
193193
/// unioned with `target_vid`. If this is the case, inferring `target_vid` to `ct`
194-
/// would result in an infinite type as we continously replace an inference variable
194+
/// would result in an infinite type as we continuously replace an inference variable
195195
/// in `ct` with `ct` itself.
196196
///
197197
/// This is especially important as unevaluated consts use their parents generics.

compiler/rustc_infer/src/infer/nll_relate/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ where
279279
/// Relate a type inference variable with a value type. This works
280280
/// by creating a "generalization" G of the value where all the
281281
/// lifetimes are replaced with fresh inference values. This
282-
/// genearlization G becomes the value of the inference variable,
282+
/// generalization G becomes the value of the inference variable,
283283
/// and is then related in turn to the value. So e.g. if you had
284284
/// `vid = ?0` and `value = &'a u32`, we might first instantiate
285285
/// `?0` to a type like `&'0 u32` where `'0` is a fresh variable,

compiler/rustc_lint/src/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3022,7 +3022,7 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
30223022
false
30233023
}
30243024

3025-
/// test if experssion is the literal `0`
3025+
/// test if expression is the literal `0`
30263026
fn is_zero(expr: &hir::Expr<'_>) -> bool {
30273027
match &expr.kind {
30283028
rustc_hir::ExprKind::Lit(ref lit) => {

compiler/rustc_lint_defs/src/builtin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,7 @@ declare_lint! {
24832483
///
24842484
/// On x86, `asm!` uses the intel assembly syntax by default. While this
24852485
/// can be switched using assembler directives like `.att_syntax`, using the
2486-
/// `att_syntax` option is recomended instead because it will also properly
2486+
/// `att_syntax` option is recommended instead because it will also properly
24872487
/// prefix register placeholders with `%` as required by AT&T syntax.
24882488
pub BAD_ASM_STYLE,
24892489
Warn,
@@ -2678,7 +2678,7 @@ declare_lint! {
26782678
/// Statics with an uninhabited type can never be initialized, so they are impossible to define.
26792679
/// However, this can be side-stepped with an `extern static`, leading to problems later in the
26802680
/// compiler which assumes that there are no initialized uninhabited places (such as locals or
2681-
/// statics). This was accientally allowed, but is being phased out.
2681+
/// statics). This was accidentally allowed, but is being phased out.
26822682
pub UNINHABITED_STATIC,
26832683
Warn,
26842684
"uninhabited static",

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static_assert_size!(InterpErrorInfo<'_>, 8);
4545

4646
/// Packages the kind of error we got from the const code interpreter
4747
/// up with a Rust-level backtrace of where the error occurred.
48-
/// Thsese should always be constructed by calling `.into()` on
48+
/// These should always be constructed by calling `.into()` on
4949
/// a `InterpError`. In `rustc_mir::interpret`, we have `throw_err_*`
5050
/// macros for this.
5151
#[derive(Debug)]

compiler/rustc_middle/src/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ pub enum StatementKind<'tcx> {
15211521
/// Marks the start of a "coverage region", injected with '-Zinstrument-coverage'. A
15221522
/// `Coverage` statement carries metadata about the coverage region, used to inject a coverage
15231523
/// map into the binary. If `Coverage::kind` is a `Counter`, the statement also generates
1524-
/// executable code, to increment a counter varible at runtime, each time the code region is
1524+
/// executable code, to increment a counter variable at runtime, each time the code region is
15251525
/// executed.
15261526
Coverage(Box<Coverage>),
15271527

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ rustc_queries! {
12801280
desc { "testing if a region is late bound" }
12811281
}
12821282
/// For a given item (like a struct), gets the default lifetimes to be used
1283-
/// for each paramter if a trait object were to be passed for that parameter.
1283+
/// for each parameter if a trait object were to be passed for that parameter.
12841284
/// For example, for `struct Foo<'a, T, U>`, this would be `['static, 'static]`.
12851285
/// For `struct Foo<'a, T: 'a, U>`, this would instead be `['a, 'static]`.
12861286
query object_lifetime_defaults_map(_: LocalDefId)

compiler/rustc_middle/src/ty/closure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl CapturedPlace<'tcx> {
160160
}
161161
}
162162

163-
/// Returns the `LocalDefId` of the closure that captureed this Place
163+
/// Returns the `LocalDefId` of the closure that captured this Place
164164
pub fn get_closure_local_def_id(&self) -> LocalDefId {
165165
match self.place.base {
166166
HirPlaceBase::Upvar(upvar_id) => upvar_id.closure_expr_id,

compiler/rustc_mir/src/borrow_check/diagnostics/outlives_suggestion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Contains utilities for generating suggestions for borrowck errors related to unsatisified
1+
//! Contains utilities for generating suggestions for borrowck errors related to unsatisfied
22
//! outlives constraints.
33
44
use std::collections::BTreeMap;

compiler/rustc_mir/src/const_eval/machine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<'mir, 'tcx> InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>> {
5353
/// Extra machine state for CTFE, and the Machine instance
5454
pub struct CompileTimeInterpreter<'mir, 'tcx> {
5555
/// For now, the number of terminators that can be evaluated before we throw a resource
56-
/// exhuastion error.
56+
/// exhaustion error.
5757
///
5858
/// Setting this to `0` disables the limit and allows the interpreter to run forever.
5959
pub steps_remaining: usize,

compiler/rustc_mir/src/dataflow/framework/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ impl EffectIndex {
510510
}
511511
}
512512

513-
/// Returns `true` if the effect at `self` should be applied eariler than the effect at `other`
513+
/// Returns `true` if the effect at `self` should be applied earlier than the effect at `other`
514514
/// in forward order.
515515
fn precedes_in_forward_order(self, other: Self) -> bool {
516516
let ord = self

compiler/rustc_mir/src/interpret/operand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl<'tcx, Tag: Copy> ImmTy<'tcx, Tag> {
225225
}
226226

227227
impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
228-
/// Normalice `place.ptr` to a `Pointer` if this is a place and not a ZST.
228+
/// Normalize `place.ptr` to a `Pointer` if this is a place and not a ZST.
229229
/// Can be helpful to avoid lots of `force_ptr` calls later, if this place is used a lot.
230230
#[inline]
231231
pub fn force_op_ptr(

compiler/rustc_mir/src/transform/check_consts/qualifs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ pub fn in_any_value_of_ty(
2929
/// Normally, we would determine what qualifications apply to each type and error when an illegal
3030
/// operation is performed on such a type. However, this was found to be too imprecise, especially
3131
/// in the presence of `enum`s. If only a single variant of an enum has a certain qualification, we
32-
/// needn't reject code unless it actually constructs and operates on the qualifed variant.
32+
/// needn't reject code unless it actually constructs and operates on the qualified variant.
3333
///
3434
/// To accomplish this, const-checking and promotion use a value-based analysis (as opposed to a
3535
/// type-based one). Qualifications propagate structurally across variables: If a local (or a
36-
/// projection of a local) is assigned a qualifed value, that local itself becomes qualifed.
36+
/// projection of a local) is assigned a qualified value, that local itself becomes qualified.
3737
pub trait Qualif {
3838
/// The name of the file used to debug the dataflow analysis that computes this qualif.
3939
const ANALYSIS_NAME: &'static str;

compiler/rustc_mir/src/transform/coverage/debug.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ fn bcb_to_string_sections(
816816
sections
817817
}
818818

819-
/// Returns a simple string representation of a `TerminatorKind` variant, indenpendent of any
819+
/// Returns a simple string representation of a `TerminatorKind` variant, independent of any
820820
/// values it might hold.
821821
pub(super) fn term_type(kind: &TerminatorKind<'tcx>) -> &'static str {
822822
match kind {

compiler/rustc_mir/src/transform/coverage/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! Also note, some basic features of `Span` also rely on the `Span`s own "session globals", which
1818
//! are unrelated to the `TyCtxt` global. Without initializing the `Span` session globals, some
1919
//! basic, coverage-specific features would be impossible to test, but thankfully initializing these
20-
//! globals is comparitively simpler. The easiest way is to wrap the test in a closure argument
20+
//! globals is comparatively simpler. The easiest way is to wrap the test in a closure argument
2121
//! to: `rustc_span::with_default_session_globals(|| { test_here(); })`.
2222
2323
use super::counters;

compiler/rustc_mir/src/util/find_self_call.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_middle::ty::subst::SubstsRef;
33
use rustc_middle::ty::{self, TyCtxt};
44
use rustc_span::def_id::DefId;
55

6-
/// Checks if the specified `local` is used as the `self` prameter of a method call
6+
/// Checks if the specified `local` is used as the `self` parameter of a method call
77
/// in the provided `BasicBlock`. If it is, then the `DefId` of the called method is
88
/// returned.
99
pub fn find_self_call<'tcx>(

compiler/rustc_mir_build/src/build/expr/as_place.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ crate struct PlaceBuilder<'tcx> {
8080
/// The projections are truncated to represent a path that might be captured by a
8181
/// closure/generator. This implies the vector returned from this function doesn't contain
8282
/// ProjectionElems `Downcast`, `ConstantIndex`, `Index`, or `Subslice` because those will never be
83-
/// part of a path that is captued by a closure. We stop applying projections once we see the first
83+
/// part of a path that is captured by a closure. We stop applying projections once we see the first
8484
/// projection that isn't captured by a closure.
8585
fn convert_to_hir_projections_and_truncate_for_capture<'tcx>(
8686
mir_projections: &[PlaceElem<'tcx>],
@@ -578,7 +578,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
578578

579579
/// Lower a captured upvar. Note we might not know the actual capture index,
580580
/// so we create a place starting from `PlaceBase::Upvar`, which will be resolved
581-
/// once all projections that allow us to indentify a capture have been applied.
581+
/// once all projections that allow us to identify a capture have been applied.
582582
fn lower_captured_upvar(
583583
&mut self,
584584
block: BasicBlock,

compiler/rustc_parse/src/parser/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1448,7 +1448,7 @@ impl<'a> Parser<'a> {
14481448
Ok((ident, ItemKind::MacroDef(ast::MacroDef { body, macro_rules: false })))
14491449
}
14501450

1451-
/// Is this unambiguously the start of a `macro_rules! foo` item defnition?
1451+
/// Is this unambiguously the start of a `macro_rules! foo` item definition?
14521452
fn is_macro_rules_item(&mut self) -> bool {
14531453
self.check_keyword(kw::MacroRules)
14541454
&& self.look_ahead(1, |t| *t == token::Not)

compiler/rustc_privacy/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {
11141114

11151115
////////////////////////////////////////////////////////////////////////////////////////////
11161116
/// Type privacy visitor, checks types for privacy and reports violations.
1117-
/// Both explicitly written types and inferred types of expressions and patters are checked.
1117+
/// Both explicitly written types and inferred types of expressions and patterns are checked.
11181118
/// Checks are performed on "semantic" types regardless of names and their hygiene.
11191119
////////////////////////////////////////////////////////////////////////////////////////////
11201120

compiler/rustc_resolve/src/late/lifetimes.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ enum Scope<'a> {
245245
opaque_type_parent: bool,
246246

247247
/// True only if this `Binder` scope is from the quantifiers on a
248-
/// `PolyTraitRef`. This is necessary for `assocated_type_bounds`, which
248+
/// `PolyTraitRef`. This is necessary for `associated_type_bounds`, which
249249
/// requires binders of nested trait refs to be merged.
250250
from_poly_trait_ref: bool,
251251

@@ -303,7 +303,7 @@ enum Scope<'a> {
303303
/// of. Other than that, if ask for bound vars for each, we expect
304304
/// `['a, 'b]`. If we *didn't* allow binders before `T`, then we would
305305
/// always introduce a binder scope at the inner trait ref. This is great,
306-
/// becauase later on during type-checking, we will ask "what are the late
306+
/// because later on during type-checking, we will ask "what are the late
307307
/// bound vars on this trait ref". However, because we allow bound vars on
308308
/// the bound itself, we have to have some way of keeping track of the fact
309309
/// that we actually want to store the late bound vars as being associated

compiler/rustc_span/src/hygiene.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ pub struct ExpnData {
748748

749749
/// Used to force two `ExpnData`s to have different `Fingerprint`s.
750750
/// Due to macro expansion, it's possible to end up with two `ExpnId`s
751-
/// that have identical `ExpnData`s. This violates the constract of `HashStable`
751+
/// that have identical `ExpnData`s. This violates the contract of `HashStable`
752752
/// - the two `ExpnId`s are not equal, but their `Fingerprint`s are equal
753753
/// (since the numerical `ExpnId` value is not considered by the `HashStable`
754754
/// implementation).

compiler/rustc_target/src/abi/call/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ mod attr_impl {
7373
}
7474

7575
/// Sometimes an ABI requires small integers to be extended to a full or partial register. This enum
76-
/// defines if this extension should be zero-extension or sign-extension when necssary. When it is
77-
/// not necesary to extend the argument, this enum is ignored.
76+
/// defines if this extension should be zero-extension or sign-extension when necessary. When it is
77+
/// not necessary to extend the argument, this enum is ignored.
7878
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
7979
pub enum ArgExtension {
8080
None,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,7 @@ pub enum ArgKind {
19541954
Arg(String, String),
19551955

19561956
/// An argument of tuple type. For a "found" argument, the span is
1957-
/// the locationo in the source of the pattern. For a "expected"
1957+
/// the location in the source of the pattern. For a "expected"
19581958
/// argument, it will be None. The vector is a list of (name, ty)
19591959
/// strings for the components of the tuple.
19601960
Tuple(Option<Span>, Vec<(String, String)>),

compiler/rustc_trait_selection/src/traits/select/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
944944
/// subobligations without taking in a 'parent' depth, causing the
945945
/// generated subobligations to have a `recursion_depth` of `0`.
946946
///
947-
/// To ensure that obligation_depth never decreasees, we force all subobligations
947+
/// To ensure that obligation_depth never decreases, we force all subobligations
948948
/// to have at least the depth of the original obligation.
949949
fn add_depth<T: 'cx, I: Iterator<Item = &'cx mut Obligation<'tcx, T>>>(
950950
&self,

compiler/rustc_typeck/src/check/method/probe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ enum ProbeResult {
158158

159159
/// When adjusting a receiver we often want to do one of
160160
///
161-
/// - Add a `&` (or `&mut`), converting the recevier from `T` to `&T` (or `&mut T`)
161+
/// - Add a `&` (or `&mut`), converting the receiver from `T` to `&T` (or `&mut T`)
162162
/// - If the receiver has type `*mut T`, convert it to `*const T`
163163
///
164164
/// This type tells us which one to do.

compiler/rustc_typeck/src/check/upvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ fn migration_suggestion_for_2229(
15881588
/// If both the CaptureKind and Expression are considered to be equivalent,
15891589
/// then `CaptureInfo` A is preferred. This can be useful in cases where we want to priortize
15901590
/// expressions reported back to the user as part of diagnostics based on which appears earlier
1591-
/// in the closure. This can be acheived simply by calling
1591+
/// in the closure. This can be achieved simply by calling
15921592
/// `determine_capture_info(existing_info, current_info)`. This works out because the
15931593
/// expressions that occur earlier in the closure body than the current expression are processed before.
15941594
/// Consider the following example

compiler/rustc_typeck/src/expr_use_visitor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
671671
/// In the following example the closures `c` only captures `p.x`` even though `incr`
672672
/// is a capture of the nested closure
673673
///
674-
/// ```rust,ignore(cannot-test-this-because-pseduo-code)
674+
/// ```rust,ignore(cannot-test-this-because-pseudo-code)
675675
/// let p = ..;
676676
/// let c = || {
677677
/// let incr = 10;
@@ -715,7 +715,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
715715
// The only places we want to fake read before creating the parent closure are the ones that
716716
// are not local to it/ defined by it.
717717
//
718-
// ```rust,ignore(cannot-test-this-because-pseduo-code)
718+
// ```rust,ignore(cannot-test-this-because-pseudo-code)
719719
// let v1 = (0, 1);
720720
// let c = || { // fake reads: v1
721721
// let v2 = (0, 1);

0 commit comments

Comments
 (0)