Spellchecking compiler comments
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
This commit is contained in:
parent
3e7514670d
commit
5160f8f843
116 changed files with 171 additions and 171 deletions
|
@ -345,7 +345,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
if potential_assoc_types.len() == assoc_items.len() {
|
||||
// Only suggest when the amount of missing associated types equals the number of
|
||||
// extra type arguments present, as that gives us a relatively high confidence
|
||||
// that the user forgot to give the associtated type's name. The canonical
|
||||
// that the user forgot to give the associated type's name. The canonical
|
||||
// example would be trying to use `Iterator<isize>` instead of
|
||||
// `Iterator<Item = isize>`.
|
||||
for (potential, item) in iter::zip(&potential_assoc_types, assoc_items) {
|
||||
|
|
|
@ -290,7 +290,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
/// Given the type/lifetime/const arguments provided to some path (along with
|
||||
/// an implicit `Self`, if this is a trait reference), returns the complete
|
||||
/// set of substitutions. This may involve applying defaulted type parameters.
|
||||
/// Constraints on associated typess are created from `create_assoc_bindings_for_generic_args`.
|
||||
/// Constraints on associated types are created from `create_assoc_bindings_for_generic_args`.
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
|
@ -1435,7 +1435,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
// If the projection output contains `Self`, force the user to
|
||||
// elaborate it explicitly to avoid a lot of complexity.
|
||||
//
|
||||
// The "classicaly useful" case is the following:
|
||||
// The "classically useful" case is the following:
|
||||
// ```
|
||||
// trait MyTrait: FnMut() -> <Self as MyTrait>::MyOutput {
|
||||
// type MyOutput;
|
||||
|
@ -1768,7 +1768,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
// Will fail except for `T::A` and `Self::A`; i.e., if `qself_ty`/`qself_def` are not a type
|
||||
// parameter or `Self`.
|
||||
// NOTE: When this function starts resolving `Trait::AssocTy` successfully
|
||||
// it should also start reportint the `BARE_TRAIT_OBJECTS` lint.
|
||||
// it should also start reporting the `BARE_TRAIT_OBJECTS` lint.
|
||||
pub fn associated_path_to_ty(
|
||||
&self,
|
||||
hir_ref_id: hir::HirId,
|
||||
|
|
|
@ -721,7 +721,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
return None;
|
||||
}
|
||||
|
||||
// The `Future` trait has only one associted item, `Output`,
|
||||
// The `Future` trait has only one associated item, `Output`,
|
||||
// so check that this is what we see.
|
||||
let output_assoc_item = self.tcx.associated_item_def_ids(future_trait)[0];
|
||||
if output_assoc_item != predicate.projection_ty.item_def_id {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
//!
|
||||
//! ## Subtle note
|
||||
//!
|
||||
//! When infering the generic arguments of functions, the argument
|
||||
//! When inferring the generic arguments of functions, the argument
|
||||
//! order is relevant, which can lead to the following edge case:
|
||||
//!
|
||||
//! ```rust
|
||||
|
|
|
@ -590,7 +590,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
let opt_coerce_to = {
|
||||
// We should release `enclosing_breakables` before the `check_expr_with_hint`
|
||||
// below, so can't move this block of code to the enclosing scope and share
|
||||
// `ctxt` with the second `encloding_breakables` borrow below.
|
||||
// `ctxt` with the second `enclosing_breakables` borrow below.
|
||||
let mut enclosing_breakables = self.enclosing_breakables.borrow_mut();
|
||||
match enclosing_breakables.opt_find_breakable(target_id) {
|
||||
Some(ctxt) => ctxt.coerce.as_ref().map(|coerce| coerce.expected_ty()),
|
||||
|
@ -793,7 +793,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
self.tcx.types.never
|
||||
}
|
||||
|
||||
/// `explicit_return` is `true` if we're checkng an explicit `return expr`,
|
||||
/// `explicit_return` is `true` if we're checking an explicit `return expr`,
|
||||
/// and `false` if we're checking a trailing expression.
|
||||
pub(super) fn check_return_expr(
|
||||
&self,
|
||||
|
@ -1126,7 +1126,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
let method = match self.lookup_method(rcvr_t, segment, span, expr, rcvr, args) {
|
||||
Ok(method) => {
|
||||
// We could add a "consider `foo::<params>`" suggestion here, but I wasn't able to
|
||||
// trigger this codepath causing `structuraly_resolved_type` to emit an error.
|
||||
// trigger this codepath causing `structurally_resolved_type` to emit an error.
|
||||
|
||||
self.write_method_call(expr.hir_id, method);
|
||||
Ok(method)
|
||||
|
|
|
@ -158,7 +158,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
_ => {
|
||||
// Otherwise, there's a mismatch, so clear out what we're expecting, and set
|
||||
// our input typs to err_args so we don't blow up the error messages
|
||||
// our input types to err_args so we don't blow up the error messages
|
||||
struct_span_err!(
|
||||
tcx.sess,
|
||||
call_span,
|
||||
|
|
|
@ -206,7 +206,7 @@ struct DropRangesBuilder {
|
|||
/// NodeInfo struct for more details, but this information includes things
|
||||
/// such as the set of control-flow successors, which variables are dropped
|
||||
/// or reinitialized, and whether each variable has been inferred to be
|
||||
/// known-dropped or potentially reintiialized at each point.
|
||||
/// known-dropped or potentially reinitialized at each point.
|
||||
nodes: IndexVec<PostOrderId, NodeInfo>,
|
||||
/// We refer to values whose drop state we are tracking by the HirId of
|
||||
/// where they are defined. Within a NodeInfo, however, we store the
|
||||
|
|
|
@ -50,7 +50,7 @@ pub(super) fn build_control_flow_graph<'tcx>(
|
|||
///
|
||||
/// 1. Moving a variable `a` counts as a move of the whole variable.
|
||||
/// 2. Moving a partial path like `a.b.c` is ignored.
|
||||
/// 3. Reinitializing through a field (e.g. `a.b.c = 5`) counds as a reinitialization of all of
|
||||
/// 3. Reinitializing through a field (e.g. `a.b.c = 5`) counts as a reinitialization of all of
|
||||
/// `a`.
|
||||
///
|
||||
/// Some examples:
|
||||
|
|
|
@ -713,7 +713,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
|
|||
// FIXME Postponing the normalization of the return type likely only hides a deeper bug,
|
||||
// which might be caused by the `param_env` itself. The clauses of the `param_env`
|
||||
// maybe shouldn't include `Param`s, but rather fresh variables or be canonicalized,
|
||||
// see isssue #89650
|
||||
// see issue #89650
|
||||
let cause = traits::ObligationCause::misc(self.span, self.body_id);
|
||||
let selcx = &mut traits::SelectionContext::new(self.fcx);
|
||||
let traits::Normalized { value: xform_self_ty, obligations } =
|
||||
|
@ -1658,7 +1658,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
|
|||
}
|
||||
|
||||
/// Similarly to `probe_for_return_type`, this method attempts to find the best matching
|
||||
/// candidate method where the method name may have been misspelt. Similarly to other
|
||||
/// candidate method where the method name may have been misspelled. Similarly to other
|
||||
/// Levenshtein based suggestions, we provide at most one such suggestion.
|
||||
fn probe_for_lev_candidate(&mut self) -> Result<Option<ty::AssocItem>, MethodError<'tcx>> {
|
||||
debug!("probing for method names similar to {:?}", self.method_name);
|
||||
|
|
|
@ -270,7 +270,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
(None, true) => "variant",
|
||||
}
|
||||
};
|
||||
// FIXME(eddyb) this intendation is probably unnecessary.
|
||||
// FIXME(eddyb) this indentation is probably unnecessary.
|
||||
let mut err = {
|
||||
// Suggest clamping down the type if the method that is being attempted to
|
||||
// be used exists at all, and the type is an ambiguous numeric type
|
||||
|
@ -279,7 +279,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
.into_iter()
|
||||
.filter_map(|info| self.associated_value(info.def_id, item_name));
|
||||
// There are methods that are defined on the primitive types and won't be
|
||||
// found when exploring `all_traits`, but we also need them to be acurate on
|
||||
// found when exploring `all_traits`, but we also need them to be accurate on
|
||||
// our suggestions (#47759).
|
||||
let found_assoc = |ty: Ty<'tcx>| {
|
||||
simplify_type(tcx, ty, TreatParams::AsPlaceholders)
|
||||
|
|
|
@ -665,7 +665,7 @@ fn missing_items_must_implement_one_of_err(
|
|||
err.emit();
|
||||
}
|
||||
|
||||
/// Resugar `ty::GenericPredicates` in a way suitable to be used in structured suggestions.
|
||||
/// Re-sugar `ty::GenericPredicates` in a way suitable to be used in structured suggestions.
|
||||
fn bounds_from_generic_predicates<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
predicates: ty::GenericPredicates<'tcx>,
|
||||
|
|
|
@ -852,7 +852,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
// Binary operator categories. These categories summarize the behavior
|
||||
// with respect to the builtin operationrs supported.
|
||||
// with respect to the builtin operations supported.
|
||||
enum BinOpCategory {
|
||||
/// &&, || -- cannot be overridden
|
||||
Shortcircuit,
|
||||
|
|
|
@ -308,7 +308,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// In the `ValueNS`, we have `SelfCtor(..) | Ctor(_, Const), _)` remaining which
|
||||
// could successfully compile. The former being `Self` requires a unit struct.
|
||||
// In either case, and unlike constants, the pattern itself cannot be
|
||||
// a reference type wherefore peeling doesn't give up any expressivity.
|
||||
// a reference type wherefore peeling doesn't give up any expressiveness.
|
||||
_ => AdjustMode::Peel,
|
||||
},
|
||||
// When encountering a `& mut? pat` pattern, reset to "by value".
|
||||
|
@ -460,7 +460,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// The early check here is not for correctness, but rather better
|
||||
// diagnostics (e.g. when `&str` is being matched, `expected` will
|
||||
// be peeled to `str` while ty here is still `&str`, if we don't
|
||||
// err ealy here, a rather confusing unification error will be
|
||||
// err early here, a rather confusing unification error will be
|
||||
// emitted instead).
|
||||
let fail =
|
||||
!(ty.is_numeric() || ty.is_char() || ty.is_ty_var() || ty.references_error());
|
||||
|
@ -1343,7 +1343,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
match (inexistent_fields_err, unmentioned_err) {
|
||||
(Some(mut i), Some(mut u)) => {
|
||||
if let Some(mut e) = self.error_tuple_variant_as_struct_pat(pat, fields, variant) {
|
||||
// We don't want to show the inexistent fields error when this was
|
||||
// We don't want to show the nonexistent fields error when this was
|
||||
// `Foo { a, b }` when it should have been `Foo(a, b)`.
|
||||
i.delay_as_bug();
|
||||
u.delay_as_bug();
|
||||
|
|
|
@ -304,7 +304,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
);
|
||||
|
||||
// Build a tuple (U0..Un) of the final upvar types U0..Un
|
||||
// and unify the upvar tupe type in the closure with it:
|
||||
// and unify the upvar tuple type in the closure with it:
|
||||
let final_tupled_upvars_type = self.tcx.mk_tup(final_upvar_tys.iter());
|
||||
self.demand_suptype(span, substs.tupled_upvars_ty(), final_tupled_upvars_type);
|
||||
|
||||
|
@ -545,7 +545,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// capture information.
|
||||
//
|
||||
// - if descendant is found, remove it from the list, and update the current place's
|
||||
// capture information to account for the descendants's capture kind.
|
||||
// capture information to account for the descendant's capture kind.
|
||||
//
|
||||
// We can never be in a case where the list contains both an ancestor and a descendant
|
||||
// Also there can only be ancestor but in case of descendants there might be
|
||||
|
@ -661,7 +661,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// Now that we have the minimized list of captures, sort the captures by field id.
|
||||
// This causes the closure to capture the upvars in the same order as the fields are
|
||||
// declared which is also the drop order. Thus, in situations where we capture all the
|
||||
// fields of some type, the obserable drop order will remain the same as it previously
|
||||
// fields of some type, the observable drop order will remain the same as it previously
|
||||
// was even though we're dropping each capture individually.
|
||||
// See https://github.com/rust-lang/project-rfc-2229/issues/42 and
|
||||
// `src/test/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs`.
|
||||
|
@ -1396,7 +1396,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// Observations:
|
||||
// - `captured_by_move_projs` is not empty. Therefore we can call
|
||||
// `captured_by_move_projs.first().unwrap()` safely.
|
||||
// - All entries in `captured_by_move_projs` have atleast one projection.
|
||||
// - All entries in `captured_by_move_projs` have at least one projection.
|
||||
// Therefore we can call `captured_by_move_projs.first().unwrap().first().unwrap()` safely.
|
||||
|
||||
// We don't capture derefs in case of move captures, which would have be applied to
|
||||
|
@ -1612,7 +1612,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// We don't capture derefs of raw ptrs
|
||||
ty::RawPtr(_) => unreachable!(),
|
||||
|
||||
// Derefencing a mut-ref allows us to mut the Place if we don't deref
|
||||
// Dereferencing a mut-ref allows us to mut the Place if we don't deref
|
||||
// an immut-ref after on top of this.
|
||||
ty::Ref(.., hir::Mutability::Mut) => is_mutbl = hir::Mutability::Mut,
|
||||
|
||||
|
@ -1873,7 +1873,7 @@ fn restrict_precision_for_unsafe<'tcx>(
|
|||
}
|
||||
|
||||
if proj.ty.is_union() {
|
||||
// Don't capture preicse fields of a union.
|
||||
// Don't capture precise fields of a union.
|
||||
truncate_place_to_len_and_update_capture_kind(&mut place, &mut curr_mode, i + 1);
|
||||
break;
|
||||
}
|
||||
|
@ -1885,7 +1885,7 @@ fn restrict_precision_for_unsafe<'tcx>(
|
|||
/// Truncate projections so that following rules are obeyed by the captured `place`:
|
||||
/// - No Index projections are captured, since arrays are captured completely.
|
||||
/// - No unsafe block is required to capture `place`
|
||||
/// Returns the truncated place and updated cature mode.
|
||||
/// Returns the truncated place and updated capture mode.
|
||||
fn restrict_capture_precision<'tcx>(
|
||||
place: Place<'tcx>,
|
||||
curr_mode: ty::UpvarCapture,
|
||||
|
@ -2059,7 +2059,7 @@ fn migration_suggestion_for_2229(
|
|||
/// It is the caller's duty to figure out which path_expr_id to use.
|
||||
///
|
||||
/// 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
|
||||
/// then `CaptureInfo` A is preferred. This can be useful in cases where we want to prioritize
|
||||
/// expressions reported back to the user as part of diagnostics based on which appears earlier
|
||||
/// in the closure. This can be achieved simply by calling
|
||||
/// `determine_capture_info(existing_info, current_info)`. This works out because the
|
||||
|
|
|
@ -510,7 +510,7 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<'tcx>>(
|
|||
|
||||
for (region_a, region_a_idx) in ®ions {
|
||||
// Ignore `'static` lifetimes for the purpose of this lint: it's
|
||||
// because we know it outlives everything and so doesn't give meaninful
|
||||
// because we know it outlives everything and so doesn't give meaningful
|
||||
// clues
|
||||
if let ty::ReStatic = **region_a {
|
||||
continue;
|
||||
|
@ -677,9 +677,9 @@ fn resolve_regions_with_wf_tys<'tcx>(
|
|||
struct GATSubstCollector<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
gat: DefId,
|
||||
// Which region appears and which parameter index its subsituted for
|
||||
// Which region appears and which parameter index its substituted for
|
||||
regions: FxHashSet<(ty::Region<'tcx>, usize)>,
|
||||
// Which params appears and which parameter index its subsituted for
|
||||
// Which params appears and which parameter index its substituted for
|
||||
types: FxHashSet<(Ty<'tcx>, usize)>,
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||
if let Some(ty::Ref(_, base_ty, _)) = base_ty {
|
||||
let index_ty = typeck_results.expr_ty_adjusted_opt(index).unwrap_or_else(|| {
|
||||
// When encountering `return [0][0]` outside of a `fn` body we would attempt
|
||||
// to access an unexistend index. We assume that more relevant errors will
|
||||
// to access an nonexistent index. We assume that more relevant errors will
|
||||
// already have been emitted, so we only gate on this with an ICE if no
|
||||
// error has been emitted. (#64638)
|
||||
self.fcx.tcx.ty_error_with_message(
|
||||
|
|
|
@ -2928,7 +2928,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, id: DefId) -> CodegenFnAttrs {
|
|||
// The `#[target_feature]` attribute is allowed on
|
||||
// WebAssembly targets on all functions, including safe
|
||||
// ones. Other targets require that `#[target_feature]` is
|
||||
// only applied to unsafe funtions (pending the
|
||||
// only applied to unsafe functions (pending the
|
||||
// `target_feature_11` feature) because on most targets
|
||||
// execution of instructions that are not supported is
|
||||
// considered undefined behavior. For WebAssembly which is a
|
||||
|
|
|
@ -43,7 +43,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
|
|||
// In the above code we would call this query with the def_id of 3 and
|
||||
// the parent_node we match on would be the hir node for Self::Assoc<3>
|
||||
//
|
||||
// `Self::Assoc<3>` cant be resolved without typchecking here as we
|
||||
// `Self::Assoc<3>` cant be resolved without typechecking here as we
|
||||
// didnt write <Self as Foo>::Assoc<3>. If we did then another match
|
||||
// arm would handle this.
|
||||
//
|
||||
|
|
|
@ -173,7 +173,7 @@ struct EraseAllBoundRegions<'tcx> {
|
|||
// `ItemCtxt::to_ty`. To make things simpler, we just erase all
|
||||
// of them, regardless of depth. At worse, this will give
|
||||
// us an inaccurate span for an error message, but cannot
|
||||
// lead to unsoundess (we call `delay_span_bug` at the start
|
||||
// lead to unsoundness (we call `delay_span_bug` at the start
|
||||
// of `diagnostic_hir_wf_check`).
|
||||
impl<'tcx> TypeFolder<'tcx> for EraseAllBoundRegions<'tcx> {
|
||||
fn tcx<'a>(&'a self) -> TyCtxt<'tcx> {
|
||||
|
|
|
@ -187,7 +187,7 @@ fn enforce_impl_params_are_constrained(
|
|||
|
||||
// (*) This is a horrible concession to reality. I think it'd be
|
||||
// better to just ban unconstrained lifetimes outright, but in
|
||||
// practice people do non-hygenic macros like:
|
||||
// practice people do non-hygienic macros like:
|
||||
//
|
||||
// ```
|
||||
// macro_rules! __impl_slice_eq1 {
|
||||
|
|
|
@ -484,7 +484,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
let msg = format!("add missing {} argument{}", self.kind(), pluralize!(num_missing_args));
|
||||
|
||||
// we first try to get lifetime name suggestions from scope or elision information. If none is
|
||||
// available we use the parameter defintions
|
||||
// available we use the parameter definitions
|
||||
let suggested_args = if let Some(hir_id) = self.path_segment.hir_id {
|
||||
if let Some(lifetimes_in_scope) = self.tcx.lifetime_scope(hir_id) {
|
||||
match lifetimes_in_scope {
|
||||
|
@ -587,7 +587,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
|
|||
(gen_args_span.shrink_to_lo(), true)
|
||||
} else {
|
||||
let arg_span = self.gen_args.args[sugg_offset - 1].span();
|
||||
// If we came here then inferred lifetimes's spans can only point
|
||||
// If we came here then inferred lifetime's spans can only point
|
||||
// to either the opening bracket or to the space right after.
|
||||
// Both of these spans have an `hi` lower than or equal to the span
|
||||
// of the generics excluding the brackets.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue