Fix misuses of a vs an · rust-lang/rust@f44d116 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit f44d116

Fix misuses of a vs an

Signed-off-by: cui fliter imcusg@gmail.com

File tree

16 files changed

lines changed

16 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -446,7 +446,7 @@ impl Token {
446 446 }
447 447 }
448 448
449 -/// Returns `true` if the token can appear at the start of an pattern.
449 +/// Returns `true` if the token can appear at the start of a pattern.
450 450 ///
451 451 /// Shamelessly borrowed from `can_begin_expr`, only used for diagnostics right now.
452 452 pub fn can_begin_pattern(&self) -> bool {
Original file line number Diff line number Diff line change
@@ -162,7 +162,7 @@ pub enum StabilityLevel {
162 162 is_soft: bool,
163 163 /// If part of a feature is stabilized and a new feature is added for the remaining parts,
164 164 /// then the `implied_by` attribute is used to indicate which now-stable feature previously
165 - /// contained a item.
165 + /// contained an item.
166 166 ///
167 167 /// ```pseudo-Rust
168 168 /// #[unstable(feature = "foo", issue = "...")]
Original file line number Diff line number Diff line change
@@ -1364,7 +1364,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1364 1364 err.note(format!(
1365 1365 "a for loop advances the iterator for you, the result is stored in `{loop_bind}`."
1366 1366 ));
1367 - err.help("if you want to call `next` on a iterator within the loop, consider using `while let`.");
1367 + err.help("if you want to call `next` on an iterator within the loop, consider using `while let`.");
1368 1368 }
1369 1369 }
1370 1370
Original file line number Diff line number Diff line change
@@ -1358,9 +1358,9 @@ fn suggest_ampmut<'tcx>(
1358 1358 None => (false, decl_span),
1359 1359 };
1360 1360
1361 -// if the binding already exists and is a reference with a explicit
1361 +// if the binding already exists and is a reference with an explicit
1362 1362 // lifetime, then we can suggest adding ` mut`. this is special-cased from
1363 -// the path without a explicit lifetime.
1363 +// the path without an explicit lifetime.
1364 1364 if let Ok(src) = tcx.sess.source_map().span_to_snippet(span)
1365 1365 && src.starts_with("&'")
1366 1366 // note that `& 'a T` is invalid so this is correct.
Original file line number Diff line number Diff line change
@@ -1966,7 +1966,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
1966 1966 Reservation(WriteKind::MutableBorrow(BorrowKind::Mut { kind: mut_borrow_kind }))
1967 1967 | Write(WriteKind::MutableBorrow(BorrowKind::Mut { kind: mut_borrow_kind })) => {
1968 1968 let is_local_mutation_allowed = match mut_borrow_kind {
1969 -// `ClosureCapture` is used for mutable variable with a immutable binding.
1969 +// `ClosureCapture` is used for mutable variable with an immutable binding.
1970 1970 // This is only behaviour difference between `ClosureCapture` and mutable borrows.
1971 1971 MutBorrowKind::ClosureCapture => LocalMutationIsAllowed::Yes,
1972 1972 MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow => {
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ struct UniversalRegionIndices<'tcx> {
164 164 /// be able to map them to our internal `RegionVid`. This is
165 165 /// basically equivalent to an `GenericArgs`, except that it also
166 166 /// contains an entry for `ReStatic` -- it might be nice to just
167 - /// use a args, and then handle `ReStatic` another way.
167 + /// use an args, and then handle `ReStatic` another way.
168 168 indices: FxHashMap<ty::Region<'tcx>, RegionVid>,
169 169
170 170 /// The vid assigned to `'static`. Used only for diagnostics.
@@ -290,7 +290,7 @@ impl<'tcx> UniversalRegions<'tcx> {
290 290 (FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
291 291 }
292 292
293 -/// Returns `true` if `r` is classified as an local region.
293 +/// Returns `true` if `r` is classified as a local region.
294 294 pub fn is_local_free_region(&self, r: RegionVid) -> bool {
295 295 self.region_classification(r) == Some(RegionClassification::Local)
296 296 }
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ fn clif_sig_from_fn_abi<'tcx>(
30 30 let inputs = fn_abi.args.iter().flat_map(|arg_abi
31 31
32 32 let (return_ptr, returns) = fn_abi.ret.get_abi_return(tcx);
33 -// Sometimes the first param is an pointer to the place where the return value needs to be stored.
33 +// Sometimes the first param is a pointer to the place where the return value needs to be stored.
34 34 let params: Vec<_> = return_ptr.into_iter().chain(inputs).collect();
35 35
36 36 Signature { params, returns, call_conv }
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ impl<'ll> CodegenCx<'ll, '_> {
112 112 }
113 113 }
114 114
115 -/// Return a LLVM type that has at most the required alignment,
115 +/// Return an LLVM type that has at most the required alignment,
116 116 /// and exactly the required size, as a best-effort padding array.
117 117 pub(crate) fn type_padding_filler(&self, size: Size, align: Align) -> &'ll Type {
118 118 let unit = Integer::approximate_align(self, align);
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
30 30 fn type_ptr_ext(&self, address_space: AddressSpace) -> Self::Type;
31 31 fn element_type(&self, ty: Self::Type) -> Self::Type;
32 32
33 -/// Returns the number of elements in `self` if it is a LLVM vector type.
33 +/// Returns the number of elements in `self` if it is an LLVM vector type.
34 34 fn vector_length(&self, ty: Self::Type) -> usize;
35 35
36 36 fn float_width(&self, ty: Self::Type) -> usize;
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@
44 44 //! the most suitable spot to implement it, and then just let the
45 45 //! other fns cycle around. The handoff works like this:
46 46 //!
47 -//! - `into(place)` -> fallback is to create a rvalue with `as_rvalue` and assign it to `place`
47 +//! - `into(place)` -> fallback is to create an rvalue with `as_rvalue` and assign it to `place`
48 48 //! - `as_rvalue` -> fallback is to create an Operand with `as_operand` and use `Rvalue::use`
49 49 //! - `as_operand` -> either invokes `as_constant` or `as_temp`
50 50 //! - `as_constant` -> (no fallback)
Original file line number Diff line number Diff line change
@@ -528,7 +528,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
528 528 arg.make_indirect();
529 529 } else {
530 530 // We want to pass small aggregates as immediates, but using
531 -// a LLVM aggregate type for this leads to bad optimizations,
531 +// an LLVM aggregate type for this leads to bad optimizations,
532 532 // so we pick an appropriately sized integer type instead.
533 533 arg.cast_to(Reg { kind: RegKind::Integer, size });
534 534 }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1 1 use core::iter::Peekable;
2 2
3 -/// A iterator for deduping the key of a sorted iterator.
3 +/// An iterator for deduping the key of a sorted iterator.
4 4 /// When encountering the duplicated key, only the last key-value pair is yielded.
5 5 ///
6 6 /// Used by [`BTreeMap::bulk_build_from_sorted_iter`][1].
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ The following procedure outlines the build process for the MIPS64 R6 target with
67 67
68 68 ### Prerequisite: Disable debuginfo
69 69
70 -A LLVM bug makes rustc crash if debug or debug info generation is enabled. You need to edit `config.toml` to disable this:
70 +An LLVM bug makes rustc crash if debug or debug info generation is enabled. You need to edit `config.toml` to disable this:
71 71
72 72 ```toml
73 73 [rust]
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
4 4
5 5 // Regression test for issue #79865.
6 6 // The assertion will fail when compiled with Rust 1.56..=1.59
7 -// due to a LLVM miscompilation.
7 +// due to an LLVM miscompilation.
8 8
9 9 use std::arch::x86_64::*;
10 10
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ enum Foo {
12 12 }
13 13
14 14 // NOTE(eddyb) Don't make this a const, needs to be a static
15 -// so it is always instantiated as a LLVM constant value.
15 +// so it is always instantiated as an LLVM constant value.
16 16 static FOO: Foo = Foo::C;
17 17
18 18 fn main() {
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1 -// Verify that we do not trigger a LLVM assertion by creating zero-sized DWARF fragments.
1 +// Verify that we do not trigger an LLVM assertion by creating zero-sized DWARF fragments.
2 2 //
3 3 // build-pass
4 4 // compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates