Fix typos “an”→“a” and a few different ones that appeared in the same search

This commit is contained in:
Frank Steffahn 2021-08-22 18:15:49 +02:00
parent 2396fad095
commit 2f9ddf3bc7
36 changed files with 43 additions and 43 deletions

View File

@ -1031,7 +1031,7 @@ fn generic_simd_intrinsic(
// vector mask and returns an unsigned integer containing the most
// significant bit (MSB) of each lane.
// If the vector has less than 8 lanes, an u8 is returned with zeroed
// If the vector has less than 8 lanes, a u8 is returned with zeroed
// trailing bits.
let expected_int_bits = in_len.max(8);
match ret_ty.kind() {

View File

@ -974,7 +974,7 @@ pub enum PatKind<'hir> {
/// Invariant: `pats.len() >= 2`.
Or(&'hir [Pat<'hir>]),
/// A path pattern for an unit struct/variant or a (maybe-associated) constant.
/// A path pattern for a unit struct/variant or a (maybe-associated) constant.
Path(QPath<'hir>),
/// A tuple pattern (e.g., `(a, b)`).

View File

@ -3371,7 +3371,7 @@ declare_lint! {
}
declare_lint! {
/// The `unsupported_calling_conventions` lint is output whenever there is an use of the
/// The `unsupported_calling_conventions` lint is output whenever there is a use of the
/// `stdcall`, `fastcall`, `thiscall`, `vectorcall` calling conventions (or their unwind
/// variants) on targets that cannot meaningfully be supported for the requested target.
///

View File

@ -62,7 +62,7 @@ crate struct CrateMetadata {
// --- Some data pre-decoded from the metadata blob, usually for performance ---
/// Properties of the whole crate.
/// NOTE(eddyb) we pass `'static` to a `'tcx` parameter because this
/// lifetime is only used behind `Lazy`, and therefore acts like an
/// lifetime is only used behind `Lazy`, and therefore acts like a
/// universal (`for<'tcx>`), that is paired up with whichever `TyCtxt`
/// is being used to decode those values.
root: CrateRoot<'static>,

View File

@ -376,27 +376,27 @@ impl<'tcx, Tag: Provenance> Scalar<Tag> {
self.to_bits(sz)
}
/// Converts the scalar to produce an `u8`. Fails if the scalar is a pointer.
/// Converts the scalar to produce a `u8`. Fails if the scalar is a pointer.
pub fn to_u8(self) -> InterpResult<'static, u8> {
self.to_unsigned_with_bit_width(8).map(|v| u8::try_from(v).unwrap())
}
/// Converts the scalar to produce an `u16`. Fails if the scalar is a pointer.
/// Converts the scalar to produce a `u16`. Fails if the scalar is a pointer.
pub fn to_u16(self) -> InterpResult<'static, u16> {
self.to_unsigned_with_bit_width(16).map(|v| u16::try_from(v).unwrap())
}
/// Converts the scalar to produce an `u32`. Fails if the scalar is a pointer.
/// Converts the scalar to produce a `u32`. Fails if the scalar is a pointer.
pub fn to_u32(self) -> InterpResult<'static, u32> {
self.to_unsigned_with_bit_width(32).map(|v| u32::try_from(v).unwrap())
}
/// Converts the scalar to produce an `u64`. Fails if the scalar is a pointer.
/// Converts the scalar to produce a `u64`. Fails if the scalar is a pointer.
pub fn to_u64(self) -> InterpResult<'static, u64> {
self.to_unsigned_with_bit_width(64).map(|v| u64::try_from(v).unwrap())
}
/// Converts the scalar to produce an `u128`. Fails if the scalar is a pointer.
/// Converts the scalar to produce a `u128`. Fails if the scalar is a pointer.
pub fn to_u128(self) -> InterpResult<'static, u128> {
self.to_unsigned_with_bit_width(128)
}

View File

@ -265,7 +265,7 @@ impl BorrowKind {
BorrowKind::Shared => hir::Mutability::Not,
// We have no type corresponding to a unique imm borrow, so
// use `&mut`. It gives all the capabilities of an `&uniq`
// use `&mut`. It gives all the capabilities of a `&uniq`
// and hence is a safe "over approximation".
BorrowKind::Unique => hir::Mutability::Mut,

View File

@ -1202,7 +1202,7 @@ pub enum NonUseContext {
StorageDead,
/// User type annotation assertions for NLL.
AscribeUserTy,
/// The data of an user variable, for debug info.
/// The data of a user variable, for debug info.
VarDebugInfo,
}

View File

@ -1733,7 +1733,7 @@ rustc_queries! {
}
/// Performs an HIR-based well-formed check on the item with the given `HirId`. If
/// we get an `Umimplemented` error that matches the provided `Predicate`, return
/// we get an `Unimplemented` error that matches the provided `Predicate`, return
/// the cause of the newly created obligation.
///
/// This is only used by error-reporting code to get a better cause (in particular, a better

View File

@ -434,7 +434,7 @@ impl BorrowKind {
ImmBorrow => hir::Mutability::Not,
// We have no type corresponding to a unique imm borrow, so
// use `&mut`. It gives all the capabilities of an `&uniq`
// use `&mut`. It gives all the capabilities of a `&uniq`
// and hence is a safe "over approximation".
UniqueImmBorrow => hir::Mutability::Mut,
}

View File

@ -209,7 +209,7 @@ where
impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for Ty<'tcx> {
#[allow(rustc::usage_of_ty_tykind)]
fn decode(decoder: &mut D) -> Result<Ty<'tcx>, D::Error> {
// Handle shorthands first, if we have an usize > 0x80.
// Handle shorthands first, if we have a usize > 0x80.
if decoder.positioned_at_shorthand() {
let pos = decoder.read_usize()?;
assert!(pos >= SHORTHAND_OFFSET);
@ -228,7 +228,7 @@ impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for Ty<'tcx> {
impl<'tcx, D: TyDecoder<'tcx>> Decodable<D> for ty::Binder<'tcx, ty::PredicateKind<'tcx>> {
fn decode(decoder: &mut D) -> Result<ty::Binder<'tcx, ty::PredicateKind<'tcx>>, D::Error> {
let bound_vars = Decodable::decode(decoder)?;
// Handle shorthands first, if we have an usize > 0x80.
// Handle shorthands first, if we have a usize > 0x80.
Ok(ty::Binder::bind_with_vars(
if decoder.positioned_at_shorthand() {
let pos = decoder.read_usize()?;

View File

@ -239,7 +239,7 @@ static_assert_size!(TyKind<'_>, 32);
/// implements `CK<(u32, u32), Output = u32>`, where `CK` is the trait
/// specified above.
/// - U is a type parameter representing the types of its upvars, tupled up
/// (borrowed, if appropriate; that is, if an U field represents a by-ref upvar,
/// (borrowed, if appropriate; that is, if a U field represents a by-ref upvar,
/// and the up-var has the type `Foo`, then that field of U will be `&Foo`).
///
/// So, for example, given this function:

View File

@ -857,7 +857,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
// types above, in `visit_primitive`.
// In run-time mode, we accept pointers in here. This is actually more
// permissive than a per-element check would be, e.g., we accept
// an &[u8] that contains a pointer even though bytewise checking would
// a &[u8] that contains a pointer even though bytewise checking would
// reject it. However, that's good: We don't inherently want
// to reject those pointers, we just do not have the machinery to
// talk about parts of a pointer.

View File

@ -145,7 +145,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
// FIXME(oli-obk, eddyb) Optimize locals (or even local paths) to hold
// constants, instead of just checking for const-folding succeeding.
// That would require an uniform one-def no-mutation analysis
// That would require a uniform one-def no-mutation analysis
// and RPO (or recursing when needing the value of a local).
let mut optimization_finder = ConstPropagator::new(body, dummy_body, tcx);
optimization_finder.visit_body(body);

View File

@ -92,7 +92,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
/// "rustc_peek: bit not set".
///
/// The intention is that one can write unit tests for dataflow by
/// putting code into an UI test and using `rustc_peek` to
/// putting code into a UI test and using `rustc_peek` to
/// make observations about the results of dataflow static analyses.
///
/// (If there are any calls to `rustc_peek` that do not match the

View File

@ -208,7 +208,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
);
this.diverge_from(loop_block);
// The “return” value of the loop body must always be an unit. We therefore
// The “return” value of the loop body must always be a unit. We therefore
// introduce a unit temporary as the destination for the loop body.
let tmp = this.get_unit_temp();
// Execute the body, branching back to the test.

View File

@ -788,7 +788,7 @@ impl<'tcx> Cx<'tcx> {
self.user_substs_applied_to_ty_of_hir_id(hir_id)
}
// `Self` is used in expression as a tuple struct constructor or an unit struct constructor
// `Self` is used in expression as a tuple struct constructor or a unit struct constructor
Res::SelfCtor(_) => self.user_substs_applied_to_ty_of_hir_id(hir_id),
_ => bug!("user_substs_applied_to_res: unexpected res {:?} at {:?}", res, hir_id),

View File

@ -100,7 +100,7 @@ pub trait FileLoader {
/// Query the existence of a file.
fn file_exists(&self, path: &Path) -> bool;
/// Read the contents of an UTF-8 file into memory.
/// Read the contents of a UTF-8 file into memory.
fn read_file(&self, path: &Path) -> io::Result<String>;
}

View File

@ -155,7 +155,7 @@ fn unused_crates_lint(tcx: TyCtxt<'_>) {
}
// If the extern crate isn't in the extern prelude,
// there is no way it can be written as an `use`.
// there is no way it can be written as a `use`.
let orig_name = extern_crate.orig_name.unwrap_or(item.ident.name);
if !extern_prelude.get(&orig_name).map_or(false, |from_item| !from_item) {
continue;

View File

@ -46,7 +46,7 @@
//! }
//! }
//!
//! // Each node is represented as an `usize`, for a shorter implementation.
//! // Each node is represented as a `usize`, for a shorter implementation.
//! struct Edge {
//! node: usize,
//! cost: usize,

View File

@ -1013,7 +1013,7 @@ extern "rust-intrinsic" {
/// let val_casts = unsafe { &mut *(ptr as *mut i32 as *mut u32) };
/// ```
///
/// Turning an `&str` into an `&[u8]`:
/// Turning an `&str` into a `&[u8]`:
///
/// ```
/// // this is not a good way to do this.

View File

@ -660,7 +660,7 @@ pub unsafe fn zeroed<T>() -> T {
#[rustc_diagnostic_item = "mem_uninitialized"]
#[track_caller]
pub unsafe fn uninitialized<T>() -> T {
// SAFETY: the caller must guarantee that an unitialized value is valid for `T`.
// SAFETY: the caller must guarantee that an uninitialized value is valid for `T`.
unsafe {
intrinsics::assert_uninit_valid::<T>();
MaybeUninit::uninit().assume_init()

View File

@ -767,7 +767,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
///
/// # Examples
///
/// Read an usize value from a byte buffer:
/// Read a usize value from a byte buffer:
///
/// ```
/// use std::mem;
@ -960,7 +960,7 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
///
/// # Examples
///
/// Write an usize value to a byte buffer:
/// Write a usize value to a byte buffer:
///
/// ```
/// use std::mem;
@ -1232,7 +1232,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
let smoda = stride & a_minus_one;
// SAFETY: a is power-of-two hence non-zero. stride == 0 case is handled above.
let gcdpow = unsafe { intrinsics::cttz_nonzero(stride).min(intrinsics::cttz_nonzero(a)) };
// SAFETY: gcdpow has an upper-bound thats at most the number of bits in an usize.
// SAFETY: gcdpow has an upper-bound thats at most the number of bits in a usize.
let gcd = unsafe { unchecked_shl(1usize, gcdpow) };
// SAFETY: gcd is always greater or equal to 1.

View File

@ -94,7 +94,7 @@
//!
//! * [`OsStr`] represents a borrowed reference to a string in a
//! format that can be passed to the operating system. It can be
//! converted into an UTF-8 Rust string slice in a similar way to
//! converted into a UTF-8 Rust string slice in a similar way to
//! [`OsString`].
//!
//! # Conversions

View File

@ -1150,7 +1150,7 @@ impl<'a> DerefMut for IoSliceMut<'a> {
/// A buffer type used with `Write::write_vectored`.
///
/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be
/// It is semantically a wrapper around a `&[u8]`, but is guaranteed to be
/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on
/// Windows.
#[stable(feature = "iovec", since = "1.36.0")]

View File

@ -2289,7 +2289,7 @@ mod dyn_keyword {}
/// }
///
/// let mut u = IntOrFloat { f: 1.0 };
/// // Reading the fields of an union is always unsafe
/// // Reading the fields of a union is always unsafe
/// assert_eq!(unsafe { u.i }, 1065353216);
/// // Updating through any of the field will modify all of them
/// u.i = 1073741824;

View File

@ -162,7 +162,7 @@ impl io::Read for Stdin {
}
let mut utf16_buf = [0u16; MAX_BUFFER_SIZE / 2];
// In the worst case, an UTF-8 string can take 3 bytes for every `u16` of an UTF-16. So
// In the worst case, a UTF-8 string can take 3 bytes for every `u16` of a UTF-16. So
// we can read at most a third of `buf.len()` chars and uphold the guarantee no data gets
// lost.
let amount = cmp::min(buf.len() / 3, utf16_buf.len());

View File

@ -785,7 +785,7 @@ pub fn is_code_point_boundary(slice: &Wtf8, index: usize) -> bool {
/// Copied from core::str::raw::slice_unchecked
#[inline]
pub unsafe fn slice_unchecked(s: &Wtf8, begin: usize, end: usize) -> &Wtf8 {
// memory layout of an &[u8] and &Wtf8 are the same
// memory layout of a &[u8] and &Wtf8 are the same
Wtf8::from_bytes_unchecked(slice::from_raw_parts(s.bytes.as_ptr().add(begin), end - begin))
}

View File

@ -84,7 +84,7 @@ pub mod inner {
pub(super) fn monotonize(raw: time::Instant) -> time::Instant {
let delta = raw.checked_sub_instant(&ZERO).unwrap();
// Split into seconds and nanos since Duration doesn't have a
// constructor that takes an u128
// constructor that takes a u128
let secs = delta.as_secs() as u128;
let nanos = delta.subsec_nanos() as u128;
let timestamp: u128 = secs << 64 | nanos;

View File

@ -7,7 +7,7 @@ fn dummy(x: u8) -> u8 {
// EMIT_MIR copy_propagation_arg.foo.DestinationPropagation.diff
fn foo(mut x: u8) {
// calling `dummy` to make an use of `x` that copyprop cannot eliminate
// calling `dummy` to make a use of `x` that copyprop cannot eliminate
x = dummy(x); // this will assign a local to `x`
}

View File

@ -1,6 +1,6 @@
// compile-flags: -Z unstable-options
// NOTE: This test doesn't actually require `fulldeps`
// so we could instead use it as an `ui` test.
// so we could instead use it as a `ui` test.
//
// Considering that all other `internal-lints` are tested here
// this seems like the cleaner solution though.

View File

@ -74,7 +74,7 @@ impl LateLintPass<'_> for PtrEq {
}
}
// If the given expression is a cast to an usize, return the lhs of the cast
// If the given expression is a cast to a usize, return the lhs of the cast
// E.g., `foo as *const _ as usize` returns `foo as *const _`.
fn expr_as_cast_to_usize<'tcx>(cx: &LateContext<'tcx>, cast_expr: &'tcx Expr<'_>) -> Option<&'tcx Expr<'tcx>> {
if cx.typeck_results().expr_ty(cast_expr) == cx.tcx.types.usize {

View File

@ -401,7 +401,7 @@ fn rewrite_macro_inner(
handle_vec_semi(context, shape, arg_vec, macro_name, style)
} else {
// If we are rewriting `vec!` macro or other special macros,
// then we can rewrite this as an usual array literal.
// then we can rewrite this as a usual array literal.
// Otherwise, we must preserve the original existence of trailing comma.
let macro_name = &macro_name.as_str();
let mut force_trailing_comma = if trailing_comma {

View File

@ -153,7 +153,7 @@ pub(crate) fn rewrite_string<'a>(
wrap_str(result, fmt.config.max_width(), fmt.shape)
}
/// Returns the index to the end of the URL if the split at index of the given string includes an
/// Returns the index to the end of the URL if the split at index of the given string includes a
/// URL or alike. Otherwise, returns `None`.
fn detect_url(s: &[&str], index: usize) -> Option<usize> {
let start = match s[..=index].iter().rposition(|g| is_whitespace(g)) {

View File

@ -2,7 +2,7 @@
//!
//! The features are detected using the `detect_features` function below.
//! This function uses the CPUID instruction to read the feature flags from the
//! CPU and encodes them in an `usize` where each bit position represents
//! CPU and encodes them in a `usize` where each bit position represents
//! whether a feature is available (bit is set) or unavaiable (bit is cleared).
//!
//! The enum `Feature` is used to map bit positions to feature names, and the

View File

@ -2,7 +2,7 @@
//!
//! The features are detected using the `detect_features` function below.
//! This function uses the CPUID instruction to read the feature flags from the
//! CPU and encodes them in an `usize` where each bit position represents
//! CPU and encodes them in a `usize` where each bit position represents
//! whether a feature is available (bit is set) or unavaiable (bit is cleared).
//!
//! The enum `Feature` is used to map bit positions to feature names, and the

View File

@ -66,7 +66,7 @@ enum LIUState {
EXP_END,
}
/// Returns `true` if `line` appears to be a line comment containing an URL,
/// Returns `true` if `line` appears to be a line comment containing a URL,
/// possibly with a Markdown link label in front, and nothing else.
/// The Markdown link label, if present, may not contain whitespace.
/// Lines of this form are allowed to be overlength, because Markdown