Auto merge of #69804 - Centril:rollup-u86dc1g, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #69667 (Remove the `no_debug` feature)
 - #69687 (resolve, inconsistent binding mode: tweak wording)
 - #69708 (On mismatched delimiters, only point at empty blocks that are in the same line)
 - #69765 (reduce test size for Miri)
 - #69773 (fix various typos)
 - #69787 (mir::Local is Copy we can pass it by value in these cases)
 - #69794 (Add `Layout::dangling()` to return a well-aligned `NonNull<u8>`)
 - #69797 (Correct version that relaxed orphan rules)

Failed merges:

r? @ghost
This commit is contained in:
bors 2020-03-08 05:27:21 +00:00
commit f943349eaf
153 changed files with 286 additions and 382 deletions

View File

@ -315,7 +315,7 @@
# `0` - no debug info
# `1` - line tables only
# `2` - full debug info with variable and type information
# Can be overriden for specific subsets of Rust code (rustc, std or tools).
# Can be overridden for specific subsets of Rust code (rustc, std or tools).
# Debuginfo for tests run with compiletest is not controlled by this option
# and needs to be enabled separately with `debuginfo-level-tests`.
#debuginfo-level = if debug { 2 } else { 0 }

View File

@ -141,7 +141,7 @@ fn copy_third_party_objects(
copy_and_stamp(&srcdir, "crt1.o");
}
// Copies libunwind.a compiled to be linked wit x86_64-fortanix-unknown-sgx.
// Copies libunwind.a compiled to be linked with x86_64-fortanix-unknown-sgx.
//
// This target needs to be linked to Fortanix's port of llvm's libunwind.
// libunwind requires support for rwlock and printing to stderr,

View File

@ -33,7 +33,7 @@ pub struct Flags {
pub rustc_error_format: Option<String>,
pub dry_run: bool,
// This overrides the deny-warnings configuation option,
// This overrides the deny-warnings configuration option,
// which passes -Dwarnings to the compiler invocations.
//
// true => deny, false => warn

View File

@ -20,7 +20,7 @@ jobs:
# The macOS and Windows builds here are currently disabled due to them not being
# overly necessary on `try` builds. We also don't actually have anything that
# consumes the artifacts currently. Perhaps one day we can reenable, but for now
# consumes the artifacts currently. Perhaps one day we can re-enable, but for now
# it helps free up capacity on Azure.
# - job: macOS
# timeoutInMinutes: 600

View File

@ -453,7 +453,7 @@ override `ignore`.
### `--runtool`, `--runtool-arg`: program to run tests with; args to pass to it
Using thses options looks like this:
Using these options looks like this:
```bash
$ rustdoc src/lib.rs -Z unstable-options --runtool runner --runtool-arg --do-thing --runtool-arg --do-other-thing

View File

@ -21,7 +21,7 @@ when they'd need to do the same thing for every type anyway).
impl<T: Copy> CheapToClone for T {}
// These could potentally overlap with the blanket implementation above,
// These could potentially overlap with the blanket implementation above,
// so are only allowed because CheapToClone is a marker trait.
impl<T: CheapToClone, U: CheapToClone> CheapToClone for (T, U) {}
impl<T: CheapToClone> CheapToClone for std::ops::Range<T> {}

View File

@ -306,7 +306,7 @@ impl<K, V> Root<K, V> {
/// `NodeRef` could be pointing to either type of node.
/// Note that in case of a leaf node, this might still be the shared root!
/// Only turn this into a `LeafNode` reference if you know it is not the shared root!
/// Shared references must be dereferencable *for the entire size of their pointee*,
/// Shared references must be dereferenceable *for the entire size of their pointee*,
/// so '&LeafNode` or `&InternalNode` pointing to the shared root is undefined behavior.
/// Turning this into a `NodeHeader` reference is always safe.
pub struct NodeRef<BorrowType, K, V, Type> {

View File

@ -841,10 +841,10 @@ impl<T> LinkedList<T> {
/// d.push_front(2);
/// d.push_front(3);
///
/// let mut splitted = d.split_off(2);
/// let mut split = d.split_off(2);
///
/// assert_eq!(splitted.pop_front(), Some(1));
/// assert_eq!(splitted.pop_front(), None);
/// assert_eq!(split.pop_front(), Some(1));
/// assert_eq!(split.pop_front(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn split_off(&mut self, at: usize) -> LinkedList<T> {

View File

@ -2132,7 +2132,7 @@ impl<T> VecDeque<T> {
// Safety: the following two methods require that the rotation amount
// be less than half the length of the deque.
//
// `wrap_copy` requres that `min(x, cap() - x) + copy_len <= cap()`,
// `wrap_copy` requires that `min(x, cap() - x) + copy_len <= cap()`,
// but than `min` is never more than half the capacity, regardless of x,
// so it's sound to call here because we're calling with something
// less than half the length, which is never above half the capacity.

View File

@ -1733,9 +1733,9 @@ fn panic_safe() {
let moduli = &[5, 20, 50];
#[cfg(miri)]
let lens = 1..13;
let lens = 1..10;
#[cfg(miri)]
let moduli = &[10];
let moduli = &[5];
for len in lens {
for &modulus in moduli {

View File

@ -2894,7 +2894,7 @@ where
/// The filter test predicate.
pred: F,
/// A flag that indicates a panic has occurred in the filter test prodicate.
/// This is used as a hint in the drop implmentation to prevent consumption
/// This is used as a hint in the drop implementation to prevent consumption
/// of the remainder of the `DrainFilter`. Any unprocessed items will be
/// backshifted in the `vec`, but no further items will be dropped or
/// tested by the filter predicate.

View File

@ -140,6 +140,18 @@ impl Layout {
unsafe { Layout::from_size_align_unchecked(size, align) }
}
/// Creates a `NonNull` that is dangling, but well-aligned for this Layout.
///
/// Note that the pointer value may potentially represent a valid pointer,
/// which means this must not be used as a "not yet initialized"
/// sentinel value. Types that lazily allocate must track initialization by
/// some other means.
#[unstable(feature = "alloc_layout_extra", issue = "55724")]
pub const fn dangling(&self) -> NonNull<u8> {
// align is non-zero and a power of two
unsafe { NonNull::new_unchecked(self.align() as *mut u8) }
}
/// Creates a layout describing the record that can hold a value
/// of the same layout as `self`, but that also is aligned to
/// alignment `align` (measured in bytes).

View File

@ -229,7 +229,7 @@ pub trait AsMut<T: ?Sized> {
///
/// # Implementing [`Into`] for conversions to external types in old versions of Rust
///
/// Prior to Rust 1.40, if the destination type was not part of the current crate
/// Prior to Rust 1.41, if the destination type was not part of the current crate
/// then you couldn't implement [`From`] directly.
/// For example, take this code:
///

View File

@ -255,7 +255,7 @@ pub struct ArgumentV1<'a> {
formatter: fn(&Opaque, &mut Formatter<'_>) -> Result,
}
// This gurantees a single stable value for the function pointer associated with
// This guarantees a single stable value for the function pointer associated with
// indices/counts in the formatting infrastructure.
//
// Note that a function defined as such would not be correct as functions are

View File

@ -93,7 +93,7 @@ impl<T> ManuallyDrop<T> {
/// Instead of using [`ManuallyDrop::drop`] to manually drop the value,
/// you can use this method to take the value and use it however desired.
///
/// Whenever possible, it is preferrable to use [`into_inner`][`ManuallyDrop::into_inner`]
/// Whenever possible, it is preferable to use [`into_inner`][`ManuallyDrop::into_inner`]
/// instead, which prevents duplicating the content of the `ManuallyDrop<T>`.
///
/// # Safety

View File

@ -91,7 +91,7 @@ pub use crate::intrinsics::transmute;
/// Using `ManuallyDrop` here has two advantages:
///
/// * We do not "touch" `v` after disassembling it. For some types, operations
/// such as passing ownership (to a funcion like `mem::forget`) requires them to actually
/// such as passing ownership (to a function like `mem::forget`) requires them to actually
/// be fully owned right now; that is a promise we do not want to make here as we are
/// in the process of transferring ownership to the new `String` we are building.
/// * In case of an unexpected panic, `ManuallyDrop` is not dropped, but if the panic

View File

@ -312,7 +312,7 @@
//!
//! ## Examples
//!
//! For a type like [`Vec<T>`], both possibilites (structural pinning or not) make sense.
//! For a type like [`Vec<T>`], both possibilities (structural pinning or not) make sense.
//! A [`Vec<T>`] with structural pinning could have `get_pin`/`get_pin_mut` methods to get
//! pinned references to elements. However, it could *not* allow calling
//! [`pop`][Vec::pop] on a pinned [`Vec<T>`] because that would move the (structurally pinned)
@ -539,7 +539,7 @@ impl<P: Deref> Pin<P> {
/// ```
/// A value, once pinned, must remain pinned forever (unless its type implements `Unpin`).
///
/// Similarily, calling `Pin::new_unchecked` on an `Rc<T>` is unsafe because there could be
/// Similarly, calling `Pin::new_unchecked` on an `Rc<T>` is unsafe because there could be
/// aliases to the same data that are not subject to the pinning restrictions:
/// ```
/// use std::rc::Rc;

View File

@ -53,7 +53,7 @@ impl<T: ?Sized> *const T {
/// all of the following is true:
/// - it is properly aligned
/// - it must point to an initialized instance of T; in particular, the pointer must be
/// "dereferencable" in the sense defined [here].
/// "dereferenceable" in the sense defined [here].
///
/// This applies even if the result of this method is unused!
/// (The part about being initialized is not yet fully decided, but until
@ -183,7 +183,7 @@ impl<T: ?Sized> *const T {
/// within the same allocated object: [`offset`] is immediate Undefined Behavior when
/// crossing object boundaries; `wrapping_offset` produces a pointer but still leads
/// to Undefined Behavior if that pointer is dereferenced. [`offset`] can be optimized
/// better and is thus preferrable in performance-sensitive code.
/// better and is thus preferable in performance-sensitive code.
///
/// If you need to cross object boundaries, cast the pointer to an integer and
/// do the arithmetic there.
@ -480,7 +480,7 @@ impl<T: ?Sized> *const T {
/// within the same allocated object: [`add`] is immediate Undefined Behavior when
/// crossing object boundaries; `wrapping_add` produces a pointer but still leads
/// to Undefined Behavior if that pointer is dereferenced. [`add`] can be optimized
/// better and is thus preferrable in performance-sensitive code.
/// better and is thus preferable in performance-sensitive code.
///
/// If you need to cross object boundaries, cast the pointer to an integer and
/// do the arithmetic there.
@ -535,7 +535,7 @@ impl<T: ?Sized> *const T {
/// within the same allocated object: [`sub`] is immediate Undefined Behavior when
/// crossing object boundaries; `wrapping_sub` produces a pointer but still leads
/// to Undefined Behavior if that pointer is dereferenced. [`sub`] can be optimized
/// better and is thus preferrable in performance-sensitive code.
/// better and is thus preferable in performance-sensitive code.
///
/// If you need to cross object boundaries, cast the pointer to an integer and
/// do the arithmetic there.

View File

@ -19,7 +19,7 @@
//! * All pointers (except for the null pointer) are valid for all operations of
//! [size zero][zst].
//! * For a pointer to be valid, it is necessary, but not always sufficient, that the pointer
//! be *dereferencable*: the memory range of the given size starting at the pointer must all be
//! be *dereferenceable*: the memory range of the given size starting at the pointer must all be
//! within the bounds of a single allocated object. Note that in Rust,
//! every (stack-allocated) variable is considered a separate allocated object.
//! * All accesses performed by functions in this module are *non-atomic* in the sense

View File

@ -49,7 +49,7 @@ impl<T: ?Sized> *mut T {
/// memory.
///
/// When calling this method, you have to ensure that if the pointer is
/// non-NULL, then it is properly aligned, dereferencable (for the whole
/// non-NULL, then it is properly aligned, dereferenceable (for the whole
/// size of `T`) and points to an initialized instance of `T`. This applies
/// even if the result of this method is unused!
/// (The part about being initialized is not yet fully decided, but until
@ -176,7 +176,7 @@ impl<T: ?Sized> *mut T {
/// within the same allocated object: [`offset`] is immediate Undefined Behavior when
/// crossing object boundaries; `wrapping_offset` produces a pointer but still leads
/// to Undefined Behavior if that pointer is dereferenced. [`offset`] can be optimized
/// better and is thus preferrable in performance-sensitive code.
/// better and is thus preferable in performance-sensitive code.
///
/// If you need to cross object boundaries, cast the pointer to an integer and
/// do the arithmetic there.
@ -224,7 +224,7 @@ impl<T: ?Sized> *mut T {
/// all of the following is true:
/// - it is properly aligned
/// - it must point to an initialized instance of T; in particular, the pointer must be
/// "dereferencable" in the sense defined [here].
/// "dereferenceable" in the sense defined [here].
///
/// This applies even if the result of this method is unused!
/// (The part about being initialized is not yet fully decided, but until
@ -526,7 +526,7 @@ impl<T: ?Sized> *mut T {
/// within the same allocated object: [`add`] is immediate Undefined Behavior when
/// crossing object boundaries; `wrapping_add` produces a pointer but still leads
/// to Undefined Behavior if that pointer is dereferenced. [`add`] can be optimized
/// better and is thus preferrable in performance-sensitive code.
/// better and is thus preferable in performance-sensitive code.
///
/// If you need to cross object boundaries, cast the pointer to an integer and
/// do the arithmetic there.
@ -581,7 +581,7 @@ impl<T: ?Sized> *mut T {
/// within the same allocated object: [`sub`] is immediate Undefined Behavior when
/// crossing object boundaries; `wrapping_sub` produces a pointer but still leads
/// to Undefined Behavior if that pointer is dereferenced. [`sub`] can be optimized
/// better and is thus preferrable in performance-sensitive code.
/// better and is thus preferable in performance-sensitive code.
///
/// If you need to cross object boundaries, cast the pointer to an integer and
/// do the arithmetic there.

View File

@ -1,10 +1,13 @@
use core::alloc::Layout;
use core::ptr::NonNull;
#[test]
fn const_unchecked_layout() {
const SIZE: usize = 0x2000;
const ALIGN: usize = 0x1000;
const LAYOUT: Layout = unsafe { Layout::from_size_align_unchecked(SIZE, ALIGN) };
const DANGLING: NonNull<u8> = LAYOUT.dangling();
assert_eq!(LAYOUT.size(), SIZE);
assert_eq!(LAYOUT.align(), ALIGN);
assert_eq!(Some(DANGLING), NonNull::new(ALIGN as *mut u8));
}

View File

@ -1,3 +1,4 @@
#![feature(alloc_layout_extra)]
#![feature(bool_to_option)]
#![feature(bound_cloned)]
#![feature(box_syntax)]

View File

@ -176,7 +176,7 @@ pub struct Parser<'a> {
skips: Vec<usize>,
/// Span of the last opening brace seen, used for error reporting
last_opening_brace: Option<InnerSpan>,
/// Wether the source string is comes from `println!` as opposed to `format!` or `print!`
/// Whether the source string is comes from `println!` as opposed to `format!` or `print!`
append_newline: bool,
}

View File

@ -15,7 +15,7 @@ macro_rules! define_handles {
}
impl HandleCounters {
// FIXME(eddyb) use a reference to the `static COUNTERS`, intead of
// FIXME(eddyb) use a reference to the `static COUNTERS`, instead of
// a wrapper `fn` pointer, once `const fn` can reference `static`s.
extern "C" fn get() -> &'static Self {
static COUNTERS: HandleCounters = HandleCounters {
@ -334,7 +334,7 @@ impl Bridge<'_> {
#[repr(C)]
#[derive(Copy, Clone)]
pub struct Client<F> {
// FIXME(eddyb) use a reference to the `static COUNTERS`, intead of
// FIXME(eddyb) use a reference to the `static COUNTERS`, instead of
// a wrapper `fn` pointer, once `const fn` can reference `static`s.
pub(super) get_handle_counters: extern "C" fn() -> &'static HandleCounters,
pub(super) run: extern "C" fn(Bridge<'_>, F) -> Buffer<u8>,

View File

@ -653,7 +653,7 @@ impl<'hir> Map<'hir> {
}
}
/// Wether `hir_id` corresponds to a `mod` or a crate.
/// Whether `hir_id` corresponds to a `mod` or a crate.
pub fn is_hir_id_module(&self, hir_id: HirId) -> bool {
match self.lookup(hir_id) {
Some(Entry { node: Node::Item(Item { kind: ItemKind::Mod(_), .. }), .. })

View File

@ -58,9 +58,6 @@ bitflags! {
/// "weird symbol" for the standard library in that it has slightly
/// different linkage, visibility, and reachability rules.
const RUSTC_STD_INTERNAL_SYMBOL = 1 << 6;
/// `#[no_debug]`: an indicator that no debugging information should be
/// generated for this function by LLVM.
const NO_DEBUG = 1 << 7;
/// `#[thread_local]`: indicates a static is actually a thread local
/// piece of memory
const THREAD_LOCAL = 1 << 8;

View File

@ -610,7 +610,7 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
// a naive undef mask copying algorithm would repeatedly have to read the undef mask from
// the source and write it to the destination. Even if we optimized the memory accesses,
// we'd be doing all of this `repeat` times.
// Therefor we precompute a compressed version of the undef mask of the source value and
// Therefore we precompute a compressed version of the undef mask of the source value and
// then write it back `repeat` times without computing any more information from the source.
// A precomputed cache for ranges of defined/undefined bits

View File

@ -888,7 +888,7 @@ macro_rules! visit_place_fns {
() => (
fn visit_projection(
&mut self,
local: &Local,
local: Local,
projection: &[PlaceElem<'tcx>],
context: PlaceContext,
location: Location,
@ -898,7 +898,7 @@ macro_rules! visit_place_fns {
fn visit_projection_elem(
&mut self,
local: &Local,
local: Local,
proj_base: &[PlaceElem<'tcx>],
elem: &PlaceElem<'tcx>,
context: PlaceContext,
@ -925,7 +925,7 @@ macro_rules! visit_place_fns {
self.visit_place_base(&place.local, context, location);
self.visit_projection(&place.local,
self.visit_projection(place.local,
&place.projection,
context,
location);
@ -933,7 +933,7 @@ macro_rules! visit_place_fns {
fn super_projection(
&mut self,
local: &Local,
local: Local,
projection: &[PlaceElem<'tcx>],
context: PlaceContext,
location: Location,
@ -947,7 +947,7 @@ macro_rules! visit_place_fns {
fn super_projection_elem(
&mut self,
_local: &Local,
_local: Local,
_proj_base: &[PlaceElem<'tcx>],
elem: &PlaceElem<'tcx>,
_context: PlaceContext,

View File

@ -2579,7 +2579,7 @@ where
if let Some(kind) = pointee.safe {
attrs.pointee_align = Some(pointee.align);
// `Box` (`UniqueBorrowed`) are not necessarily dereferencable
// `Box` (`UniqueBorrowed`) are not necessarily dereferenceable
// for the entire duration of the function as they can be deallocated
// any time. Set their valid size to 0.
attrs.pointee_size = match kind {

View File

@ -97,7 +97,7 @@ pub trait Printer<'tcx>: Sized {
args: &[GenericArg<'tcx>],
) -> Result<Self::Path, Self::Error>;
// Defaults (should not be overriden):
// Defaults (should not be overridden):
fn default_print_def_path(
self,

View File

@ -221,7 +221,7 @@ pub trait PrettyPrinter<'tcx>:
/// This is typically the case for all non-`'_` regions.
fn region_should_not_be_omitted(&self, region: ty::Region<'_>) -> bool;
// Defaults (should not be overriden):
// Defaults (should not be overridden):
/// If possible, this returns a global path resolving to `def_id` that is visible
/// from at least one local module, and returns `true`. If the crate defining `def_id` is
@ -236,7 +236,7 @@ pub trait PrettyPrinter<'tcx>:
/// post-process it into the valid and visible version that
/// accounts for re-exports.
///
/// This method should only be callled by itself or
/// This method should only be called by itself or
/// `try_print_visible_def_path`.
///
/// `callers` is a chain of visible_parent's leading to `def_id`,
@ -685,7 +685,7 @@ pub trait PrettyPrinter<'tcx>:
if self.tcx().sess.verbose() {
p!(write("{:?}", sz));
} else if let ty::ConstKind::Unevaluated(..) = sz.val {
// do not try to evalute unevaluated constants. If we are const evaluating an
// do not try to evaluate unevaluated constants. If we are const evaluating an
// array length anon const, rustc will (with debug assertions) print the
// constant's path. Which will end up here again.
p!(write("_"));

View File

@ -425,7 +425,7 @@ impl<'sess> OnDiskCache<'sess> {
//- DECODING -------------------------------------------------------------------
/// A decoder that can read fro the incr. comp. cache. It is similar to the one
/// A decoder that can read from the incr. comp. cache. It is similar to the one
/// we use for crate metadata decoding in that it can rebase spans and eventually
/// will also handle things that contain `Ty` instances.
struct CacheDecoder<'a, 'tcx> {

View File

@ -1053,7 +1053,7 @@ macro_rules! define_queries_inner {
impl TyCtxt<$tcx> {
/// Returns a transparent wrapper for `TyCtxt`, which ensures queries
/// are executed instead of just returing their results.
/// are executed instead of just returning their results.
#[inline(always)]
pub fn ensure(self) -> TyCtxtEnsure<$tcx> {
TyCtxtEnsure {

View File

@ -72,7 +72,7 @@ pub trait TypeRelation<'tcx>: Sized {
b: &T,
) -> RelateResult<'tcx, T>;
// Overrideable relations. You shouldn't typically call these
// Overridable relations. You shouldn't typically call these
// directly, instead call `relate()`, which in turn calls
// these. This is both more uniform but also allows us to add
// additional hooks for other types in the future if needed

View File

@ -1078,7 +1078,7 @@ impl Expr {
// If binary operator is `Add` and both `lhs` and `rhs` are trait bounds,
// then type of result is trait object.
// Othewise we don't assume the result type.
// Otherwise we don't assume the result type.
ExprKind::Binary(binop, lhs, rhs) if binop.node == BinOpKind::Add => {
if let (Some(lhs), Some(rhs)) = (lhs.to_bound(), rhs.to_bound()) {
TyKind::TraitObject(vec![lhs, rhs], TraitObjectSyntax::None)
@ -2089,7 +2089,7 @@ impl Async {
if let Async::Yes { .. } = self { true } else { false }
}
/// In ths case this is an `async` return, the `NodeId` for the generated `impl Trait` item.
/// In this case this is an `async` return, the `NodeId` for the generated `impl Trait` item.
pub fn opt_return_id(self) -> Option<NodeId> {
match self {
Async::Yes { return_impl_trait_id, .. } => Some(return_impl_trait_id),

View File

@ -1096,7 +1096,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
match arg {
ast::GenericArg::Lifetime(lt) => GenericArg::Lifetime(self.lower_lifetime(&lt)),
ast::GenericArg::Type(ty) => {
// We parse const arguments as path types as we cannot distiguish them durring
// We parse const arguments as path types as we cannot distinguish them during
// parsing. We try to resolve that ambiguity by attempting resolution in both the
// type and value namespaces. If we resolved the path in the value namespace, we
// transform it into a generic const argument.

View File

@ -904,7 +904,7 @@ pub fn expand_preparsed_format_args(
};
/// Finds the indices of all characters that have been processed and differ between the actual
/// written code (code snippet) and the `InternedString` that get's processed in the `Parser`
/// written code (code snippet) and the `InternedString` that gets processed in the `Parser`
/// in order to properly synthethise the intra-string `Span`s for error diagnostics.
fn find_skips(snippet: &str, is_raw: bool) -> Vec<usize> {
let mut eat_ws = false;

View File

@ -504,7 +504,7 @@ fn thin_lto(
//
// This strategy means we can always save the computed imports as
// canon: when we reuse the post-ThinLTO version, condition (3.)
// ensures that the curent import set is the same as the previous
// ensures that the current import set is the same as the previous
// one. (And of course, when we don't reuse the post-ThinLTO
// version, the current import set *is* the correct one, since we
// are doing the ThinLTO in this current compilation cycle.)
@ -538,7 +538,7 @@ fn thin_lto(
}));
}
// Save the curent ThinLTO import information for the next compilation
// Save the current ThinLTO import information for the next compilation
// session, overwriting the previous serialized imports (if any).
if let Some(path) = import_map_path {
if let Err(err) = curr_import_map.save_to_file(&path) {

View File

@ -9,8 +9,8 @@ fn llvm_args_to_string_id(profiler: &SelfProfiler, pass_name: &str, ir_name: &st
let mut components = vec![StringComponent::Ref(pass_name)];
// handle that LazyCallGraph::SCC is a comma separated list within parentheses
let parentheses: &[_] = &['(', ')'];
let trimed = ir_name.trim_matches(parentheses);
for part in trimed.split(", ") {
let trimmed = ir_name.trim_matches(parentheses);
for part in trimmed.split(", ") {
let demangled_ir_name = rustc_demangle::demangle(part).to_string();
let ir_name = profiler.get_or_alloc_cached_string(demangled_ir_name);
components.push(StringComponent::Value(SEPARATOR_BYTE));

View File

@ -637,7 +637,7 @@ pub fn type_metadata(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>, usage_site_span: Sp
unsafe {
// The choice of type here is pretty arbitrary -
// anything reading the debuginfo for a recursive
// type is going to see *somthing* weird - the only
// type is going to see *something* weird - the only
// question is what exactly it will see.
let (size, align) = cx.size_and_align_of(t);
llvm::LLVMRustDIBuilderCreateBasicType(
@ -2269,10 +2269,6 @@ pub fn create_global_var_metadata(cx: &CodegenCx<'ll, '_>, def_id: DefId, global
let tcx = cx.tcx;
let attrs = tcx.codegen_fn_attrs(def_id);
if attrs.flags.contains(CodegenFnAttrFlags::NO_DEBUG) {
return;
}
let no_mangle = attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE);
// We may want to remove the namespace scope if we're in an extern block (see
// https://github.com/rust-lang/rust/pull/46457#issuecomment-351750952).

View File

@ -12,7 +12,6 @@ use crate::llvm;
use crate::llvm::debuginfo::{
DIArray, DIBuilder, DIFile, DIFlags, DILexicalBlock, DISPFlags, DIScope, DIType, DIVariable,
};
use rustc::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc::ty::subst::{GenericArgKind, SubstsRef};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE};
@ -22,7 +21,7 @@ use crate::common::CodegenCx;
use crate::value::Value;
use rustc::mir;
use rustc::session::config::{self, DebugInfo};
use rustc::ty::{self, Instance, InstanceDef, ParamEnv, Ty};
use rustc::ty::{self, Instance, ParamEnv, Ty};
use rustc_codegen_ssa::debuginfo::type_names;
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
@ -241,12 +240,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
return None;
}
if let InstanceDef::Item(def_id) = instance.def {
if self.tcx().codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::NO_DEBUG) {
return None;
}
}
let span = mir.span;
// This can be the case for functions inlined from another crate

View File

@ -736,7 +736,7 @@ fn execute_work_item<B: ExtraBackendMethods>(
}
}
// Actual LTO type we end up chosing based on multiple factors.
// Actual LTO type we end up choosing based on multiple factors.
enum ComputedLtoType {
No,
Thin,

View File

@ -203,7 +203,7 @@ impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
}
self.visit_place_base(&place_ref.local, context, location);
self.visit_projection(&place_ref.local, place_ref.projection, context, location);
self.visit_projection(place_ref.local, place_ref.projection, context, location);
}
}
}

View File

@ -8,7 +8,7 @@
//! actual codegen, while the builder stores the information about the function during codegen and
//! is used to produce the instructions of the backend IR.
//!
//! Finaly, a third `Backend` structure has to implement methods related to how codegen information
//! Finally, a third `Backend` structure has to implement methods related to how codegen information
//! is passed to the backend, especially for asynchronous compilation.
//!
//! The traits contain associated types that are backend-specific, such as the backend's value or

View File

@ -185,7 +185,7 @@ fn compute_symbol_name(
//
// * On the wasm32 targets there is a bug (or feature) in LLD [1] where the
// same-named symbol when imported from different wasm modules will get
// hooked up incorectly. As a result foreign symbols, on the wasm target,
// hooked up incorrectly. As a result foreign symbols, on the wasm target,
// with a wasm import module, get mangled. Additionally our codegen will
// deduplicate symbols based purely on the symbol name, but for wasm this
// isn't quite right because the same-named symbol on wasm can come from

View File

@ -23,7 +23,7 @@ fn num_nodes() {
}
#[test]
fn succesors() {
fn successors() {
let graph = create_graph();
assert_eq!(graph.successors(0), &[1]);
assert_eq!(graph.successors(1), &[2, 3]);

View File

@ -13,7 +13,7 @@ struct CacheAligned<T>(T);
#[cfg(parallel_compiler)]
// 32 shards is sufficient to reduce contention on an 8-core Ryzen 7 1700,
// but this should be tested on higher core count CPUs. How the `Sharded` type gets used
// may also affect the ideal nunber of shards.
// may also affect the ideal number of shards.
const SHARD_BITS: usize = 5;
#[cfg(not(parallel_compiler))]
@ -41,7 +41,7 @@ impl<T> Sharded<T> {
let mut values: SmallVec<[_; SHARDS]> =
(0..SHARDS).map(|_| CacheAligned(Lock::new(value()))).collect();
// Create an unintialized array
// Create an uninitialized array
let mut shards: mem::MaybeUninit<[CacheAligned<Lock<T>>; SHARDS]> =
mem::MaybeUninit::uninit();

View File

@ -1,4 +1,4 @@
An implementation of a trait doesn't match the type contraint.
An implementation of a trait doesn't match the type constraint.
Erroneous code example:

View File

@ -54,7 +54,7 @@ This pattern should be rewritten. There are a few possible ways to do this:
- change the original fn declaration to match the expected signature,
and do the cast in the fn body (the preferred option)
- cast the fn item fo a fn pointer before calling transmute, as shown here:
- cast the fn item of a fn pointer before calling transmute, as shown here:
```
# extern "C" fn foo(_: Box<i32>) {}

View File

@ -991,7 +991,7 @@ fn token_can_be_followed_by_any(tok: &mbe::TokenTree) -> bool {
if let mbe::TokenTree::MetaVarDecl(_, _, frag_spec) = *tok {
frag_can_be_followed_by_any(frag_spec.name)
} else {
// (Non NT's can always be followed by anthing in matchers.)
// (Non NT's can always be followed by anything in matchers.)
true
}
}

View File

@ -289,9 +289,6 @@ declare_features! (
/// Permits specifying whether a function should permit unwinding or abort on unwind.
(active, unwind_attributes, "1.4.0", Some(58760), None),
/// Allows `#[no_debug]`.
(active, no_debug, "1.5.0", Some(29721), None),
/// Allows attributes on expressions and non-item statements.
(active, stmt_expr_attributes, "1.6.0", Some(15701), None),
@ -387,7 +384,7 @@ declare_features! (
/// Allows defining `trait X = A + B;` alias items.
(active, trait_alias, "1.24.0", Some(41517), None),
/// Allows infering `'static` outlives requirements (RFC 2093).
/// Allows inferring `'static` outlives requirements (RFC 2093).
(active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
/// Allows accessing fields of unions inside `const` functions.

View File

@ -175,7 +175,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// Stable attributes:
// ==========================================================================
// Condtional compilation:
// Conditional compilation:
ungated!(cfg, Normal, template!(List: "predicate")),
ungated!(cfg_attr, Normal, template!(List: "predicate, attr1, attr2, ...")),
@ -507,16 +507,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
cfg_fn!(rustc_attrs),
),
),
(
sym::no_debug, Whitelisted, template!(Word),
Gated(
Stability::Deprecated("https://github.com/rust-lang/rust/issues/29721", None),
sym::no_debug,
"the `#[no_debug]` attribute was an experimental feature that has been \
deprecated due to lack of demand",
cfg_fn!(no_debug)
)
),
gated!(
// Used in resolve:
prelude_import, Whitelisted, template!(Word),

View File

@ -111,6 +111,8 @@ declare_features! (
/// Allows overlapping impls of marker traits.
(removed, overlapping_marker_traits, "1.42.0", Some(29864), None,
Some("removed in favor of `#![feature(marker_trait_attr)]`")),
/// Allows `#[no_debug]`.
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
// -------------------------------------------------------------------------
// feature-group-end: removed features
// -------------------------------------------------------------------------

View File

@ -1819,7 +1819,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
"{} may not live long enough",
labeled_user_string
);
// Explicitely use the name instead of `sub`'s `Display` impl. The `Display` impl
// Explicitly use the name instead of `sub`'s `Display` impl. The `Display` impl
// for the bound is not suitable for suggestions when `-Zverbose` is set because it
// uses `Debug` output, so we handle it specially here so that suggestions are
// always correct.

View File

@ -391,7 +391,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
err.span_label(pattern.span, msg);
} else if let Some(e) = local_visitor.found_method_call {
if let ExprKind::MethodCall(segment, ..) = &e.kind {
// Suggest specifiying type params or point out the return type of the call:
// Suggest specifying type params or point out the return type of the call:
//
// error[E0282]: type annotations needed
// --> $DIR/type-annotations-needed-expr.rs:2:39

View File

@ -1667,14 +1667,14 @@ impl<'a, 'tcx> ShallowResolver<'a, 'tcx> {
ty::IntVar(v) => {
// If inlined_probe_value returns a value it's always a
// `ty::Int(_)` or `ty::UInt(_)`, which nevers matches a
// `ty::Int(_)` or `ty::UInt(_)`, which never matches a
// `ty::Infer(_)`.
self.infcx.inner.borrow_mut().int_unification_table.inlined_probe_value(v).is_some()
}
ty::FloatVar(v) => {
// If inlined_probe_value returns a value it's always a
// `ty::Float(_)`, which nevers matches a `ty::Infer(_)`.
// `ty::Float(_)`, which never matches a `ty::Infer(_)`.
//
// Not `inlined_probe_value(v)` because this call site is colder.
self.infcx.inner.borrow_mut().float_unification_table.probe_value(v).is_some()

View File

@ -264,7 +264,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// ```
///
/// Here we would report a more complex "in constraint", like `'r
/// in ['a, 'b, 'static]` (where `'r` is some regon appearing in
/// in ['a, 'b, 'static]` (where `'r` is some region appearing in
/// the hidden type).
///
/// # Constrain regions, not the hidden concrete type

View File

@ -169,7 +169,7 @@ where
}
// N.B. This type is not public because the protocol around checking the
// `err` field is not enforcable otherwise.
// `err` field is not enforceable otherwise.
struct FullTypeResolver<'a, 'tcx> {
infcx: &'a InferCtxt<'a, 'tcx>,
err: Option<FixupError<'tcx>>,

View File

@ -455,7 +455,7 @@ impl AutoTraitFinder<'tcx> {
// predicate has some other kind of region. An region
// variable isn't something we can actually display to a user,
// so we choose their new predicate (which doesn't have a region
// varaible).
// variable).
//
// In both cases, we want to remove the old predicate,
// from `user_computed_preds`, and replace it with the new
@ -701,7 +701,7 @@ impl AutoTraitFinder<'tcx> {
// some subobligations. We then process these subobligations
// like any other generated sub-obligations.
//
// 3. We receieve an 'ambiguous' result (Ok(None))
// 3. We receive an 'ambiguous' result (Ok(None))
// If we were actually trying to compile a crate,
// we would need to re-process this obligation later.
// However, all we care about is finding out what bounds

View File

@ -505,7 +505,7 @@ fn ty_is_non_local_constructor<'tcx>(ty: Ty<'tcx>, in_crate: InCrate) -> Option<
//
// We choose to treat all opaque types as non-local, even
// those that appear within the same crate. This seems
// somewhat suprising at first, but makes sense when
// somewhat surprising at first, but makes sense when
// you consider that opaque types are supposed to hide
// the underlying type *within the same crate*. When an
// opaque type is used from outside the module

View File

@ -1142,7 +1142,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
// we're only talking about builtin traits, which are known to be
// inhabited. We used to check for `self.tcx.sess.has_errors()` to
// avoid inundating the user with unnecessary errors, but we now
// check upstream for type errors and dont add the obligations to
// check upstream for type errors and don't add the obligations to
// begin with in those cases.
if self
.tcx

View File

@ -612,7 +612,7 @@ fn receiver_is_dispatchable<'tcx>(
};
// the type `U` in the query
// use a bogus type parameter to mimick a forall(U) query using u32::MAX for now.
// use a bogus type parameter to mimic a forall(U) query using u32::MAX for now.
// FIXME(mikeyhew) this is a total hack. Once object_safe_for_dispatch is stabilized, we can
// replace this with `dyn Trait`
let unsized_self_ty: Ty<'tcx> =

View File

@ -17,7 +17,7 @@ pub enum EscapeError {
/// Escaped '\' character without continuation.
LoneSlash,
/// Invalid escape characted (e.g. '\z').
/// Invalid escape character (e.g. '\z').
InvalidEscape,
/// Raw '\r' encountered.
BareCarriageReturn,
@ -43,7 +43,7 @@ pub enum EscapeError {
UnclosedUnicodeEscape,
/// '\u{_12}'
LeadingUnderscoreUnicodeEscape,
/// More than 6 charactes in '\u{..}', e.g. '\u{10FFFF_FF}'
/// More than 6 characters in '\u{..}', e.g. '\u{10FFFF_FF}'
OverlongUnicodeEscape,
/// Invalid in-bound unicode character code, e.g. '\u{DFFF}'.
LoneSurrogateUnicodeEscape,

View File

@ -57,7 +57,7 @@ enum QueryModifier {
/// Generate a dep node based on the dependencies of the query
Anon,
/// Always evaluate the query, ignoring its depdendencies
/// Always evaluate the query, ignoring its dependencies
EvalAlways,
}
@ -228,7 +228,7 @@ struct QueryModifiers {
/// Generate a dep node based on the dependencies of the query
anon: bool,
// Always evaluate the query, ignoring its depdendencies
// Always evaluate the query, ignoring its dependencies
eval_always: bool,
}

View File

@ -711,7 +711,7 @@ impl<'a> CrateLocator<'a> {
// See also #68149 which provides more detail on why emitting the
// dependency on the rlib is a bad thing.
//
// We currenty do not verify that these other sources are even in sync,
// We currently do not verify that these other sources are even in sync,
// and this is arguably a bug (see #10786), but because reading metadata
// is quite slow (especially from dylibs) we currently do not read it
// from the other crate sources.

View File

@ -201,7 +201,7 @@ crate struct CrateRoot<'tcx> {
per_def: LazyPerDefTables<'tcx>,
/// The DefIndex's of any proc macros delcared by this crate.
/// The DefIndex's of any proc macros declared by this crate.
proc_macro_data: Option<Lazy<[DefIndex]>>,
compiler_builtins: bool,

View File

@ -1231,7 +1231,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
GeneratorKind::Async(async_kind) => match async_kind {
AsyncGeneratorKind::Block => "async block",
AsyncGeneratorKind::Closure => "async closure",
_ => bug!("async block/closure expected, but async funtion found."),
_ => bug!("async block/closure expected, but async function found."),
},
GeneratorKind::Gen => "generator",
},

View File

@ -445,7 +445,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
err.buffer(&mut self.errors_buffer);
}
/// Targetted error when encountering an `FnMut` closure where an `Fn` closure was expected.
/// Targeted error when encountering an `FnMut` closure where an `Fn` closure was expected.
fn expected_fn_found_fn_mut_call(&self, err: &mut DiagnosticBuilder<'_>, sp: Span, act: &str) {
err.span_label(sp, format!("cannot {}", act));

View File

@ -63,7 +63,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> {
self.mutate_place(location, lhs, Shallow(None), JustWrite);
}
StatementKind::FakeRead(_, _) => {
// Only relavent for initialized/liveness/safety checks.
// Only relevant for initialized/liveness/safety checks.
}
StatementKind::SetDiscriminant { ref place, variant_index: _ } => {
self.mutate_place(location, place, Shallow(None), JustWrite);

View File

@ -125,7 +125,7 @@ where
// wind up mapped to the same key `S`, we would append the
// linked list for `Ra` onto the end of the linked list for
// `Rb` (or vice versa) -- this basically just requires
// rewriting the final link from one list to point at the othe
// rewriting the final link from one list to point at the other
// other (see `append_list`).
let MemberConstraintSet { first_constraints, mut constraints, choice_regions } = self;

View File

@ -452,7 +452,7 @@ crate struct MirBorrowckCtxt<'cx, 'tcx> {
/// for the activation of the borrow.
reservation_warnings:
FxHashMap<BorrowIndex, (Place<'tcx>, Span, Location, BorrowKind, BorrowData<'tcx>)>,
/// This field keeps track of move errors that are to be reported for given move indicies.
/// This field keeps track of move errors that are to be reported for given move indices.
///
/// There are situations where many errors can be reported for a single move out (see #53807)
/// and we want only the best of those errors.

View File

@ -579,7 +579,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
| ConstraintCategory::UseAsConst
| ConstraintCategory::UseAsStatic = constraint.category
{
// "Returning" from a promoted is an assigment to a
// "Returning" from a promoted is an assignment to a
// temporary from the user's point of view.
constraint.category = ConstraintCategory::Boring;
}

View File

@ -226,7 +226,7 @@ pub fn const_eval_validated_provider<'tcx>(
match tcx.const_eval_validated(key) {
// try again with reveal all as requested
Err(ErrorHandled::TooGeneric) => {}
// dedupliate calls
// deduplicate calls
other => return other,
}
}
@ -267,7 +267,7 @@ pub fn const_eval_raw_provider<'tcx>(
match tcx.const_eval_raw(key) {
// try again with reveal all as requested
Err(ErrorHandled::TooGeneric) => {}
// dedupliate calls
// deduplicate calls
other => return other,
}
}

View File

@ -670,7 +670,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
);
if cur_unwinding {
// Follow the unwind edge.
let unwind = next_block.expect("Encounted StackPopCleanup::None when unwinding!");
let unwind = next_block.expect("Encountered StackPopCleanup::None when unwinding!");
self.unwind_to_block(unwind);
} else {
// Follow the normal return edge.

View File

@ -227,7 +227,7 @@ pub trait Machine<'mir, 'tcx>: Sized {
/// it contains (in relocations) tagged. The way we construct allocations is
/// to always first construct it without extra and then add the extra.
/// This keeps uniform code paths for handling both allocations created by CTFE
/// for statics, and allocations ceated by Miri during evaluation.
/// for statics, and allocations created by Miri during evaluation.
///
/// `kind` is the kind of the allocation being tagged; it can be `None` when
/// it's a static and `STATIC_KIND` is `None`.

View File

@ -678,7 +678,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
// Then computing the absolute variant idx should not overflow any more.
let variant_index = variants_start
.checked_add(variant_index_relative)
.expect("oveflow computing absolute variant idx");
.expect("overflow computing absolute variant idx");
let variants_len = rval
.layout
.ty

View File

@ -292,7 +292,7 @@ where
let all_bytes = 0..self.len();
// This 'inspect' is okay since following access respects undef and relocations. This does
// influence interpreter exeuction, but only to detect the error of cycles in evalution
// influence interpreter exeuction, but only to detect the error of cycles in evaluation
// dependencies.
let bytes = self.inspect_with_undef_and_ptr_outside_interpreter(all_bytes);

View File

@ -20,7 +20,7 @@ fn is_stable(place: PlaceRef<'_, '_>) -> bool {
// Which place this evaluates to can change with any memory write,
// so cannot assume this to be stable.
ProjectionElem::Deref => false,
// Array indices are intersting, but MIR building generates a *fresh*
// Array indices are interesting, but MIR building generates a *fresh*
// temporary for every array access, so the index cannot be changed as
// a side-effect.
ProjectionElem::Index { .. } |

View File

@ -276,7 +276,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
}
};
self.visit_place_base(&place.local, ctx, location);
self.visit_projection(&place.local, reborrowed_proj, ctx, location);
self.visit_projection(place.local, reborrowed_proj, ctx, location);
return;
}
}
@ -289,7 +289,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
Mutability::Mut => PlaceContext::MutatingUse(MutatingUseContext::AddressOf),
};
self.visit_place_base(&place.local, ctx, location);
self.visit_projection(&place.local, reborrowed_proj, ctx, location);
self.visit_projection(place.local, reborrowed_proj, ctx, location);
return;
}
}
@ -408,7 +408,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
}
fn visit_projection_elem(
&mut self,
place_local: &Local,
place_local: Local,
proj_base: &[PlaceElem<'tcx>],
elem: &PlaceElem<'tcx>,
context: PlaceContext,
@ -428,11 +428,11 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
match elem {
ProjectionElem::Deref => {
let base_ty = Place::ty_from(*place_local, proj_base, *self.body, self.tcx).ty;
let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
if let ty::RawPtr(_) = base_ty.kind {
if proj_base.is_empty() {
if let (local, []) = (place_local, proj_base) {
let decl = &self.body.local_decls[*local];
let decl = &self.body.local_decls[local];
if let LocalInfo::StaticRef { def_id, .. } = decl.local_info {
let span = decl.source_info.span;
self.check_static(def_id, span);
@ -452,7 +452,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
| ProjectionElem::Subslice { .. }
| ProjectionElem::Field(..)
| ProjectionElem::Index(_) => {
let base_ty = Place::ty_from(*place_local, proj_base, *self.body, self.tcx).ty;
let base_ty = Place::ty_from(place_local, proj_base, *self.body, self.tcx).ty;
match base_ty.ty_adt_def() {
Some(def) if def.is_union() => {
self.check_op(ops::UnionAccess);

View File

@ -664,7 +664,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
return;
}
// FIXME> figure out what tho do when try_read_immediate fails
// FIXME> figure out what to do when try_read_immediate fails
let imm = self.use_ecx(|this| this.ecx.try_read_immediate(value));
if let Some(Ok(imm)) = imm {

View File

@ -731,7 +731,7 @@ where
self.elaborator.patch().new_block(base_block)
}
/// Ceates a pair of drop-loops of `place`, which drops its contents, even
/// Creates a pair of drop-loops of `place`, which drops its contents, even
/// in the case of 1 panic. If `ptr_based`, creates a pointer loop,
/// otherwise create an index loop.
fn drop_loop_pair(

View File

@ -490,7 +490,7 @@ fn write_scope_tree(
}
let children = match scope_tree.get(&parent) {
Some(childs) => childs,
Some(children) => children,
None => return Ok(()),
};

View File

@ -837,7 +837,7 @@ impl<'tcx> Constructor<'tcx> {
// eliminate it straight away.
remaining_ranges = vec![];
} else {
// Otherwise explicitely compute the remaining ranges.
// Otherwise explicitly compute the remaining ranges.
remaining_ranges = other_range.subtract_from(remaining_ranges);
}

View File

@ -257,7 +257,7 @@ impl<'a> StripUnconfigured<'a> {
/// Parse and expand all `cfg_attr` attributes into a list of attributes
/// that are within each `cfg_attr` that has a true configuration predicate.
///
/// Gives compiler warnigns if any `cfg_attr` does not contain any
/// Gives compiler warnings if any `cfg_attr` does not contain any
/// attributes and is in the original source code. Gives compiler errors if
/// the syntax of any `cfg_attr` is incorrect.
pub fn process_cfg_attrs<T: HasAttrs>(&mut self, node: &mut T) {

View File

@ -40,6 +40,7 @@ struct TokenTreesReader<'a> {
/// Used only for error recovery when arriving to EOF with mismatched braces.
matching_delim_spans: Vec<(token::DelimToken, Span, Span)>,
last_unclosed_found_span: Option<Span>,
/// Collect empty block spans that might have been auto-inserted by editors.
last_delim_empty_block_spans: FxHashMap<token::DelimToken, Span>,
}
@ -138,7 +139,11 @@ impl<'a> TokenTreesReader<'a> {
if tts.is_empty() {
let empty_block_span = open_brace_span.to(close_brace_span);
self.last_delim_empty_block_spans.insert(delim, empty_block_span);
if !sm.is_multiline(empty_block_span) {
// Only track if the block is in the form of `{}`, otherwise it is
// likely that it was written on purpose.
self.last_delim_empty_block_spans.insert(delim, empty_block_span);
}
}
if self.open_braces.is_empty() {

View File

@ -138,7 +138,7 @@ impl<'a> Parser<'a> {
if let Some(prev_attr_sp) = prev_attr_sp {
diagnostic
.span_label(attr_sp, "not permitted following an outer attibute")
.span_label(attr_sp, "not permitted following an outer attribute")
.span_label(prev_attr_sp, prev_attr_note);
}

View File

@ -895,7 +895,7 @@ impl<'a> Parser<'a> {
let msg = format!("expected `;`, found `{}`", super::token_descr(&self.token));
let appl = Applicability::MachineApplicable;
if self.token.span == DUMMY_SP || self.prev_token.span == DUMMY_SP {
// Likely inside a macro, can't provide meaninful suggestions.
// Likely inside a macro, can't provide meaningful suggestions.
return self.expect(&token::Semi).map(drop);
} else if !sm.is_multiline(self.prev_token.span.until(self.token.span)) {
// The current token is in the same line as the prior token, not recoverable.

View File

@ -1426,7 +1426,7 @@ impl<'a> Parser<'a> {
))
}
/// Parses an optional `move` prefix to a closure lke construct.
/// Parses an optional `move` prefix to a closure-like construct.
fn parse_capture_clause(&mut self) -> CaptureBy {
if self.eat_keyword(kw::Move) { CaptureBy::Value } else { CaptureBy::Ref }
}

View File

@ -285,7 +285,7 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
// Ordinarily, we can rely on the visit order of HIR intravisit
// to correspond to the actual execution order of statements.
// However, there's a weird corner case with compund assignment
// However, there's a weird corner case with compound assignment
// operators (e.g. `a += b`). The evaluation order depends on whether
// or not the operator is overloaded (e.g. whether or not a trait
// like AddAssign is implemented).

View File

@ -655,7 +655,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
}
// FIXME(#44232): the `used_features` table no longer exists, so we
// don't lint about unused features. We should reenable this one day!
// don't lint about unused features. We should re-enable this one day!
}
fn unnecessary_stable_feature_lint(tcx: TyCtxt<'_>, span: Span, feature: Symbol, since: Symbol) {

View File

@ -249,8 +249,7 @@ impl<'a> Resolver<'a> {
self.session,
span,
E0409,
"variable `{}` is bound in inconsistent \
ways within the same match arm",
"variable `{}` is bound inconsistently across alternatives separated by `|`",
variable_name
);
err.span_label(span, "bound in different ways");
@ -1090,7 +1089,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
}
// Sort extern crate names in reverse order to get
// 1) some consistent ordering for emitted dignostics, and
// 1) some consistent ordering for emitted diagnostics, and
// 2) `std` suggestions before `core` suggestions.
let mut extern_crate_names =
self.r.extern_prelude.iter().map(|(ident, _)| ident.name).collect::<Vec<_>>();

View File

@ -1075,7 +1075,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
// single import (see test `issue-55884-2.rs`). In theory single imports should
// always block globs, even if they are not yet resolved, so that this kind of
// self-inconsistent resolution never happens.
// Reenable the assert when the issue is fixed.
// Re-enable the assert when the issue is fixed.
// assert!(result[ns].get().is_err());
}
}

View File

@ -553,7 +553,7 @@ impl<'a, 'ast> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast> {
let prev = replace(&mut self.diagnostic_metadata.currently_processing_generics, true);
match arg {
GenericArg::Type(ref ty) => {
// We parse const arguments as path types as we cannot distiguish them during
// We parse const arguments as path types as we cannot distinguish them during
// parsing. We try to resolve that ambiguity by attempting resolution the type
// namespace first, and if that fails we try again in the value namespace. If
// resolution in the value namespace succeeds, we have an generic const argument on

View File

@ -540,7 +540,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
LifetimeName::Implicit => {
// For types like `dyn Foo`, we should
// generate a special form of elided.
span_bug!(ty.span, "object-lifetime-default expected, not implict",);
span_bug!(ty.span, "object-lifetime-default expected, not implicit",);
}
LifetimeName::ImplicitObjectLifetimeDefault => {
// If the user does not write *anything*, we

View File

@ -365,11 +365,11 @@ impl<'a, Ty> TyLayout<'a, Ty> {
//
// NB: for all tagged `enum`s (which include all non-C-like
// `enum`s with defined FFI representation), this will
// match the homogenous computation on the equivalent
// match the homogeneous computation on the equivalent
// `struct { tag; union { variant1; ... } }` and/or
// `union { struct { tag; variant1; } ... }`
// (the offsets of variant fields should be identical
// between the two for either to be a homogenous aggregate).
// between the two for either to be a homogeneous aggregate).
let variant_start = total;
for variant_idx in variants.indices() {
let (variant_result, variant_total) =
@ -542,7 +542,7 @@ pub struct FnAbi<'a, Ty> {
/// The count of non-variadic arguments.
///
/// Should only be different from args.len() when c_variadic is true.
/// This can be used to know wether an argument is variadic or not.
/// This can be used to know whether an argument is variadic or not.
pub fixed_count: usize,
pub conv: Conv,

View File

@ -401,7 +401,7 @@ impl Align {
}
}
/// A pair of aligments, ABI-mandated and preferred.
/// A pair of alignments, ABI-mandated and preferred.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
#[derive(HashStable_Generic)]
pub struct AbiAndPrefAlign {

View File

@ -29,7 +29,7 @@ pub fn target() -> TargetResult {
base.abi_return_struct_as_int = true;
// Use -GNU here, because of the reason below:
// Backgound and Problem:
// Background and Problem:
// If we use i686-unknown-windows, the LLVM IA32 MSVC generates compiler intrinsic
// _alldiv, _aulldiv, _allrem, _aullrem, _allmul, which will cause undefined symbol.
// A real issue is __aulldiv() is referred by __udivdi3() - udivmod_inner!(), from
@ -64,7 +64,7 @@ pub fn target() -> TargetResult {
// i386/umoddi3.S
// Possible solution:
// 1. Eliminate Intrinsics generation.
// 1.1 Choose differnt target to bypass isTargetKnownWindowsMSVC().
// 1.1 Choose different target to bypass isTargetKnownWindowsMSVC().
// 1.2 Remove the "Setup Windows compiler runtime calls" in LLVM
// 2. Implement Intrinsics.
// We evaluated all options.

View File

@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
// The linker can be installed from `crates.io`.
linker: Some("rust-ptx-linker".to_string()),
// With `ptx-linker` approach, it can be later overriden via link flags.
// With `ptx-linker` approach, it can be later overridden via link flags.
cpu: "sm_30".to_string(),
// FIXME: create tests for the atomics.
@ -43,7 +43,7 @@ pub fn target() -> TargetResult {
// Let the `ptx-linker` to handle LLVM lowering into MC / assembly.
obj_is_bitcode: true,
// Convinient and predicable naming scheme.
// Convenient and predicable naming scheme.
dll_prefix: "".to_string(),
dll_suffix: ".ptx".to_string(),
exe_suffix: ".ptx".to_string(),

View File

@ -661,7 +661,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.
/// Also returns back constriants on associated types.
/// Also returns back constraints on associated types.
///
/// Example:
///
@ -2924,7 +2924,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let tcx = self.tcx();
// We proactively collect all the infered type params to emit a single error per fn def.
// We proactively collect all the inferred type params to emit a single error per fn def.
let mut visitor = PlaceholderHirTyCollector::default();
for ty in decl.inputs {
visitor.visit_ty(ty);

View File

@ -1040,7 +1040,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
return r;
}
debug!("pick: actual search failed, assemble diagnotics");
debug!("pick: actual search failed, assemble diagnostics");
let static_candidates = mem::take(&mut self.static_candidates);
let private_candidate = self.private_candidate.take();

Some files were not shown because too many files have changed in this diff Show More