Skip to content

Commit f943349

Browse files
committed
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
2 parents 823ff8c + 8ee7278 commit f943349

File tree

153 files changed

+286
-382
lines changed

Some content is hidden

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

153 files changed

+286
-382
lines changed

config.toml.example

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

src/bootstrap/compile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn copy_third_party_objects(
141141
copy_and_stamp(&srcdir, "crt1.o");
142142
}
143143

144-
// Copies libunwind.a compiled to be linked wit x86_64-fortanix-unknown-sgx.
144+
// Copies libunwind.a compiled to be linked with x86_64-fortanix-unknown-sgx.
145145
//
146146
// This target needs to be linked to Fortanix's port of llvm's libunwind.
147147
// libunwind requires support for rwlock and printing to stderr,

src/bootstrap/flags.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct Flags {
3333
pub rustc_error_format: Option<String>,
3434
pub dry_run: bool,
3535

36-
// This overrides the deny-warnings configuation option,
36+
// This overrides the deny-warnings configuration option,
3737
// which passes -Dwarnings to the compiler invocations.
3838
//
3939
// true => deny, false => warn

src/ci/azure-pipelines/try.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

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

src/doc/rustdoc/src/unstable-features.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ override `ignore`.
453453

454454
### `--runtool`, `--runtool-arg`: program to run tests with; args to pass to it
455455

456-
Using thses options looks like this:
456+
Using these options looks like this:
457457

458458
```bash
459459
$ rustdoc src/lib.rs -Z unstable-options --runtool runner --runtool-arg --do-thing --runtool-arg --do-other-thing

src/doc/unstable-book/src/language-features/marker-trait-attr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ when they'd need to do the same thing for every type anyway).
2121

2222
impl<T: Copy> CheapToClone for T {}
2323

24-
// These could potentally overlap with the blanket implementation above,
24+
// These could potentially overlap with the blanket implementation above,
2525
// so are only allowed because CheapToClone is a marker trait.
2626
impl<T: CheapToClone, U: CheapToClone> CheapToClone for (T, U) {}
2727
impl<T: CheapToClone> CheapToClone for std::ops::Range<T> {}

src/liballoc/collections/btree/node.rs

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

src/liballoc/collections/linked_list.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -841,10 +841,10 @@ impl<T> LinkedList<T> {
841841
/// d.push_front(2);
842842
/// d.push_front(3);
843843
///
844-
/// let mut splitted = d.split_off(2);
844+
/// let mut split = d.split_off(2);
845845
///
846-
/// assert_eq!(splitted.pop_front(), Some(1));
847-
/// assert_eq!(splitted.pop_front(), None);
846+
/// assert_eq!(split.pop_front(), Some(1));
847+
/// assert_eq!(split.pop_front(), None);
848848
/// ```
849849
#[stable(feature = "rust1", since = "1.0.0")]
850850
pub fn split_off(&mut self, at: usize) -> LinkedList<T> {

src/liballoc/collections/vec_deque.rs

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

src/liballoc/tests/slice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1733,9 +1733,9 @@ fn panic_safe() {
17331733
let moduli = &[5, 20, 50];
17341734

17351735
#[cfg(miri)]
1736-
let lens = 1..13;
1736+
let lens = 1..10;
17371737
#[cfg(miri)]
1738-
let moduli = &[10];
1738+
let moduli = &[5];
17391739

17401740
for len in lens {
17411741
for &modulus in moduli {

src/liballoc/vec.rs

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

src/libcore/alloc.rs

+12
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ impl Layout {
140140
unsafe { Layout::from_size_align_unchecked(size, align) }
141141
}
142142

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

src/libcore/convert/mod.rs

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

src/libcore/fmt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ pub struct ArgumentV1<'a> {
255255
formatter: fn(&Opaque, &mut Formatter<'_>) -> Result,
256256
}
257257

258-
// This gurantees a single stable value for the function pointer associated with
258+
// This guarantees a single stable value for the function pointer associated with
259259
// indices/counts in the formatting infrastructure.
260260
//
261261
// Note that a function defined as such would not be correct as functions are

src/libcore/mem/manually_drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<T> ManuallyDrop<T> {
9393
/// Instead of using [`ManuallyDrop::drop`] to manually drop the value,
9494
/// you can use this method to take the value and use it however desired.
9595
///
96-
/// Whenever possible, it is preferrable to use [`into_inner`][`ManuallyDrop::into_inner`]
96+
/// Whenever possible, it is preferable to use [`into_inner`][`ManuallyDrop::into_inner`]
9797
/// instead, which prevents duplicating the content of the `ManuallyDrop<T>`.
9898
///
9999
/// # Safety

src/libcore/mem/mod.rs

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

src/libcore/pin.rs

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

src/libcore/ptr/const_ptr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<T: ?Sized> *const T {
5353
/// all of the following is true:
5454
/// - it is properly aligned
5555
/// - it must point to an initialized instance of T; in particular, the pointer must be
56-
/// "dereferencable" in the sense defined [here].
56+
/// "dereferenceable" in the sense defined [here].
5757
///
5858
/// This applies even if the result of this method is unused!
5959
/// (The part about being initialized is not yet fully decided, but until
@@ -183,7 +183,7 @@ impl<T: ?Sized> *const T {
183183
/// within the same allocated object: [`offset`] is immediate Undefined Behavior when
184184
/// crossing object boundaries; `wrapping_offset` produces a pointer but still leads
185185
/// to Undefined Behavior if that pointer is dereferenced. [`offset`] can be optimized
186-
/// better and is thus preferrable in performance-sensitive code.
186+
/// better and is thus preferable in performance-sensitive code.
187187
///
188188
/// If you need to cross object boundaries, cast the pointer to an integer and
189189
/// do the arithmetic there.
@@ -480,7 +480,7 @@ impl<T: ?Sized> *const T {
480480
/// within the same allocated object: [`add`] is immediate Undefined Behavior when
481481
/// crossing object boundaries; `wrapping_add` produces a pointer but still leads
482482
/// to Undefined Behavior if that pointer is dereferenced. [`add`] can be optimized
483-
/// better and is thus preferrable in performance-sensitive code.
483+
/// better and is thus preferable in performance-sensitive code.
484484
///
485485
/// If you need to cross object boundaries, cast the pointer to an integer and
486486
/// do the arithmetic there.
@@ -535,7 +535,7 @@ impl<T: ?Sized> *const T {
535535
/// within the same allocated object: [`sub`] is immediate Undefined Behavior when
536536
/// crossing object boundaries; `wrapping_sub` produces a pointer but still leads
537537
/// to Undefined Behavior if that pointer is dereferenced. [`sub`] can be optimized
538-
/// better and is thus preferrable in performance-sensitive code.
538+
/// better and is thus preferable in performance-sensitive code.
539539
///
540540
/// If you need to cross object boundaries, cast the pointer to an integer and
541541
/// do the arithmetic there.

src/libcore/ptr/mod.rs

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

src/libcore/ptr/mut_ptr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<T: ?Sized> *mut T {
4949
/// memory.
5050
///
5151
/// When calling this method, you have to ensure that if the pointer is
52-
/// non-NULL, then it is properly aligned, dereferencable (for the whole
52+
/// non-NULL, then it is properly aligned, dereferenceable (for the whole
5353
/// size of `T`) and points to an initialized instance of `T`. This applies
5454
/// even if the result of this method is unused!
5555
/// (The part about being initialized is not yet fully decided, but until
@@ -176,7 +176,7 @@ impl<T: ?Sized> *mut T {
176176
/// within the same allocated object: [`offset`] is immediate Undefined Behavior when
177177
/// crossing object boundaries; `wrapping_offset` produces a pointer but still leads
178178
/// to Undefined Behavior if that pointer is dereferenced. [`offset`] can be optimized
179-
/// better and is thus preferrable in performance-sensitive code.
179+
/// better and is thus preferable in performance-sensitive code.
180180
///
181181
/// If you need to cross object boundaries, cast the pointer to an integer and
182182
/// do the arithmetic there.
@@ -224,7 +224,7 @@ impl<T: ?Sized> *mut T {
224224
/// all of the following is true:
225225
/// - it is properly aligned
226226
/// - it must point to an initialized instance of T; in particular, the pointer must be
227-
/// "dereferencable" in the sense defined [here].
227+
/// "dereferenceable" in the sense defined [here].
228228
///
229229
/// This applies even if the result of this method is unused!
230230
/// (The part about being initialized is not yet fully decided, but until
@@ -526,7 +526,7 @@ impl<T: ?Sized> *mut T {
526526
/// within the same allocated object: [`add`] is immediate Undefined Behavior when
527527
/// crossing object boundaries; `wrapping_add` produces a pointer but still leads
528528
/// to Undefined Behavior if that pointer is dereferenced. [`add`] can be optimized
529-
/// better and is thus preferrable in performance-sensitive code.
529+
/// better and is thus preferable in performance-sensitive code.
530530
///
531531
/// If you need to cross object boundaries, cast the pointer to an integer and
532532
/// do the arithmetic there.
@@ -581,7 +581,7 @@ impl<T: ?Sized> *mut T {
581581
/// within the same allocated object: [`sub`] is immediate Undefined Behavior when
582582
/// crossing object boundaries; `wrapping_sub` produces a pointer but still leads
583583
/// to Undefined Behavior if that pointer is dereferenced. [`sub`] can be optimized
584-
/// better and is thus preferrable in performance-sensitive code.
584+
/// better and is thus preferable in performance-sensitive code.
585585
///
586586
/// If you need to cross object boundaries, cast the pointer to an integer and
587587
/// do the arithmetic there.

src/libcore/tests/alloc.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
use core::alloc::Layout;
2+
use core::ptr::NonNull;
23

34
#[test]
45
fn const_unchecked_layout() {
56
const SIZE: usize = 0x2000;
67
const ALIGN: usize = 0x1000;
78
const LAYOUT: Layout = unsafe { Layout::from_size_align_unchecked(SIZE, ALIGN) };
9+
const DANGLING: NonNull<u8> = LAYOUT.dangling();
810
assert_eq!(LAYOUT.size(), SIZE);
911
assert_eq!(LAYOUT.align(), ALIGN);
12+
assert_eq!(Some(DANGLING), NonNull::new(ALIGN as *mut u8));
1013
}

src/libcore/tests/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(alloc_layout_extra)]
12
#![feature(bool_to_option)]
23
#![feature(bound_cloned)]
34
#![feature(box_syntax)]

src/libfmt_macros/lib.rs

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

src/libproc_macro/bridge/client.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ macro_rules! define_handles {
1515
}
1616

1717
impl HandleCounters {
18-
// FIXME(eddyb) use a reference to the `static COUNTERS`, intead of
18+
// FIXME(eddyb) use a reference to the `static COUNTERS`, instead of
1919
// a wrapper `fn` pointer, once `const fn` can reference `static`s.
2020
extern "C" fn get() -> &'static Self {
2121
static COUNTERS: HandleCounters = HandleCounters {
@@ -334,7 +334,7 @@ impl Bridge<'_> {
334334
#[repr(C)]
335335
#[derive(Copy, Clone)]
336336
pub struct Client<F> {
337-
// FIXME(eddyb) use a reference to the `static COUNTERS`, intead of
337+
// FIXME(eddyb) use a reference to the `static COUNTERS`, instead of
338338
// a wrapper `fn` pointer, once `const fn` can reference `static`s.
339339
pub(super) get_handle_counters: extern "C" fn() -> &'static HandleCounters,
340340
pub(super) run: extern "C" fn(Bridge<'_>, F) -> Buffer<u8>,

src/librustc/hir/map/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ impl<'hir> Map<'hir> {
653653
}
654654
}
655655

656-
/// Wether `hir_id` corresponds to a `mod` or a crate.
656+
/// Whether `hir_id` corresponds to a `mod` or a crate.
657657
pub fn is_hir_id_module(&self, hir_id: HirId) -> bool {
658658
match self.lookup(hir_id) {
659659
Some(Entry { node: Node::Item(Item { kind: ItemKind::Mod(_), .. }), .. })

src/librustc/middle/codegen_fn_attrs.rs

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

src/librustc/mir/interpret/allocation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ impl<Tag, Extra> Allocation<Tag, Extra> {
610610
// a naive undef mask copying algorithm would repeatedly have to read the undef mask from
611611
// the source and write it to the destination. Even if we optimized the memory accesses,
612612
// we'd be doing all of this `repeat` times.
613-
// Therefor we precompute a compressed version of the undef mask of the source value and
613+
// Therefore we precompute a compressed version of the undef mask of the source value and
614614
// then write it back `repeat` times without computing any more information from the source.
615615

616616
// A precomputed cache for ranges of defined/undefined bits

src/librustc/mir/visit.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ macro_rules! visit_place_fns {
888888
() => (
889889
fn visit_projection(
890890
&mut self,
891-
local: &Local,
891+
local: Local,
892892
projection: &[PlaceElem<'tcx>],
893893
context: PlaceContext,
894894
location: Location,
@@ -898,7 +898,7 @@ macro_rules! visit_place_fns {
898898

899899
fn visit_projection_elem(
900900
&mut self,
901-
local: &Local,
901+
local: Local,
902902
proj_base: &[PlaceElem<'tcx>],
903903
elem: &PlaceElem<'tcx>,
904904
context: PlaceContext,
@@ -925,15 +925,15 @@ macro_rules! visit_place_fns {
925925

926926
self.visit_place_base(&place.local, context, location);
927927

928-
self.visit_projection(&place.local,
928+
self.visit_projection(place.local,
929929
&place.projection,
930930
context,
931931
location);
932932
}
933933

934934
fn super_projection(
935935
&mut self,
936-
local: &Local,
936+
local: Local,
937937
projection: &[PlaceElem<'tcx>],
938938
context: PlaceContext,
939939
location: Location,
@@ -947,7 +947,7 @@ macro_rules! visit_place_fns {
947947

948948
fn super_projection_elem(
949949
&mut self,
950-
_local: &Local,
950+
_local: Local,
951951
_proj_base: &[PlaceElem<'tcx>],
952952
elem: &PlaceElem<'tcx>,
953953
_context: PlaceContext,

src/librustc/ty/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2579,7 +2579,7 @@ where
25792579
if let Some(kind) = pointee.safe {
25802580
attrs.pointee_align = Some(pointee.align);
25812581

2582-
// `Box` (`UniqueBorrowed`) are not necessarily dereferencable
2582+
// `Box` (`UniqueBorrowed`) are not necessarily dereferenceable
25832583
// for the entire duration of the function as they can be deallocated
25842584
// any time. Set their valid size to 0.
25852585
attrs.pointee_size = match kind {

0 commit comments

Comments
 (0)