Skip to content

Fix misuses of a vs an #116223

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
Oct 5, 2023
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/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ impl Token {
}
}

/// Returns `true` if the token can appear at the start of an pattern.
/// Returns `true` if the token can appear at the start of a pattern.
///
/// Shamelessly borrowed from `can_begin_expr`, only used for diagnostics right now.
pub fn can_begin_pattern(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_attr/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub enum StabilityLevel {
is_soft: bool,
/// If part of a feature is stabilized and a new feature is added for the remaining parts,
/// then the `implied_by` attribute is used to indicate which now-stable feature previously
/// contained a item.
/// contained an item.
///
/// ```pseudo-Rust
/// #[unstable(feature = "foo", issue = "...")]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
err.note(format!(
"a for loop advances the iterator for you, the result is stored in `{loop_bind}`."
));
err.help("if you want to call `next` on a iterator within the loop, consider using `while let`.");
err.help("if you want to call `next` on an iterator within the loop, consider using `while let`.");
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,9 +1358,9 @@ fn suggest_ampmut<'tcx>(
None => (false, decl_span),
};

// if the binding already exists and is a reference with a explicit
// if the binding already exists and is a reference with an explicit
// lifetime, then we can suggest adding ` mut`. this is special-cased from
// the path without a explicit lifetime.
// the path without an explicit lifetime.
if let Ok(src) = tcx.sess.source_map().span_to_snippet(span)
&& src.starts_with("&'")
// note that `& 'a T` is invalid so this is correct.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
Reservation(WriteKind::MutableBorrow(BorrowKind::Mut { kind: mut_borrow_kind }))
| Write(WriteKind::MutableBorrow(BorrowKind::Mut { kind: mut_borrow_kind })) => {
let is_local_mutation_allowed = match mut_borrow_kind {
// `ClosureCapture` is used for mutable variable with a immutable binding.
// `ClosureCapture` is used for mutable variable with an immutable binding.
// This is only behaviour difference between `ClosureCapture` and mutable borrows.
MutBorrowKind::ClosureCapture => LocalMutationIsAllowed::Yes,
MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow => {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/universal_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ struct UniversalRegionIndices<'tcx> {
/// be able to map them to our internal `RegionVid`. This is
/// basically equivalent to an `GenericArgs`, except that it also
/// contains an entry for `ReStatic` -- it might be nice to just
/// use a args, and then handle `ReStatic` another way.
/// use an args, and then handle `ReStatic` another way.
indices: FxHashMap<ty::Region<'tcx>, RegionVid>,

/// The vid assigned to `'static`. Used only for diagnostics.
Expand Down Expand Up @@ -290,7 +290,7 @@ impl<'tcx> UniversalRegions<'tcx> {
(FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
}

/// Returns `true` if `r` is classified as an local region.
/// Returns `true` if `r` is classified as a local region.
pub fn is_local_free_region(&self, r: RegionVid) -> bool {
self.region_classification(r) == Some(RegionClassification::Local)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn clif_sig_from_fn_abi<'tcx>(
let inputs = fn_abi.args.iter().flat_map(|arg_abi| arg_abi.get_abi_param(tcx).into_iter());

let (return_ptr, returns) = fn_abi.ret.get_abi_return(tcx);
// Sometimes the first param is an pointer to the place where the return value needs to be stored.
// Sometimes the first param is a pointer to the place where the return value needs to be stored.
let params: Vec<_> = return_ptr.into_iter().chain(inputs).collect();

Signature { params, returns, call_conv }
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<'ll> CodegenCx<'ll, '_> {
}
}

/// Return a LLVM type that has at most the required alignment,
/// Return an LLVM type that has at most the required alignment,
/// and exactly the required size, as a best-effort padding array.
pub(crate) fn type_padding_filler(&self, size: Size, align: Align) -> &'ll Type {
let unit = Integer::approximate_align(self, align);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/traits/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
fn type_ptr_ext(&self, address_space: AddressSpace) -> Self::Type;
fn element_type(&self, ty: Self::Type) -> Self::Type;

/// Returns the number of elements in `self` if it is a LLVM vector type.
/// Returns the number of elements in `self` if it is an LLVM vector type.
fn vector_length(&self, ty: Self::Type) -> usize;

fn float_width(&self, ty: Self::Type) -> usize;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/build/expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
//! the most suitable spot to implement it, and then just let the
//! other fns cycle around. The handoff works like this:
//!
//! - `into(place)` -> fallback is to create a rvalue with `as_rvalue` and assign it to `place`
//! - `into(place)` -> fallback is to create an rvalue with `as_rvalue` and assign it to `place`
//! - `as_rvalue` -> fallback is to create an Operand with `as_operand` and use `Rvalue::use`
//! - `as_operand` -> either invokes `as_constant` or `as_temp`
//! - `as_constant` -> (no fallback)
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ty_utils/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
arg.make_indirect();
} else {
// We want to pass small aggregates as immediates, but using
// a LLVM aggregate type for this leads to bad optimizations,
// an LLVM aggregate type for this leads to bad optimizations,
// so we pick an appropriately sized integer type instead.
arg.cast_to(Reg { kind: RegKind::Integer, size });
}
Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/collections/btree/dedup_sorted_iter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use core::iter::Peekable;

/// A iterator for deduping the key of a sorted iterator.
/// An iterator for deduping the key of a sorted iterator.
/// When encountering the duplicated key, only the last key-value pair is yielded.
///
/// Used by [`BTreeMap::bulk_build_from_sorted_iter`][1].
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/platform-support/mips-release-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The following procedure outlines the build process for the MIPS64 R6 target with

### Prerequisite: Disable debuginfo

A LLVM bug makes rustc crash if debug or debug info generation is enabled. You need to edit `config.toml` to disable this:
An LLVM bug makes rustc crash if debug or debug info generation is enabled. You need to edit `config.toml` to disable this:

```toml
[rust]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/codegen/issue-79865-llvm-miscompile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// Regression test for issue #79865.
// The assertion will fail when compiled with Rust 1.56..=1.59
// due to a LLVM miscompilation.
// due to an LLVM miscompilation.

use std::arch::x86_64::*;

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/consts/const-adt-align-mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum Foo {
}

// NOTE(eddyb) Don't make this a const, needs to be a static
// so it is always instantiated as a LLVM constant value.
// so it is always instantiated as an LLVM constant value.
static FOO: Foo = Foo::C;

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/debuginfo/sroa-fragment-debuginfo.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Verify that we do not trigger a LLVM assertion by creating zero-sized DWARF fragments.
// Verify that we do not trigger an LLVM assertion by creating zero-sized DWARF fragments.
//
// build-pass
// compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates
Expand Down