Fix misuses of a vs an
Signed-off-by: cui fliter <imcusg@gmail.com>
This commit is contained in:
parent
aeaa5c30e5
commit
f44d116e1f
@ -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.
|
/// Shamelessly borrowed from `can_begin_expr`, only used for diagnostics right now.
|
||||||
pub fn can_begin_pattern(&self) -> bool {
|
pub fn can_begin_pattern(&self) -> bool {
|
||||||
|
@ -162,7 +162,7 @@ pub enum StabilityLevel {
|
|||||||
is_soft: bool,
|
is_soft: bool,
|
||||||
/// If part of a feature is stabilized and a new feature is added for the remaining parts,
|
/// 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
|
/// then the `implied_by` attribute is used to indicate which now-stable feature previously
|
||||||
/// contained a item.
|
/// contained an item.
|
||||||
///
|
///
|
||||||
/// ```pseudo-Rust
|
/// ```pseudo-Rust
|
||||||
/// #[unstable(feature = "foo", issue = "...")]
|
/// #[unstable(feature = "foo", issue = "...")]
|
||||||
|
@ -1364,7 +1364,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
err.note(format!(
|
err.note(format!(
|
||||||
"a for loop advances the iterator for you, the result is stored in `{loop_bind}`."
|
"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`.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1358,9 +1358,9 @@ fn suggest_ampmut<'tcx>(
|
|||||||
None => (false, decl_span),
|
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
|
// 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)
|
if let Ok(src) = tcx.sess.source_map().span_to_snippet(span)
|
||||||
&& src.starts_with("&'")
|
&& src.starts_with("&'")
|
||||||
// note that `& 'a T` is invalid so this is correct.
|
// note that `& 'a T` is invalid so this is correct.
|
||||||
|
@ -1966,7 +1966,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
Reservation(WriteKind::MutableBorrow(BorrowKind::Mut { kind: mut_borrow_kind }))
|
Reservation(WriteKind::MutableBorrow(BorrowKind::Mut { kind: mut_borrow_kind }))
|
||||||
| Write(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 {
|
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.
|
// This is only behaviour difference between `ClosureCapture` and mutable borrows.
|
||||||
MutBorrowKind::ClosureCapture => LocalMutationIsAllowed::Yes,
|
MutBorrowKind::ClosureCapture => LocalMutationIsAllowed::Yes,
|
||||||
MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow => {
|
MutBorrowKind::Default | MutBorrowKind::TwoPhaseBorrow => {
|
||||||
|
@ -164,7 +164,7 @@ struct UniversalRegionIndices<'tcx> {
|
|||||||
/// be able to map them to our internal `RegionVid`. This is
|
/// be able to map them to our internal `RegionVid`. This is
|
||||||
/// basically equivalent to an `GenericArgs`, except that it also
|
/// basically equivalent to an `GenericArgs`, except that it also
|
||||||
/// contains an entry for `ReStatic` -- it might be nice to just
|
/// 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>,
|
indices: FxHashMap<ty::Region<'tcx>, RegionVid>,
|
||||||
|
|
||||||
/// The vid assigned to `'static`. Used only for diagnostics.
|
/// The vid assigned to `'static`. Used only for diagnostics.
|
||||||
@ -290,7 +290,7 @@ impl<'tcx> UniversalRegions<'tcx> {
|
|||||||
(FIRST_GLOBAL_INDEX..self.num_universals).map(RegionVid::from_usize)
|
(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 {
|
pub fn is_local_free_region(&self, r: RegionVid) -> bool {
|
||||||
self.region_classification(r) == Some(RegionClassification::Local)
|
self.region_classification(r) == Some(RegionClassification::Local)
|
||||||
}
|
}
|
||||||
|
@ -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 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);
|
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();
|
let params: Vec<_> = return_ptr.into_iter().chain(inputs).collect();
|
||||||
|
|
||||||
Signature { params, returns, call_conv }
|
Signature { params, returns, call_conv }
|
||||||
|
@ -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.
|
/// and exactly the required size, as a best-effort padding array.
|
||||||
pub(crate) fn type_padding_filler(&self, size: Size, align: Align) -> &'ll Type {
|
pub(crate) fn type_padding_filler(&self, size: Size, align: Align) -> &'ll Type {
|
||||||
let unit = Integer::approximate_align(self, align);
|
let unit = Integer::approximate_align(self, align);
|
||||||
|
@ -30,7 +30,7 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
|
|||||||
fn type_ptr_ext(&self, address_space: AddressSpace) -> Self::Type;
|
fn type_ptr_ext(&self, address_space: AddressSpace) -> Self::Type;
|
||||||
fn element_type(&self, ty: Self::Type) -> 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 vector_length(&self, ty: Self::Type) -> usize;
|
||||||
|
|
||||||
fn float_width(&self, ty: Self::Type) -> usize;
|
fn float_width(&self, ty: Self::Type) -> usize;
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
//! the most suitable spot to implement it, and then just let the
|
//! the most suitable spot to implement it, and then just let the
|
||||||
//! other fns cycle around. The handoff works like this:
|
//! 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_rvalue` -> fallback is to create an Operand with `as_operand` and use `Rvalue::use`
|
||||||
//! - `as_operand` -> either invokes `as_constant` or `as_temp`
|
//! - `as_operand` -> either invokes `as_constant` or `as_temp`
|
||||||
//! - `as_constant` -> (no fallback)
|
//! - `as_constant` -> (no fallback)
|
||||||
|
@ -528,7 +528,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
|
|||||||
arg.make_indirect();
|
arg.make_indirect();
|
||||||
} else {
|
} else {
|
||||||
// We want to pass small aggregates as immediates, but using
|
// 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.
|
// so we pick an appropriately sized integer type instead.
|
||||||
arg.cast_to(Reg { kind: RegKind::Integer, size });
|
arg.cast_to(Reg { kind: RegKind::Integer, size });
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use core::iter::Peekable;
|
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.
|
/// When encountering the duplicated key, only the last key-value pair is yielded.
|
||||||
///
|
///
|
||||||
/// Used by [`BTreeMap::bulk_build_from_sorted_iter`][1].
|
/// Used by [`BTreeMap::bulk_build_from_sorted_iter`][1].
|
||||||
|
@ -67,7 +67,7 @@ The following procedure outlines the build process for the MIPS64 R6 target with
|
|||||||
|
|
||||||
### Prerequisite: Disable debuginfo
|
### 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
|
```toml
|
||||||
[rust]
|
[rust]
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// Regression test for issue #79865.
|
// Regression test for issue #79865.
|
||||||
// The assertion will fail when compiled with Rust 1.56..=1.59
|
// 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::*;
|
use std::arch::x86_64::*;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ enum Foo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(eddyb) Don't make this a const, needs to be a static
|
// 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;
|
static FOO: Foo = Foo::C;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -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
|
// build-pass
|
||||||
// compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates
|
// compile-flags: -g -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user