Skip to content

Commit

Permalink
Auto merge of #66824 - tmandry:rollup-kk56bte, r=tmandry
Browse files Browse the repository at this point in the history
Rollup of 17 pull requests

Successful merges:

 - #64325 (Stabilize nested self receivers in 1.41.0)
 - #66222 (Use `eq_opaque_type_and_type` when type-checking closure signatures)
 - #66305 (Add by-value arrays to `improper_ctypes` lint)
 - #66399 (rustc_metadata: simplify the interactions between Lazy and Table.)
 - #66534 (Allow global references via ForeignItem and Item for the same symbol name during LLVM codegen)
 - #66700 (Fix pointing at arg for fulfillment errors in function calls)
 - #66704 (Intra doc enum variant field)
 - #66718 (Refactor `parse_enum_item` to use `parse_delim_comma_seq`)
 - #66722 (Handle non_exhaustive in borrow checking)
 - #66744 (Fix shrink_to panic documentation)
 - #66761 (Use LLVMDisposePassManager instead of raw delete in rustllvm)
 - #66769 (Add core::{f32,f64}::consts::TAU.)
 - #66774 (Clean up error codes)
 - #66777 (Put back tidy check on error codes)
 - #66797 (Fixes small typo in array docs r? @steveklabnik)
 - #66798 (Fix spelling typos)
 - #66800 (Combine similar tests for const match)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Nov 27, 2019
2 parents e87a205 + a40494b commit 6b604a9
Show file tree
Hide file tree
Showing 144 changed files with 930 additions and 739 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl Step for Std {
}
}

/// Copies third pary objects needed by various targets.
/// Copies third party objects needed by various targets.
fn copy_third_party_objects(builder: &Builder<'_>, compiler: &Compiler, target: Interned<String>)
-> Vec<PathBuf>
{
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/collections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Immut<'a>, K, V, Type> {
// (We might be one-past-the-end, but that is allowed by LLVM.)
// Getting the pointer is tricky though. `NodeHeader` does not have a `keys`
// field because we want its size to not depend on the alignment of `K`
// (needed becuase `as_header` should be safe). We cannot call `as_leaf`
// (needed because `as_header` should be safe). We cannot call `as_leaf`
// because we might be the shared root.
// For this reason, `NodeHeader` has this `K2` parameter (that's usually `()`
// and hence just adds a size-0-align-1 field, not affecting layout).
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/tests/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ fn drain_filter_consumed_panic() {
};
let drain = data.drain_filter(filter);

// NOTE: The DrainFilter is explictly consumed
// NOTE: The DrainFilter is explicitly consumed
drain.for_each(drop);
});

Expand Down
4 changes: 3 additions & 1 deletion src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,8 @@ impl<T> Vec<T> {
/// The capacity will remain at least as large as both the length
/// and the supplied value.
///
/// # Panics
///
/// Panics if the current capacity is smaller than the supplied
/// minimum capacity.
///
Expand Down Expand Up @@ -2837,7 +2839,7 @@ pub struct DrainFilter<'a, T, F>
old_len: usize,
/// The filter test predicate.
pred: F,
/// A flag that indicates a panic has occured in the filter test prodicate.
/// 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
/// of the remainder of the `DrainFilter`. Any unprocessed items will be
/// backshifted in the `vec`, but no further items will be dropped or
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/array/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Implementations of things like `Eq` for fixed-length arrays
//! up to a certain length. Eventually we should able to generalize
//! up to a certain length. Eventually, we should be able to generalize
//! to all lengths.
//!
//! *[See also the array primitive type](../../std/primitive.array.html).*
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub fn spin_loop() {
pub fn black_box<T>(dummy: T) -> T {
// We need to "use" the argument in some way LLVM can't introspect, and on
// targets that support it we can typically leverage inline assembly to do
// this. LLVM's intepretation of inline assembly is that it's, well, a black
// this. LLVM's interpretation of inline assembly is that it's, well, a black
// box. This isn't the greatest implementation since it probably deoptimizes
// more than we want, but it's so far good enough.
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ extern "rust-intrinsic" {
/// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
pub fn unchecked_add<T>(x: T, y: T) -> T;

/// Returns the result of an unchecked substraction, resulting in
/// Returns the result of an unchecked subtraction, resulting in
/// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`.
pub fn unchecked_sub<T>(x: T, y: T) -> T;

Expand Down
6 changes: 6 additions & 0 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ pub mod consts {
#[stable(feature = "rust1", since = "1.0.0")]
pub const PI: f32 = 3.14159265358979323846264338327950288_f32;

/// The full circle constant (τ)
///
/// Equal to 2π.
#[unstable(feature = "tau_constant", issue = "66770")]
pub const TAU: f32 = 6.28318530717958647692528676655900577_f32;

/// π/2
#[stable(feature = "rust1", since = "1.0.0")]
pub const FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;
Expand Down
6 changes: 6 additions & 0 deletions src/libcore/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ pub mod consts {
#[stable(feature = "rust1", since = "1.0.0")]
pub const PI: f64 = 3.14159265358979323846264338327950288_f64;

/// The full circle constant (τ)
///
/// Equal to 2π.
#[unstable(feature = "tau_constant", issue = "66770")]
pub const TAU: f64 = 6.28318530717958647692528676655900577_f64;

/// π/2
#[stable(feature = "rust1", since = "1.0.0")]
pub const FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;
Expand Down
2 changes: 1 addition & 1 deletion src/libpanic_unwind/dwarf/eh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>, foreign_e
fn interpret_cs_action(cs_action: u64, lpad: usize, foreign_exception: bool) -> EHAction {
if cs_action == 0 {
// If cs_action is 0 then this is a cleanup (Drop::drop). We run these
// for both Rust panics and foriegn exceptions.
// for both Rust panics and foreign exceptions.
EHAction::Cleanup(lpad)
} else if foreign_exception {
// catch_unwind should not catch foreign exceptions, only Rust panics.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/interpret/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'
}

/// Packages the kind of error we got from the const code interpreter
/// up with a Rust-level backtrace of where the error occured.
/// up with a Rust-level backtrace of where the error occurred.
/// Thsese should always be constructed by calling `.into()` on
/// a `InterpError`. In `librustc_mir::interpret`, we have `throw_err_*`
/// macros for this.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ impl<T: Decodable> rustc_serialize::UseSpecializedDecodable for ClearCrossCrate<
/// Grouped information about the source code origin of a MIR entity.
/// Intended to be inspected by diagnostics and debuginfo.
/// Most passes can work with it as a whole, within a single function.
// The unoffical Cranelift backend, at least as of #65828, needs `SourceInfo` to implement `Eq` and
// The unofficial Cranelift backend, at least as of #65828, needs `SourceInfo` to implement `Eq` and
// `Hash`. Please ping @bjorn3 if removing them.
#[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable, Hash, HashStable)]
pub struct SourceInfo {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl AutoTraitFinder<'tcx> {
// The old predicate has a region variable where the new
// predicate has some other kind of region. An region
// variable isn't something we can actually display to a user,
// so we choose ther new predicate (which doesn't have a region
// so we choose their new predicate (which doesn't have a region
// varaible).
//
// In both cases, we want to remove the old predicate,
Expand Down Expand Up @@ -703,7 +703,7 @@ impl AutoTraitFinder<'tcx> {
// that we could add to our ParamEnv that would 'fix' this kind
// of error, as it's not caused by an unimplemented type.
//
// 2. We succesfully project the predicate (Ok(Some(_))), generating
// 2. We successfully project the predicate (Ok(Some(_))), generating
// some subobligations. We then process these subobligations
// like any other generated sub-obligations.
//
Expand Down Expand Up @@ -770,7 +770,7 @@ impl AutoTraitFinder<'tcx> {
Ok(None) => {
// It's ok not to make progress when hvave no inference variables -
// in that case, we were only performing unifcation to check if an
// error occured (which would indicate that it's impossible for our
// error occurred (which would indicate that it's impossible for our
// type to implement the auto trait).
// However, we should always make progress (either by generating
// subobligations or getting an error) when we started off with
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
body_id: Option<hir::BodyId>,
fallback_has_occurred: bool,
) {
debug!("report_fulfillment_errors({:?})", error);
debug!("report_fulfillment_error({:?})", error);
match error.code {
FulfillmentErrorCode::CodeSelectionError(ref selection_error) => {
self.report_selection_error(
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl<'tcx> TyS<'tcx> {
}
}

/// Whether the type is succinctly representable as a type instead of just refered to with a
/// Whether the type is succinctly representable as a type instead of just referred to with a
/// description in error messages. This is used in the main error message.
pub fn is_simple_ty(&self) -> bool {
match self.kind {
Expand All @@ -28,7 +28,7 @@ impl<'tcx> TyS<'tcx> {
}
}

/// Whether the type is succinctly representable as a type instead of just refered to with a
/// Whether the type is succinctly representable as a type instead of just referred to with a
/// description in error messages. This is used in the primary span label. Beyond what
/// `is_simple_ty` includes, it also accepts ADTs with no type arguments and references to
/// ADTs with no type arguments.
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ thread_local! {
}

/// Avoids running any queries during any prints that occur
/// during the closure. This may alter the apperance of some
/// during the closure. This may alter the appearance of some
/// types (e.g. forcing verbose printing for opaque types).
/// This method is used during some queries (e.g. `predicates_of`
/// for opaque types), to ensure that any debug printing that
Expand Down
8 changes: 5 additions & 3 deletions src/librustc_codegen_llvm/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,13 @@ impl CodegenCx<'ll, 'tcx> {
ref attrs, span, kind: hir::ItemKind::Static(..), ..
}) => {
let sym_str = sym.as_str();
if self.get_declared_value(&sym_str).is_some() {
span_bug!(span, "Conflicting symbol names for static?");
if let Some(g) = self.get_declared_value(&sym_str) {
if self.val_ty(g) != self.type_ptr_to(llty) {
span_bug!(span, "Conflicting types for static");
}
}

let g = self.define_global(&sym_str, llty).unwrap();
let g = self.declare_global(&sym_str, llty);

if !self.tcx.is_reachable_non_generic(def_id) {
unsafe {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/stable_hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl Hasher for StableHasher {
///
/// That second condition is usually not required for hash functions
/// (e.g. `Hash`). In practice this means that `hash_stable` must feed any
/// information into the hasher that a `PartialEq` comparision takes into
/// information into the hasher that a `PartialEq` comparison takes into
/// account. See [#49300](https://github.com/rust-lang/rust/issues/49300)
/// for an example where violating this invariant has caused trouble in the
/// past.
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_error_codes/error_codes/E0015.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
A constant item was initialized with something that is not a constant expression.
A constant item was initialized with something that is not a constant
expression.

Erroneous code example:

Expand Down
8 changes: 4 additions & 4 deletions src/librustc_error_codes/error_codes/E0071.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
You tried to use structure-literal syntax to create an item that is
not a structure or enum variant.
A structure-literal syntax was used to create an item that is not a structure
or enum variant.

Example of erroneous code:

Expand All @@ -9,8 +9,8 @@ let t = U32 { value: 4 }; // error: expected struct, variant or union type,
// found builtin type `u32`
```

To fix this, ensure that the name was correctly spelled, and that
the correct form of initializer was used.
To fix this, ensure that the name was correctly spelled, and that the correct
form of initializer was used.

For example, the code above can be fixed to:

Expand Down
21 changes: 12 additions & 9 deletions src/librustc_error_codes/error_codes/E0072.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
When defining a recursive struct or enum, any use of the type being defined
from inside the definition must occur behind a pointer (like `Box` or `&`).
This is because structs and enums must have a well-defined size, and without
the pointer, the size of the type would need to be unbounded.
A recursive type has infinite size because it doesn't have an indirection.

Consider the following erroneous definition of a type for a list of bytes:
Erroneous code example:

```compile_fail,E0072
// error, invalid recursive struct type
struct ListNode {
head: u8,
tail: Option<ListNode>,
tail: Option<ListNode>, // error: no indirection here so impossible to
// compute the type's size
}
```

This type cannot have a well-defined size, because it needs to be arbitrarily
large (since we would be able to nest `ListNode`s to any depth). Specifically,
When defining a recursive struct or enum, any use of the type being defined
from inside the definition must occur behind a pointer (like `Box`, `&` or
`Rc`). This is because structs and enums must have a well-defined size, and
without the pointer, the size of the type would need to be unbounded.

In the example, the type cannot have a well-defined size, because it needs to be
arbitrarily large (since we would be able to nest `ListNode`s to any depth).
Specifically,

```plain
size of `ListNode` = 1 byte for `head`
Expand Down
16 changes: 9 additions & 7 deletions src/librustc_error_codes/error_codes/E0075.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
The `#[simd]` attribute can only be applied to non empty tuple structs, because
it doesn't make sense to try to use SIMD operations when there are no values to
operate on.
A `#[simd]` attribute was applied to an empty tuple struct.

This will cause an error:
Erroneous code example:

```compile_fail,E0075
#![feature(repr_simd)]
#[repr(simd)]
struct Bad;
struct Bad; // error!
```

This will not:
The `#[simd]` attribute can only be applied to non empty tuple structs, because
it doesn't make sense to try to use SIMD operations when there are no values to
operate on.

Fixed example:

```
#![feature(repr_simd)]
#[repr(simd)]
struct Good(u32);
struct Good(u32); // ok!
```
17 changes: 10 additions & 7 deletions src/librustc_error_codes/error_codes/E0076.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
When using the `#[simd]` attribute to automatically use SIMD operations in tuple
struct, the types in the struct must all be of the same type, or the compiler
will trigger this error.
All types in a tuple struct aren't the same when using the `#[simd]`
attribute.

This will cause an error:
Erroneous code example:

```compile_fail,E0076
#![feature(repr_simd)]
#[repr(simd)]
struct Bad(u16, u32, u32);
struct Bad(u16, u32, u32); // error!
```

This will not:
When using the `#[simd]` attribute to automatically use SIMD operations in tuple
struct, the types in the struct must all be of the same type, or the compiler
will trigger this error.

Fixed example:

```
#![feature(repr_simd)]
#[repr(simd)]
struct Good(u32, u32, u32);
struct Good(u32, u32, u32); // ok!
```
15 changes: 9 additions & 6 deletions src/librustc_error_codes/error_codes/E0077.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
When using the `#[simd]` attribute on a tuple struct, the elements in the tuple
must be machine types so SIMD operations can be applied to them.
A tuple struct's element isn't a machine type when using the `#[simd]`
attribute.

This will cause an error:
Erroneous code example:

```compile_fail,E0077
#![feature(repr_simd)]
#[repr(simd)]
struct Bad(String);
struct Bad(String); // error!
```

This will not:
When using the `#[simd]` attribute on a tuple struct, the elements in the tuple
must be machine types so SIMD operations can be applied to them.

Fixed example:

```
#![feature(repr_simd)]
#[repr(simd)]
struct Good(u32, u32, u32);
struct Good(u32, u32, u32); // ok!
```
1 change: 0 additions & 1 deletion src/librustc_error_codes/error_codes/E0107.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ fn main() {
// expected 0, found 1
}
```

2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes/E0307.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This error indicates that the `self` parameter in a method has an invalid
"reciever type".
"receiver type".

Methods take a special first parameter, of which there are three variants:
`self`, `&self`, and `&mut self`. These are syntactic sugar for
Expand Down
1 change: 0 additions & 1 deletion src/librustc_error_codes/error_codes/E0369.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ left and may require reallocation. This requires ownership of the string
on the left. If something should be added to a string literal, move the
literal to the heap by allocating it with `to_owned()` like in
`"Your text".to_owned()`.

1 change: 0 additions & 1 deletion src/librustc_error_codes/error_codes/E0404.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ trait Foo {
fn bar<T: Foo>(t: T) {} // ok!
```

1 change: 0 additions & 1 deletion src/librustc_error_codes/error_codes/E0458.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ Please specify a valid "kind" value, from one of the following:
* static
* dylib
* framework

1 change: 0 additions & 1 deletion src/librustc_error_codes/error_codes/E0633.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ The `#[unwind]` attribute should be used as follows:

NB. The default behavior here is "allowed", but this is unspecified
and likely to change in the future.

Loading

0 comments on commit 6b604a9

Please sign in to comment.