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

This commit is contained in:
Alexander Cyon 2024-09-02 07:50:22 +02:00
parent 78d5c04d9c
commit 00de006f22
No known key found for this signature in database
34 changed files with 54 additions and 54 deletions

View File

@ -267,7 +267,7 @@ pub(super) fn unexpected_cfg_value(
// encouraged to do so. // encouraged to do so.
let can_suggest_adding_value = !sess.psess.check_config.well_known_names.contains(&name) 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 // 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 // basic heuristic, we use the "cheat" unstable feature enable method and the
// non-ui-testing enabled option. // non-ui-testing enabled option.
|| (matches!(sess.psess.unstable_features, rustc_feature::UnstableFeatures::Cheat) || (matches!(sess.psess.unstable_features, rustc_feature::UnstableFeatures::Cheat)

View File

@ -240,7 +240,7 @@ pub fn ty(&self) -> Ty<'tcx> {
match self { match self {
Const::Ty(ty, ct) => { Const::Ty(ty, ct) => {
match ct.kind() { 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 // 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`. // was originally `({N: usize} + 1_usize)` under `generic_const_exprs`.
ty::ConstKind::Value(ty, _) => ty, ty::ConstKind::Value(ty, _) => ty,

View File

@ -91,9 +91,9 @@ fn into(self) -> ErrorGuaranteed {
pub type EvalStaticInitializerRawResult<'tcx> = Result<ConstAllocation<'tcx>, ErrorHandled>; pub type EvalStaticInitializerRawResult<'tcx> = Result<ConstAllocation<'tcx>, ErrorHandled>;
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'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 /// `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 /// 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>; pub type EvalToValTreeResult<'tcx> = Result<Result<ValTree<'tcx>, Ty<'tcx>>, ErrorHandled>;
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
@ -231,7 +231,7 @@ pub enum CheckInAllocMsg {
pub enum CheckAlignMsg { pub enum CheckAlignMsg {
/// The accessed pointer did not have proper alignment. /// The accessed pointer did not have proper alignment.
AccessedPtr, 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, BasedOn,
} }

View File

@ -327,7 +327,7 @@
} }
} }
/// 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 /// by a implementation or definition. For associated types, these
/// must be satisfied for an implementation to be well-formed, /// must be satisfied for an implementation to be well-formed,
/// and for opaque types, these are required to be satisfied by /// and for opaque types, these are required to be satisfied by

View File

@ -1475,7 +1475,7 @@ pub fn lift<T: Lift<TyCtxt<'tcx>>>(self, value: T) -> Option<T::Lifted> {
/// provides a `TyCtxt`. /// provides a `TyCtxt`.
/// ///
/// By only providing the `TyCtxt` inside of the closure we enforce that the type /// 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. /// has a valid reference to the context, to allow formatting values that need it.
pub fn create_global_ctxt( pub fn create_global_ctxt(
s: &'tcx Session, s: &'tcx Session,

View File

@ -38,7 +38,7 @@ pub struct Instance<'tcx> {
pub args: GenericArgsRef<'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 /// adjust for things like `#[track_caller]` in a vtable from a `ReifyShim` created to produce a
/// function pointer from a vtable entry. /// function pointer from a vtable entry.
/// Currently, this is only used when KCFI is enabled, as only KCFI needs to treat those two /// Currently, this is only used when KCFI is enabled, as only KCFI needs to treat those two

View File

@ -1819,7 +1819,7 @@ pub fn has_attr(self, did: impl Into<DefId>, attr: Symbol) -> bool {
self.get_attrs(did, attr).next().is_some() 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 { 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() self.get_attrs_by_path(did.into(), attrs).next().is_some()
} }

View File

@ -1930,7 +1930,7 @@ pub fn is_c_void(self, tcx: TyCtxt<'_>) -> bool {
/// Returns `true` when the outermost type cannot be further normalized, /// Returns `true` when the outermost type cannot be further normalized,
/// resolved, or instantiated. This includes all primitive types, but also /// 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 /// nested types may be further simplified, the outermost [`TyKind`] or
/// type constructor remains the same. /// type constructor remains the same.
pub fn is_known_rigid(self) -> bool { pub fn is_known_rigid(self) -> bool {

View File

@ -32,7 +32,7 @@ pub fn eliminate<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let borrowed_locals = borrowed_locals(body); let borrowed_locals = borrowed_locals(body);
// If the user requests complete debuginfo, mark the locals that appear in it as live, so // 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); let mut always_live = debuginfo_locals(body);
always_live.union(&borrowed_locals); always_live.union(&borrowed_locals);

View File

@ -38,7 +38,7 @@
//! not contain any indirection through a pointer or any indexing projections. //! 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, //! * `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. //! tests for an example where that causes issues.
//! //!
//! * We need to make sure that the goal of "merging the memory" is actually structurally possible //! * We need to make sure that the goal of "merging the memory" is actually structurally possible

View File

@ -914,7 +914,7 @@ impl<'tcx> Visitor<'tcx> for CanConstProp {
fn visit_place(&mut self, place: &Place<'tcx>, mut context: PlaceContext, loc: Location) { fn visit_place(&mut self, place: &Place<'tcx>, mut context: PlaceContext, loc: Location) {
use rustc_middle::mir::visit::PlaceContext::*; 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) { if place.projection.first() == Some(&PlaceElem::Deref) {
context = NonMutatingUse(NonMutatingUseContext::Copy); context = NonMutatingUse(NonMutatingUseContext::Copy);
} }

View File

@ -289,7 +289,7 @@ fn can_cast(
#[derive(Default)] #[derive(Default)]
struct SimplifyToExp { struct SimplifyToExp {
transfrom_kinds: Vec<TransfromKind>, transform_kinds: Vec<TransformKind>,
} }
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
@ -302,17 +302,17 @@ enum ExpectedTransformKind<'tcx, 'a> {
Cast { place: &'a Place<'tcx>, ty: Ty<'tcx> }, Cast { place: &'a Place<'tcx>, ty: Ty<'tcx> },
} }
enum TransfromKind { enum TransformKind {
Same, Same,
Cast, Cast,
} }
impl From<ExpectedTransformKind<'_, '_>> for TransfromKind { impl From<ExpectedTransformKind<'_, '_>> for TransformKind {
fn from(compare_type: ExpectedTransformKind<'_, '_>) -> Self { fn from(compare_type: ExpectedTransformKind<'_, '_>) -> Self {
match compare_type { match compare_type {
ExpectedTransformKind::Same(_) => TransfromKind::Same, ExpectedTransformKind::Same(_) => TransformKind::Same,
ExpectedTransformKind::SameByEq { .. } => TransfromKind::Same, ExpectedTransformKind::SameByEq { .. } => TransformKind::Same,
ExpectedTransformKind::Cast { .. } => TransfromKind::Cast, ExpectedTransformKind::Cast { .. } => TransformKind::Cast,
} }
} }
} }
@ -475,7 +475,7 @@ fn can_simplify(
} }
} }
} }
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(()) Some(())
} }
@ -493,13 +493,13 @@ fn new_stmts(
let (_, first) = targets.iter().next().unwrap(); let (_, first) = targets.iter().next().unwrap();
let first = &bbs[first]; 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) { match (t, &s.kind) {
(TransfromKind::Same, _) => { (TransformKind::Same, _) => {
patch.add_statement(parent_end, s.kind.clone()); patch.add_statement(parent_end, s.kind.clone());
} }
( (
TransfromKind::Cast, TransformKind::Cast,
StatementKind::Assign(box (lhs, Rvalue::Use(Operand::Constant(f_c)))), StatementKind::Assign(box (lhs, Rvalue::Use(Operand::Constant(f_c)))),
) => { ) => {
let operand = Operand::Copy(Place::from(discr_local)); let operand = Operand::Copy(Place::from(discr_local));

View File

@ -498,7 +498,7 @@ fn validate_rvalue(&mut self, rvalue: &Rvalue<'tcx>) -> Result<(), Unpromotable>
Some(x) if x != 0 => {} // okay Some(x) if x != 0 => {} // okay
_ => return Err(Unpromotable), // value not known or 0 -- not 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() { if lhs_ty.is_signed() {
match rhs_val.map(|x| x.to_int(sz)) { match rhs_val.map(|x| x.to_int(sz)) {
Some(-1) | None => { Some(-1) | None => {

View File

@ -345,7 +345,7 @@ fn fully_replacable_locals(ssa: &SsaLocals) -> BitSet<Local> {
replacable replacable
} }
/// Utility to help performing subtitution of `*pattern` by `target`. /// Utility to help performing substitution of `*pattern` by `target`.
struct Replacer<'tcx> { struct Replacer<'tcx> {
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
targets: IndexVec<Local, Value<'tcx>>, targets: IndexVec<Local, Value<'tcx>>,

View File

@ -397,7 +397,7 @@ fn collect_items_rec<'tcx>(
MonoItem::Static(def_id) => { MonoItem::Static(def_id) => {
recursion_depth_reset = None; 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. // `MentionedItems` collection there's nothing to do here.
if mode == CollectionMode::UsedItems { if mode == CollectionMode::UsedItems {
let instance = Instance::mono(tcx, def_id); let instance = Instance::mono(tcx, def_id);

View File

@ -238,7 +238,7 @@ pub(super) fn instantiate_and_apply_query_response(
(normalization_nested_goals.clone(), certainty) (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 /// the canonical response. This depends on the `original_values` for the
/// bound variables. /// bound variables.
fn compute_query_response_instantiation_values<T: ResponseT<I>>( fn compute_query_response_instantiation_values<T: ResponseT<I>>(

View File

@ -164,7 +164,7 @@ fn compute_const_evaluatable_goal(
// - `Bound` cannot exist as we don't have a binder around the self Type // - `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 // - `Expr` is part of `feature(generic_const_exprs)` and is not implemented yet
ty::ConstKind::Param(_) | ty::ConstKind::Bound(_, _) | ty::ConstKind::Expr(_) => { ty::ConstKind::Param(_) | ty::ConstKind::Bound(_, _) | ty::ConstKind::Expr(_) => {
panic!("unexpect const kind: {:?}", ct) panic!("unexpected const kind: {:?}", ct)
} }
} }
} }

View File

@ -628,7 +628,7 @@ fn consider_builtin_transmute_candidate(
} }
// FIXME: This actually should destructure the `Result` we get from transmutability and // 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| { ecx.probe_builtin_trait_candidate(BuiltinImplSource::Misc).enter(|ecx| {
let certainty = ecx.is_transmutable( let certainty = ecx.is_transmutable(
goal.param_env, goal.param_env,

View File

@ -402,7 +402,7 @@ fn maybe_recover_trailing_expr(
let non_assoc_span = expr.span; let non_assoc_span = expr.span;
// Parse an associative expression such as `+ expr`, `% expr`, ... // 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, _)) = if let Ok((expr, _)) =
snapshot.parse_expr_assoc_rest_with(0, false, expr).map_err(|err| err.cancel()) snapshot.parse_expr_assoc_rest_with(0, false, expr).map_err(|err| err.cancel())
{ {

View File

@ -439,7 +439,7 @@ fn visit_node(&mut self, node: Node<'tcx>) {
_ => intravisit::walk_item(self, item), _ => intravisit::walk_item(self, item),
}, },
Node::TraitItem(trait_item) => { Node::TraitItem(trait_item) => {
// mark corresponing ImplTerm live // mark corresponding ImplTerm live
let trait_item_id = trait_item.owner_id.to_def_id(); let trait_item_id = trait_item.owner_id.to_def_id();
if let Some(trait_id) = self.tcx.trait_of_item(trait_item_id) { if let Some(trait_id) = self.tcx.trait_of_item(trait_item_id) {
// mark the trait live // mark the trait live
@ -1035,7 +1035,7 @@ fn get_parent_if_enum_variant<'tcx>(
}; };
let encl_def_id = parent_item.unwrap_or(first_item.def_id); 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 encl_def_id = get_parent_if_enum_variant(tcx, encl_def_id);
let ignored_derived_impls = let ignored_derived_impls =

View File

@ -288,7 +288,7 @@ impl IntRange {
/// Best effort; will not know that e.g. `255u8..` is a singleton. /// Best effort; will not know that e.g. `255u8..` is a singleton.
pub fn is_singleton(&self) -> bool { pub fn is_singleton(&self) -> bool {
// Since `lo` and `hi` can't be the same `Infinity` and `plus_one` never changes from finite // 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) self.lo.plus_one() == Some(self.hi)
} }

View File

@ -22,7 +22,7 @@ fn check(patterns: Vec<DeconstructedPat<Cx>>) -> Vec<WitnessPat<Cx>> {
fn assert_exhaustive(patterns: Vec<DeconstructedPat<Cx>>) { fn assert_exhaustive(patterns: Vec<DeconstructedPat<Cx>>) {
let witnesses = check(patterns); let witnesses = check(patterns);
if !witnesses.is_empty() { if !witnesses.is_empty() {
panic!("non-exaustive match: missing {witnesses:?}"); panic!("non-exhaustive match: missing {witnesses:?}");
} }
} }

View File

@ -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 \ "Error: trying to record dependency on DepNode {dep_node} in a \
context that does not allow it (e.g. during query deserialization). \ context that does not allow it (e.g. during query deserialization). \
The most common case of recording a dependency on a DepNode `foo` is \ 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. \ allowed as part of loading something from the incremental on-disk cache. \
See <https://github.com/rust-lang/rust/pull/91919>." See <https://github.com/rust-lang/rust/pull/91919>."
) )

View File

@ -11,7 +11,7 @@ resolve_added_macro_use =
resolve_ancestor_only = resolve_ancestor_only =
visibilities can only be restricted to ancestor modules 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 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 .label = this lifetime must come from the implemented type

View File

@ -894,7 +894,7 @@ pub(crate) struct LendingIteratorReportError {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(resolve_anonymous_livetime_non_gat_report_error)] #[diag(resolve_anonymous_lifetime_non_gat_report_error)]
pub(crate) struct AnonymousLivetimeNonGatReportError { pub(crate) struct AnonymousLivetimeNonGatReportError {
#[primary_span] #[primary_span]
#[label] #[label]

View File

@ -445,7 +445,7 @@ struct Flags: u8 {
} }
} }
Scope::DeriveHelpersCompat => { 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 // legacy derive helpers when creating an attribute invocation with
// following derives. Legacy derive helpers are not common, so it shouldn't // following derives. Legacy derive helpers are not common, so it shouldn't
// affect performance. It should also allow to remove the `derives` // affect performance. It should also allow to remove the `derives`

View File

@ -133,7 +133,7 @@ pub(crate) enum NoConstantGenericsReason {
/// Const arguments are only allowed to use generic parameters when: /// Const arguments are only allowed to use generic parameters when:
/// - `feature(generic_const_exprs)` is enabled /// - `feature(generic_const_exprs)` is enabled
/// or /// 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. /// If neither of the above are true then this is used as the cause.
NonTrivialConstArg, NonTrivialConstArg,
@ -4486,7 +4486,7 @@ fn resolve_anon_const(&mut self, constant: &'ast AnonConst, anon_const_kind: Ano
/// There are a few places that we need to resolve an anon const but we did not parse an /// 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 /// 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 /// 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 /// an anon const we have this function which lets the caller manually call `resolve_expr` or
/// `smart_resolve_path`. /// `smart_resolve_path`.

View File

@ -417,7 +417,7 @@ pub(crate) fn attrs_to_preprocessed_links(attrs: &[ast::Attribute]) -> Vec<Box<s
parse_links(&doc) 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. /// This will collect destination links and display text if exists.
fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> { fn parse_links<'md>(doc: &'md str) -> Vec<Box<str>> {
let mut broken_link_callback = |link: BrokenLink<'md>| Some((link.reference, "".into())); let mut broken_link_callback = |link: BrokenLink<'md>| Some((link.reference, "".into()));

View File

@ -262,7 +262,7 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc
/// mangling. /// mangling.
/// ///
/// typeid_for_instance is called at two locations, initially when declaring/defining functions and /// 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 /// 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 /// an FnAbi or Instance, and these type ids are attached to functions and methods. (These type ids
@ -270,7 +270,7 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc
/// these type ids.) /// these type ids.)
/// ///
/// In the second call (i.e., during code generation at call sites), it encodes a type id for an /// 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 /// 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 /// 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 /// 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>(
// of the trait that defines the method. // of the trait that defines the method.
if let Some((trait_ref, method_id, ancestor)) = implemented_method(tcx, instance) { if let Some((trait_ref, method_id, ancestor)) = implemented_method(tcx, instance) {
// Trait methods will have a Self polymorphic parameter, where the concreteized // 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( let trait_ref = tcx.instantiate_and_normalize_erasing_regions(
instance.args, instance.args,
ty::ParamEnv::reveal_all(), ty::ParamEnv::reveal_all(),

View File

@ -159,7 +159,7 @@ fn write_all(&mut self, buf: &[u8]) {
// We produce a post-mono error if N > BUF_SIZE. // We produce a post-mono error if N > BUF_SIZE.
let buf = unsafe { self.buffer_empty().first_chunk_mut::<N>().unwrap_unchecked() }; let buf = unsafe { self.buffer_empty().first_chunk_mut::<N>().unwrap_unchecked() };
let written = visitor(buf); 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 { if written > N {
Self::panic_invalid_write::<N>(written); Self::panic_invalid_write::<N>(written);
} }

View File

@ -251,7 +251,7 @@ pub struct LinkSelfContained {
pub explicitly_set: Option<bool>, pub explicitly_set: Option<bool>,
/// The components that are enabled on the CLI, using the `+component` syntax or one of the /// The components that are enabled on the CLI, using the `+component` syntax or one of the
/// `true` shorcuts. /// `true` shortcuts.
enabled_components: LinkSelfContainedComponents, enabled_components: LinkSelfContainedComponents,
/// The components that are disabled on the CLI, using the `-component` syntax or one of the /// The components that are disabled on the CLI, using the `-component` syntax or one of the
@ -313,13 +313,13 @@ fn are_unstable_variants_set(&self) -> bool {
} }
/// Returns whether the self-contained linker component was enabled on the CLI, using the /// Returns whether the self-contained linker component was enabled on the CLI, using the
/// `-C link-self-contained=+linker` syntax, or one of the `true` shorcuts. /// `-C link-self-contained=+linker` syntax, or one of the `true` shortcuts.
pub fn is_linker_enabled(&self) -> bool { pub fn is_linker_enabled(&self) -> bool {
self.enabled_components.contains(LinkSelfContainedComponents::LINKER) self.enabled_components.contains(LinkSelfContainedComponents::LINKER)
} }
/// Returns whether the self-contained linker component was disabled on the CLI, using the /// Returns whether the self-contained linker component was disabled on the CLI, using the
/// `-C link-self-contained=-linker` syntax, or one of the `false` shorcuts. /// `-C link-self-contained=-linker` syntax, or one of the `false` shortcuts.
pub fn is_linker_disabled(&self) -> bool { pub fn is_linker_disabled(&self) -> bool {
self.disabled_components.contains(LinkSelfContainedComponents::LINKER) self.disabled_components.contains(LinkSelfContainedComponents::LINKER)
} }
@ -360,7 +360,7 @@ pub(crate) fn handle_cli_feature(&mut self, feature: &str) -> Option<()> {
// Duplicate flags are reduced as we go, the last occurrence wins: // Duplicate flags are reduced as we go, the last occurrence wins:
// `+feature,-feature,+feature` only enables the feature, and does not record it as both // `+feature,-feature,+feature` only enables the feature, and does not record it as both
// enabled and disabled on the CLI. // enabled and disabled on the CLI.
// We also only expose `+/-lld` at the moment, as it's currenty the only implemented linker // We also only expose `+/-lld` at the moment, as it's currently the only implemented linker
// feature and toggling `LinkerFeatures::CC` would be a noop. // feature and toggling `LinkerFeatures::CC` would be a noop.
match feature { match feature {
"+lld" => { "+lld" => {
@ -1102,7 +1102,7 @@ pub struct RemapPathScopeComponents: u8 {
const MACRO = 1 << 0; const MACRO = 1 << 0;
/// Apply remappings to printed compiler diagnostics /// Apply remappings to printed compiler diagnostics
const DIAGNOSTICS = 1 << 1; const DIAGNOSTICS = 1 << 1;
/// Apply remappings to debug informations /// Apply remappings to debug information
const DEBUGINFO = 1 << 3; const DEBUGINFO = 1 << 3;
/// An alias for `macro` and `debuginfo`. This ensures all paths in compiled /// An alias for `macro` and `debuginfo`. This ensures all paths in compiled

View File

@ -397,7 +397,7 @@ fn after_analysis<'tcx>(
}}; }};
} }
/// Simmilar to rustc's `FxIndexMap`, `IndexMap` with extra /// Similar to rustc's `FxIndexMap`, `IndexMap` with extra
/// safety features added. /// safety features added.
pub struct IndexMap<K, V> { pub struct IndexMap<K, V> {
index_map: fx::FxIndexMap<K, V>, index_map: fx::FxIndexMap<K, V>,

View File

@ -1358,7 +1358,7 @@ pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContext
let mut inner = context.inner.lock(); let mut inner = context.inner.lock();
if let Some(ctxt) = inner.remapped_ctxts.get(raw_id as usize).copied().flatten() { if let Some(ctxt) = inner.remapped_ctxts.get(raw_id as usize).copied().flatten() {
// This has already beeen decoded. // This has already been decoded.
return ctxt; return ctxt;
} }

View File

@ -271,7 +271,7 @@ pub fn local_path_if_available(&self) -> &Path {
} }
} }
/// Return the path remmapped or not depending on the [`FileNameDisplayPreference`]. /// Return the path remapped or not depending on the [`FileNameDisplayPreference`].
/// ///
/// For the purpose of this function, local and short preference are equal. /// For the purpose of this function, local and short preference are equal.
pub fn to_path(&self, display_pref: FileNameDisplayPreference) -> &Path { pub fn to_path(&self, display_pref: FileNameDisplayPreference) -> &Path {
@ -1683,7 +1683,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
/// is because SourceFiles for the local crate are allocated very early in the /// is because SourceFiles for the local crate are allocated very early in the
/// compilation process when the `StableCrateId` is not yet known. If, due to /// compilation process when the `StableCrateId` is not yet known. If, due to
/// some refactoring of the compiler, the `StableCrateId` of the local crate /// some refactoring of the compiler, the `StableCrateId` of the local crate
/// were to become available, it would be better to uniformely make this a /// were to become available, it would be better to uniformly make this a
/// hash of `(filename, stable_crate_id)`. /// hash of `(filename, stable_crate_id)`.
/// ///
/// When `SourceFile`s are exported in crate metadata, the `StableSourceFileId` /// When `SourceFile`s are exported in crate metadata, the `StableSourceFileId`