Skip to content
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

chore: Fix typos in 'compiler' (batch 2) #129877

Merged
merged 1 commit into from
Sep 3, 2024
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_lint/src/context/diagnostics/check_cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_middle/src/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled
pub type EvalStaticInitializerRawResult<'tcx> = Result<ConstAllocation<'tcx>, ErrorHandled>;
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, 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<Result<ValTree<'tcx>, Ty<'tcx>>, ErrorHandled>;

#[cfg(target_pointer_width = "64")]
Expand Down Expand Up @@ -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,
}

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 @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DefId>, attrs: &[Symbol]) -> bool {
self.get_attrs_by_path(did.into(), attrs).next().is_some()
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/dead_store_elimination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/dest_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/known_panics_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
20 changes: 10 additions & 10 deletions compiler/rustc_mir_transform/src/match_branches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ fn can_cast(

#[derive(Default)]
struct SimplifyToExp {
transfrom_kinds: Vec<TransfromKind>,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert?

transform_kinds: Vec<TransformKind>,
}

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

enum TransfromKind {
enum TransformKind {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely understand if this should be reverted, since it is not just a doc change but changing the code...

Same,
Cast,
}

impl From<ExpectedTransformKind<'_, '_>> for TransfromKind {
impl From<ExpectedTransformKind<'_, '_>> 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,
}
}
}
Expand Down Expand Up @@ -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(())
}

Expand All @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/promote_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/ref_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ fn fully_replacable_locals(ssa: &SsaLocals) -> BitSet<Local> {
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<Local, Value<'tcx>>,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_monomorphize/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: ResponseT<I>>(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_next_trait_solver/src/solve/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_next_trait_solver/src/solve/trait_goals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_pattern_analysis/src/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_pattern_analysis/tests/exhaustiveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn check(patterns: Vec<DeconstructedPat<Cx>>) -> Vec<WitnessPat<Cx>> {
fn assert_exhaustive(patterns: Vec<DeconstructedPat<Cx>>) {
let witnesses = check(patterns);
if !witnesses.is_empty() {
panic!("non-exaustive match: missing {witnesses:?}");
panic!("non-exhaustive match: missing {witnesses:?}");
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_query_system/src/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ fn panic_on_forbidden_read<D: Deps>(data: &DepGraphData<D>, 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 <https://github.com/rust-lang/rust/pull/91919>."
)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ pub(crate) struct LendingIteratorReportError {
}

#[derive(Diagnostic)]
#[diag(resolve_anonymous_livetime_non_gat_report_error)]
#[diag(resolve_anonymous_lifetime_non_gat_report_error)]
pub(crate) struct AnonymousLivetimeNonGatReportError {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also a typo: should be AnonymousLifetimeNonGatReportError. No need to do that in this PR though.

#[primary_span]
#[label]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ pub(crate) fn attrs_to_preprocessed_links(attrs: &[ast::Attribute]) -> Vec<Box<s
parse_links(&doc)
}

/// Similiar version of `markdown_links` from rustdoc.
/// Similar version of `markdown_links` from rustdoc.
/// This will collect destination links and display text if exists.
fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
let mut broken_link_callback = |link: BrokenLink<'md>| Some((link.reference, "".into()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ 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
/// are used later by the LowerTypeTests LLVM pass to aggregate functions in groups derived from
/// 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
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_serialize/src/opaque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<N>().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::<N>(written);
}
Expand Down
Loading
Loading