Skip to content

Commit 6b604a9

Browse files
committed
Auto merge of #66824 - tmandry:rollup-kk56bte, r=tmandry
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
2 parents e87a205 + a40494b commit 6b604a9

File tree

144 files changed

+930
-739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+930
-739
lines changed

src/bootstrap/compile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Step for Std {
113113
}
114114
}
115115

116-
/// Copies third pary objects needed by various targets.
116+
/// Copies third party objects needed by various targets.
117117
fn copy_third_party_objects(builder: &Builder<'_>, compiler: &Compiler, target: Interned<String>)
118118
-> Vec<PathBuf>
119119
{

src/liballoc/collections/btree/node.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Immut<'a>, K, V, Type> {
596596
// (We might be one-past-the-end, but that is allowed by LLVM.)
597597
// Getting the pointer is tricky though. `NodeHeader` does not have a `keys`
598598
// field because we want its size to not depend on the alignment of `K`
599-
// (needed becuase `as_header` should be safe). We cannot call `as_leaf`
599+
// (needed because `as_header` should be safe). We cannot call `as_leaf`
600600
// because we might be the shared root.
601601
// For this reason, `NodeHeader` has this `K2` parameter (that's usually `()`
602602
// and hence just adds a size-0-align-1 field, not affecting layout).

src/liballoc/tests/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ fn drain_filter_consumed_panic() {
985985
};
986986
let drain = data.drain_filter(filter);
987987

988-
// NOTE: The DrainFilter is explictly consumed
988+
// NOTE: The DrainFilter is explicitly consumed
989989
drain.for_each(drop);
990990
});
991991

src/liballoc/vec.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,8 @@ impl<T> Vec<T> {
629629
/// The capacity will remain at least as large as both the length
630630
/// and the supplied value.
631631
///
632+
/// # Panics
633+
///
632634
/// Panics if the current capacity is smaller than the supplied
633635
/// minimum capacity.
634636
///
@@ -2837,7 +2839,7 @@ pub struct DrainFilter<'a, T, F>
28372839
old_len: usize,
28382840
/// The filter test predicate.
28392841
pred: F,
2840-
/// A flag that indicates a panic has occured in the filter test prodicate.
2842+
/// A flag that indicates a panic has occurred in the filter test prodicate.
28412843
/// This is used as a hint in the drop implmentation to prevent consumption
28422844
/// of the remainder of the `DrainFilter`. Any unprocessed items will be
28432845
/// backshifted in the `vec`, but no further items will be dropped or

src/libcore/array/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Implementations of things like `Eq` for fixed-length arrays
2-
//! up to a certain length. Eventually we should able to generalize
2+
//! up to a certain length. Eventually, we should be able to generalize
33
//! to all lengths.
44
//!
55
//! *[See also the array primitive type](../../std/primitive.array.html).*

src/libcore/hint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn spin_loop() {
113113
pub fn black_box<T>(dummy: T) -> T {
114114
// We need to "use" the argument in some way LLVM can't introspect, and on
115115
// targets that support it we can typically leverage inline assembly to do
116-
// this. LLVM's intepretation of inline assembly is that it's, well, a black
116+
// this. LLVM's interpretation of inline assembly is that it's, well, a black
117117
// box. This isn't the greatest implementation since it probably deoptimizes
118118
// more than we want, but it's so far good enough.
119119
unsafe {

src/libcore/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ extern "rust-intrinsic" {
12791279
/// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
12801280
pub fn unchecked_add<T>(x: T, y: T) -> T;
12811281

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

src/libcore/num/f32.rs

+6
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ pub mod consts {
7575
#[stable(feature = "rust1", since = "1.0.0")]
7676
pub const PI: f32 = 3.14159265358979323846264338327950288_f32;
7777

78+
/// The full circle constant (τ)
79+
///
80+
/// Equal to 2π.
81+
#[unstable(feature = "tau_constant", issue = "66770")]
82+
pub const TAU: f32 = 6.28318530717958647692528676655900577_f32;
83+
7884
/// π/2
7985
#[stable(feature = "rust1", since = "1.0.0")]
8086
pub const FRAC_PI_2: f32 = 1.57079632679489661923132169163975144_f32;

src/libcore/num/f64.rs

+6
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ pub mod consts {
7575
#[stable(feature = "rust1", since = "1.0.0")]
7676
pub const PI: f64 = 3.14159265358979323846264338327950288_f64;
7777

78+
/// The full circle constant (τ)
79+
///
80+
/// Equal to 2π.
81+
#[unstable(feature = "tau_constant", issue = "66770")]
82+
pub const TAU: f64 = 6.28318530717958647692528676655900577_f64;
83+
7884
/// π/2
7985
#[stable(feature = "rust1", since = "1.0.0")]
8086
pub const FRAC_PI_2: f64 = 1.57079632679489661923132169163975144_f64;

src/libpanic_unwind/dwarf/eh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>, foreign_e
130130
fn interpret_cs_action(cs_action: u64, lpad: usize, foreign_exception: bool) -> EHAction {
131131
if cs_action == 0 {
132132
// If cs_action is 0 then this is a cleanup (Drop::drop). We run these
133-
// for both Rust panics and foriegn exceptions.
133+
// for both Rust panics and foreign exceptions.
134134
EHAction::Cleanup(lpad)
135135
} else if foreign_exception {
136136
// catch_unwind should not catch foreign exceptions, only Rust panics.

src/librustc/mir/interpret/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'
185185
}
186186

187187
/// Packages the kind of error we got from the const code interpreter
188-
/// up with a Rust-level backtrace of where the error occured.
188+
/// up with a Rust-level backtrace of where the error occurred.
189189
/// Thsese should always be constructed by calling `.into()` on
190190
/// a `InterpError`. In `librustc_mir::interpret`, we have `throw_err_*`
191191
/// macros for this.

src/librustc/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ impl<T: Decodable> rustc_serialize::UseSpecializedDecodable for ClearCrossCrate<
443443
/// Grouped information about the source code origin of a MIR entity.
444444
/// Intended to be inspected by diagnostics and debuginfo.
445445
/// Most passes can work with it as a whole, within a single function.
446-
// The unoffical Cranelift backend, at least as of #65828, needs `SourceInfo` to implement `Eq` and
446+
// The unofficial Cranelift backend, at least as of #65828, needs `SourceInfo` to implement `Eq` and
447447
// `Hash`. Please ping @bjorn3 if removing them.
448448
#[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable, Hash, HashStable)]
449449
pub struct SourceInfo {

src/librustc/traits/auto_trait.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ impl AutoTraitFinder<'tcx> {
461461
// The old predicate has a region variable where the new
462462
// predicate has some other kind of region. An region
463463
// variable isn't something we can actually display to a user,
464-
// so we choose ther new predicate (which doesn't have a region
464+
// so we choose their new predicate (which doesn't have a region
465465
// varaible).
466466
//
467467
// In both cases, we want to remove the old predicate,
@@ -703,7 +703,7 @@ impl AutoTraitFinder<'tcx> {
703703
// that we could add to our ParamEnv that would 'fix' this kind
704704
// of error, as it's not caused by an unimplemented type.
705705
//
706-
// 2. We succesfully project the predicate (Ok(Some(_))), generating
706+
// 2. We successfully project the predicate (Ok(Some(_))), generating
707707
// some subobligations. We then process these subobligations
708708
// like any other generated sub-obligations.
709709
//
@@ -770,7 +770,7 @@ impl AutoTraitFinder<'tcx> {
770770
Ok(None) => {
771771
// It's ok not to make progress when hvave no inference variables -
772772
// in that case, we were only performing unifcation to check if an
773-
// error occured (which would indicate that it's impossible for our
773+
// error occurred (which would indicate that it's impossible for our
774774
// type to implement the auto trait).
775775
// However, we should always make progress (either by generating
776776
// subobligations or getting an error) when we started off with

src/librustc/traits/error_reporting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
166166
body_id: Option<hir::BodyId>,
167167
fallback_has_occurred: bool,
168168
) {
169-
debug!("report_fulfillment_errors({:?})", error);
169+
debug!("report_fulfillment_error({:?})", error);
170170
match error.code {
171171
FulfillmentErrorCode::CodeSelectionError(ref selection_error) => {
172172
self.report_selection_error(

src/librustc/ty/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl<'tcx> TyS<'tcx> {
1515
}
1616
}
1717

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

31-
/// Whether the type is succinctly representable as a type instead of just refered to with a
31+
/// Whether the type is succinctly representable as a type instead of just referred to with a
3232
/// description in error messages. This is used in the primary span label. Beyond what
3333
/// `is_simple_ty` includes, it also accepts ADTs with no type arguments and references to
3434
/// ADTs with no type arguments.

src/librustc/ty/print/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ thread_local! {
5454
}
5555

5656
/// Avoids running any queries during any prints that occur
57-
/// during the closure. This may alter the apperance of some
57+
/// during the closure. This may alter the appearance of some
5858
/// types (e.g. forcing verbose printing for opaque types).
5959
/// This method is used during some queries (e.g. `predicates_of`
6060
/// for opaque types), to ensure that any debug printing that

src/librustc_codegen_llvm/consts.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,13 @@ impl CodegenCx<'ll, 'tcx> {
233233
ref attrs, span, kind: hir::ItemKind::Static(..), ..
234234
}) => {
235235
let sym_str = sym.as_str();
236-
if self.get_declared_value(&sym_str).is_some() {
237-
span_bug!(span, "Conflicting symbol names for static?");
236+
if let Some(g) = self.get_declared_value(&sym_str) {
237+
if self.val_ty(g) != self.type_ptr_to(llty) {
238+
span_bug!(span, "Conflicting types for static");
239+
}
238240
}
239241

240-
let g = self.define_global(&sym_str, llty).unwrap();
242+
let g = self.declare_global(&sym_str, llty);
241243

242244
if !self.tcx.is_reachable_non_generic(def_id) {
243245
unsafe {

src/librustc_data_structures/stable_hasher.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl Hasher for StableHasher {
149149
///
150150
/// That second condition is usually not required for hash functions
151151
/// (e.g. `Hash`). In practice this means that `hash_stable` must feed any
152-
/// information into the hasher that a `PartialEq` comparision takes into
152+
/// information into the hasher that a `PartialEq` comparison takes into
153153
/// account. See [#49300](https://github.com/rust-lang/rust/issues/49300)
154154
/// for an example where violating this invariant has caused trouble in the
155155
/// past.

src/librustc_error_codes/error_codes/E0015.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
A constant item was initialized with something that is not a constant expression.
1+
A constant item was initialized with something that is not a constant
2+
expression.
23

34
Erroneous code example:
45

src/librustc_error_codes/error_codes/E0071.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
You tried to use structure-literal syntax to create an item that is
2-
not a structure or enum variant.
1+
A structure-literal syntax was used to create an item that is not a structure
2+
or enum variant.
33

44
Example of erroneous code:
55

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

12-
To fix this, ensure that the name was correctly spelled, and that
13-
the correct form of initializer was used.
12+
To fix this, ensure that the name was correctly spelled, and that the correct
13+
form of initializer was used.
1414

1515
For example, the code above can be fixed to:
1616

src/librustc_error_codes/error_codes/E0072.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
When defining a recursive struct or enum, any use of the type being defined
2-
from inside the definition must occur behind a pointer (like `Box` or `&`).
3-
This is because structs and enums must have a well-defined size, and without
4-
the pointer, the size of the type would need to be unbounded.
1+
A recursive type has infinite size because it doesn't have an indirection.
52

6-
Consider the following erroneous definition of a type for a list of bytes:
3+
Erroneous code example:
74

85
```compile_fail,E0072
9-
// error, invalid recursive struct type
106
struct ListNode {
117
head: u8,
12-
tail: Option<ListNode>,
8+
tail: Option<ListNode>, // error: no indirection here so impossible to
9+
// compute the type's size
1310
}
1411
```
1512

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

1922
```plain
2023
size of `ListNode` = 1 byte for `head`
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
The `#[simd]` attribute can only be applied to non empty tuple structs, because
2-
it doesn't make sense to try to use SIMD operations when there are no values to
3-
operate on.
1+
A `#[simd]` attribute was applied to an empty tuple struct.
42

5-
This will cause an error:
3+
Erroneous code example:
64

75
```compile_fail,E0075
86
#![feature(repr_simd)]
97
108
#[repr(simd)]
11-
struct Bad;
9+
struct Bad; // error!
1210
```
1311

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

1618
```
1719
#![feature(repr_simd)]
1820
1921
#[repr(simd)]
20-
struct Good(u32);
22+
struct Good(u32); // ok!
2123
```
+10-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
When using the `#[simd]` attribute to automatically use SIMD operations in tuple
2-
struct, the types in the struct must all be of the same type, or the compiler
3-
will trigger this error.
1+
All types in a tuple struct aren't the same when using the `#[simd]`
2+
attribute.
43

5-
This will cause an error:
4+
Erroneous code example:
65

76
```compile_fail,E0076
87
#![feature(repr_simd)]
98
109
#[repr(simd)]
11-
struct Bad(u16, u32, u32);
10+
struct Bad(u16, u32, u32); // error!
1211
```
1312

14-
This will not:
13+
When using the `#[simd]` attribute to automatically use SIMD operations in tuple
14+
struct, the types in the struct must all be of the same type, or the compiler
15+
will trigger this error.
16+
17+
Fixed example:
1518

1619
```
1720
#![feature(repr_simd)]
1821
1922
#[repr(simd)]
20-
struct Good(u32, u32, u32);
23+
struct Good(u32, u32, u32); // ok!
2124
```
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
When using the `#[simd]` attribute on a tuple struct, the elements in the tuple
2-
must be machine types so SIMD operations can be applied to them.
1+
A tuple struct's element isn't a machine type when using the `#[simd]`
2+
attribute.
33

4-
This will cause an error:
4+
Erroneous code example:
55

66
```compile_fail,E0077
77
#![feature(repr_simd)]
88
99
#[repr(simd)]
10-
struct Bad(String);
10+
struct Bad(String); // error!
1111
```
1212

13-
This will not:
13+
When using the `#[simd]` attribute on a tuple struct, the elements in the tuple
14+
must be machine types so SIMD operations can be applied to them.
15+
16+
Fixed example:
1417

1518
```
1619
#![feature(repr_simd)]
1720
1821
#[repr(simd)]
19-
struct Good(u32, u32, u32);
22+
struct Good(u32, u32, u32); // ok!
2023
```

src/librustc_error_codes/error_codes/E0107.md

-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ fn main() {
2525
// expected 0, found 1
2626
}
2727
```
28-

src/librustc_error_codes/error_codes/E0307.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
This error indicates that the `self` parameter in a method has an invalid
2-
"reciever type".
2+
"receiver type".
33

44
Methods take a special first parameter, of which there are three variants:
55
`self`, `&self`, and `&mut self`. These are syntactic sugar for

src/librustc_error_codes/error_codes/E0369.md

-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ left and may require reallocation. This requires ownership of the string
2626
on the left. If something should be added to a string literal, move the
2727
literal to the heap by allocating it with `to_owned()` like in
2828
`"Your text".to_owned()`.
29-

src/librustc_error_codes/error_codes/E0404.md

-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,3 @@ trait Foo {
4141
4242
fn bar<T: Foo>(t: T) {} // ok!
4343
```
44-

src/librustc_error_codes/error_codes/E0458.md

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ Please specify a valid "kind" value, from one of the following:
1010
* static
1111
* dylib
1212
* framework
13-

src/librustc_error_codes/error_codes/E0633.md

-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ The `#[unwind]` attribute should be used as follows:
2121

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

0 commit comments

Comments
 (0)