Skip to content

fix few typos in comments #84334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ pub enum ExprKind {
Field(P<Expr>, Ident),
/// An indexing operation (e.g., `foo[2]`).
Index(P<Expr>, P<Expr>),
/// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`; and `..` in destructuring assingment).
/// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`; and `..` in destructuring assignment).
Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits),
/// An underscore, used in destructuring assignment to ignore a value.
Underscore,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast/src/tokenstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl AttrAnnotatedTokenStream {
/// tokens.
///
/// For example, `#[cfg(FALSE)] struct Foo {}` would
/// have an `attrs` field contaiing the `#[cfg(FALSE)]` attr,
/// have an `attrs` field containing the `#[cfg(FALSE)]` attr,
/// and a `tokens` field storing the (unparesd) tokens `struct Foo {}`
#[derive(Clone, Debug, Encodable, Decodable)]
pub struct AttributesData {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ struct HandlerInner {

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

/// Used to suggest rustc --explain <error code>
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/mbe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ enum KleeneOp {
ZeroOrMore,
/// Kleene plus (`+`) for one or more repetitions
OneOrMore,
/// Kleene optional (`?`) for zero or one reptitions
/// Kleene optional (`?`) for zero or one repetitions
ZeroOrOne,
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_expand/src/mbe/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub(super) fn transcribe<'a>(
}
} else {
// 0 is the initial counter (we have done 0 repretitions so far). `len`
// is the total number of reptitions we should generate.
// is the total number of repetitions we should generate.
repeats.push((0, len));

// The first time we encounter the sequence we push it to the stack. It
Expand Down Expand Up @@ -362,7 +362,7 @@ impl LockstepIterSize {
/// appropriate meta-vars in `interpolations`.
///
/// Note that if `repeats` does not match the exact correct depth of a meta-var,
/// `lookup_cur_matched` will return `None`, which is why this still works even in the presnece of
/// `lookup_cur_matched` will return `None`, which is why this still works even in the presence of
/// multiple nested matcher sequences.
fn lockstep_iter_size(
tree: &mbe::TokenTree,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
///
/// This also tests if the given const `ct` contains an inference variable which was previously
/// unioned with `target_vid`. If this is the case, inferring `target_vid` to `ct`
/// would result in an infinite type as we continously replace an inference variable
/// would result in an infinite type as we continuously replace an inference variable
/// in `ct` with `ct` itself.
///
/// This is especially important as unevaluated consts use their parents generics.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_infer/src/infer/nll_relate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ where
/// Relate a type inference variable with a value type. This works
/// by creating a "generalization" G of the value where all the
/// lifetimes are replaced with fresh inference values. This
/// genearlization G becomes the value of the inference variable,
/// generalization G becomes the value of the inference variable,
/// and is then related in turn to the value. So e.g. if you had
/// `vid = ?0` and `value = &'a u32`, we might first instantiate
/// `?0` to a type like `&'0 u32` where `'0` is a fresh variable,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3022,7 +3022,7 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
false
}

/// test if experssion is the literal `0`
/// test if expression is the literal `0`
fn is_zero(expr: &hir::Expr<'_>) -> bool {
match &expr.kind {
rustc_hir::ExprKind::Lit(ref lit) => {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2483,7 +2483,7 @@ declare_lint! {
///
/// On x86, `asm!` uses the intel assembly syntax by default. While this
/// can be switched using assembler directives like `.att_syntax`, using the
/// `att_syntax` option is recomended instead because it will also properly
/// `att_syntax` option is recommended instead because it will also properly
/// prefix register placeholders with `%` as required by AT&T syntax.
pub BAD_ASM_STYLE,
Warn,
Expand Down Expand Up @@ -2678,7 +2678,7 @@ declare_lint! {
/// Statics with an uninhabited type can never be initialized, so they are impossible to define.
/// However, this can be side-stepped with an `extern static`, leading to problems later in the
/// compiler which assumes that there are no initialized uninhabited places (such as locals or
/// statics). This was accientally allowed, but is being phased out.
/// statics). This was accidentally allowed, but is being phased out.
pub UNINHABITED_STATIC,
Warn,
"uninhabited static",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ static_assert_size!(InterpErrorInfo<'_>, 8);

/// Packages the kind of error we got from the const code interpreter
/// up with a Rust-level backtrace of where the error occurred.
/// Thsese should always be constructed by calling `.into()` on
/// These should always be constructed by calling `.into()` on
/// a `InterpError`. In `rustc_mir::interpret`, we have `throw_err_*`
/// macros for this.
#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ pub enum StatementKind<'tcx> {
/// Marks the start of a "coverage region", injected with '-Zinstrument-coverage'. A
/// `Coverage` statement carries metadata about the coverage region, used to inject a coverage
/// map into the binary. If `Coverage::kind` is a `Counter`, the statement also generates
/// executable code, to increment a counter varible at runtime, each time the code region is
/// executable code, to increment a counter variable at runtime, each time the code region is
/// executed.
Coverage(Box<Coverage>),

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ rustc_queries! {
desc { "testing if a region is late bound" }
}
/// For a given item (like a struct), gets the default lifetimes to be used
/// for each paramter if a trait object were to be passed for that parameter.
/// for each parameter if a trait object were to be passed for that parameter.
/// For example, for `struct Foo<'a, T, U>`, this would be `['static, 'static]`.
/// For `struct Foo<'a, T: 'a, U>`, this would instead be `['a, 'static]`.
query object_lifetime_defaults_map(_: LocalDefId)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl CapturedPlace<'tcx> {
}
}

/// Returns the `LocalDefId` of the closure that captureed this Place
/// Returns the `LocalDefId` of the closure that captured this Place
pub fn get_closure_local_def_id(&self) -> LocalDefId {
match self.place.base {
HirPlaceBase::Upvar(upvar_id) => upvar_id.closure_expr_id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Contains utilities for generating suggestions for borrowck errors related to unsatisified
//! Contains utilities for generating suggestions for borrowck errors related to unsatisfied
//! outlives constraints.

use std::collections::BTreeMap;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/const_eval/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<'mir, 'tcx> InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>> {
/// Extra machine state for CTFE, and the Machine instance
pub struct CompileTimeInterpreter<'mir, 'tcx> {
/// For now, the number of terminators that can be evaluated before we throw a resource
/// exhuastion error.
/// exhaustion error.
///
/// Setting this to `0` disables the limit and allows the interpreter to run forever.
pub steps_remaining: usize,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/dataflow/framework/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ impl EffectIndex {
}
}

/// Returns `true` if the effect at `self` should be applied eariler than the effect at `other`
/// Returns `true` if the effect at `self` should be applied earlier than the effect at `other`
/// in forward order.
fn precedes_in_forward_order(self, other: Self) -> bool {
let ord = self
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl<'tcx, Tag: Copy> ImmTy<'tcx, Tag> {
}

impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
/// Normalice `place.ptr` to a `Pointer` if this is a place and not a ZST.
/// Normalize `place.ptr` to a `Pointer` if this is a place and not a ZST.
/// Can be helpful to avoid lots of `force_ptr` calls later, if this place is used a lot.
#[inline]
pub fn force_op_ptr(
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir/src/transform/check_consts/qualifs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ pub fn in_any_value_of_ty(
/// Normally, we would determine what qualifications apply to each type and error when an illegal
/// operation is performed on such a type. However, this was found to be too imprecise, especially
/// in the presence of `enum`s. If only a single variant of an enum has a certain qualification, we
/// needn't reject code unless it actually constructs and operates on the qualifed variant.
/// needn't reject code unless it actually constructs and operates on the qualified variant.
///
/// To accomplish this, const-checking and promotion use a value-based analysis (as opposed to a
/// type-based one). Qualifications propagate structurally across variables: If a local (or a
/// projection of a local) is assigned a qualifed value, that local itself becomes qualifed.
/// projection of a local) is assigned a qualified value, that local itself becomes qualified.
pub trait Qualif {
/// The name of the file used to debug the dataflow analysis that computes this qualif.
const ANALYSIS_NAME: &'static str;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/transform/coverage/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ fn bcb_to_string_sections(
sections
}

/// Returns a simple string representation of a `TerminatorKind` variant, indenpendent of any
/// Returns a simple string representation of a `TerminatorKind` variant, independent of any
/// values it might hold.
pub(super) fn term_type(kind: &TerminatorKind<'tcx>) -> &'static str {
match kind {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/transform/coverage/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! Also note, some basic features of `Span` also rely on the `Span`s own "session globals", which
//! are unrelated to the `TyCtxt` global. Without initializing the `Span` session globals, some
//! basic, coverage-specific features would be impossible to test, but thankfully initializing these
//! globals is comparitively simpler. The easiest way is to wrap the test in a closure argument
//! globals is comparatively simpler. The easiest way is to wrap the test in a closure argument
//! to: `rustc_span::with_default_session_globals(|| { test_here(); })`.

use super::counters;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/util/find_self_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, TyCtxt};
use rustc_span::def_id::DefId;

/// Checks if the specified `local` is used as the `self` prameter of a method call
/// Checks if the specified `local` is used as the `self` parameter of a method call
/// in the provided `BasicBlock`. If it is, then the `DefId` of the called method is
/// returned.
pub fn find_self_call<'tcx>(
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_build/src/build/expr/as_place.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ crate struct PlaceBuilder<'tcx> {
/// The projections are truncated to represent a path that might be captured by a
/// closure/generator. This implies the vector returned from this function doesn't contain
/// ProjectionElems `Downcast`, `ConstantIndex`, `Index`, or `Subslice` because those will never be
/// part of a path that is captued by a closure. We stop applying projections once we see the first
/// part of a path that is captured by a closure. We stop applying projections once we see the first
/// projection that isn't captured by a closure.
fn convert_to_hir_projections_and_truncate_for_capture<'tcx>(
mir_projections: &[PlaceElem<'tcx>],
Expand Down Expand Up @@ -578,7 +578,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {

/// Lower a captured upvar. Note we might not know the actual capture index,
/// so we create a place starting from `PlaceBase::Upvar`, which will be resolved
/// once all projections that allow us to indentify a capture have been applied.
/// once all projections that allow us to identify a capture have been applied.
fn lower_captured_upvar(
&mut self,
block: BasicBlock,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ impl<'a> Parser<'a> {
Ok((ident, ItemKind::MacroDef(ast::MacroDef { body, macro_rules: false })))
}

/// Is this unambiguously the start of a `macro_rules! foo` item defnition?
/// Is this unambiguously the start of a `macro_rules! foo` item definition?
fn is_macro_rules_item(&mut self) -> bool {
self.check_keyword(kw::MacroRules)
&& self.look_ahead(1, |t| *t == token::Not)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_privacy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ impl<'tcx> Visitor<'tcx> for NamePrivacyVisitor<'tcx> {

////////////////////////////////////////////////////////////////////////////////////////////
/// Type privacy visitor, checks types for privacy and reports violations.
/// Both explicitly written types and inferred types of expressions and patters are checked.
/// Both explicitly written types and inferred types of expressions and patterns are checked.
/// Checks are performed on "semantic" types regardless of names and their hygiene.
////////////////////////////////////////////////////////////////////////////////////////////

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/late/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ enum Scope<'a> {
opaque_type_parent: bool,

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

Expand Down Expand Up @@ -303,7 +303,7 @@ enum Scope<'a> {
/// of. Other than that, if ask for bound vars for each, we expect
/// `['a, 'b]`. If we *didn't* allow binders before `T`, then we would
/// always introduce a binder scope at the inner trait ref. This is great,
/// becauase later on during type-checking, we will ask "what are the late
/// because later on during type-checking, we will ask "what are the late
/// bound vars on this trait ref". However, because we allow bound vars on
/// the bound itself, we have to have some way of keeping track of the fact
/// that we actually want to store the late bound vars as being associated
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_span/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ pub struct ExpnData {

/// Used to force two `ExpnData`s to have different `Fingerprint`s.
/// Due to macro expansion, it's possible to end up with two `ExpnId`s
/// that have identical `ExpnData`s. This violates the constract of `HashStable`
/// that have identical `ExpnData`s. This violates the contract of `HashStable`
/// - the two `ExpnId`s are not equal, but their `Fingerprint`s are equal
/// (since the numerical `ExpnId` value is not considered by the `HashStable`
/// implementation).
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_target/src/abi/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ mod attr_impl {
}

/// Sometimes an ABI requires small integers to be extended to a full or partial register. This enum
/// defines if this extension should be zero-extension or sign-extension when necssary. When it is
/// not necesary to extend the argument, this enum is ignored.
/// defines if this extension should be zero-extension or sign-extension when necessary. When it is
/// not necessary to extend the argument, this enum is ignored.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum ArgExtension {
None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ pub enum ArgKind {
Arg(String, String),

/// An argument of tuple type. For a "found" argument, the span is
/// the locationo in the source of the pattern. For a "expected"
/// the location in the source of the pattern. For a "expected"
/// argument, it will be None. The vector is a list of (name, ty)
/// strings for the components of the tuple.
Tuple(Option<Span>, Vec<(String, String)>),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
/// subobligations without taking in a 'parent' depth, causing the
/// generated subobligations to have a `recursion_depth` of `0`.
///
/// To ensure that obligation_depth never decreasees, we force all subobligations
/// To ensure that obligation_depth never decreases, we force all subobligations
/// to have at least the depth of the original obligation.
fn add_depth<T: 'cx, I: Iterator<Item = &'cx mut Obligation<'tcx, T>>>(
&self,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ enum ProbeResult {

/// When adjusting a receiver we often want to do one of
///
/// - Add a `&` (or `&mut`), converting the recevier from `T` to `&T` (or `&mut T`)
/// - Add a `&` (or `&mut`), converting the receiver from `T` to `&T` (or `&mut T`)
/// - If the receiver has type `*mut T`, convert it to `*const T`
///
/// This type tells us which one to do.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ fn migration_suggestion_for_2229(
/// If both the CaptureKind and Expression are considered to be equivalent,
/// then `CaptureInfo` A is preferred. This can be useful in cases where we want to priortize
/// expressions reported back to the user as part of diagnostics based on which appears earlier
/// in the closure. This can be acheived simply by calling
/// in the closure. This can be achieved simply by calling
/// `determine_capture_info(existing_info, current_info)`. This works out because the
/// expressions that occur earlier in the closure body than the current expression are processed before.
/// Consider the following example
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_typeck/src/expr_use_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
/// In the following example the closures `c` only captures `p.x`` even though `incr`
/// is a capture of the nested closure
///
/// ```rust,ignore(cannot-test-this-because-pseduo-code)
/// ```rust,ignore(cannot-test-this-because-pseudo-code)
/// let p = ..;
/// let c = || {
/// let incr = 10;
Expand Down Expand Up @@ -715,7 +715,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
// The only places we want to fake read before creating the parent closure are the ones that
// are not local to it/ defined by it.
//
// ```rust,ignore(cannot-test-this-because-pseduo-code)
// ```rust,ignore(cannot-test-this-because-pseudo-code)
// let v1 = (0, 1);
// let c = || { // fake reads: v1
// let v2 = (0, 1);
Expand Down