Skip to content

Commit 158b085

Browse files
committed
Fix more merge conflicts
2 parents 8a3ea01 + 15ce540 commit 158b085

File tree

135 files changed

+2041
-2701
lines changed

Some content is hidden

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

135 files changed

+2041
-2701
lines changed

src/doc/grammar.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,10 +781,11 @@ never_type : "!" ;
781781
### Type parameter bounds
782782

783783
```antlr
784+
bound-list := bound | bound '+' bound-list '+' ?
784785
bound := ty_bound | lt_bound
785786
lt_bound := lifetime
786-
ty_bound := [?] [ for<lt_param_defs> ] simple_path
787-
bound-list := bound | bound '+' bound-list '+' ?
787+
ty_bound := ty_bound_noparen | (ty_bound_noparen)
788+
ty_bound_noparen := [?] [ for<lt_param_defs> ] simple_path
788789
```
789790

790791
### Self types

src/doc/unstable-book/src/SUMMARY.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,8 @@
101101
- [alloc_system](library-features/alloc-system.md)
102102
- [alloc](library-features/alloc.md)
103103
- [as_c_str](library-features/as-c-str.md)
104-
- [as_unsafe_cell](library-features/as-unsafe-cell.md)
105104
- [ascii_ctype](library-features/ascii-ctype.md)
106-
- [binary_heap_extras](library-features/binary-heap-extras.md)
107105
- [binary_heap_peek_mut_pop](library-features/binary-heap-peek-mut-pop.md)
108-
- [borrow_state](library-features/borrow-state.md)
109106
- [box_heap](library-features/box-heap.md)
110107
- [c_void_variant](library-features/c-void-variant.md)
111108
- [char_escape_debug](library-features/char-escape-debug.md)
@@ -130,14 +127,12 @@
130127
- [derive_clone_copy](library-features/derive-clone-copy.md)
131128
- [derive_eq](library-features/derive-eq.md)
132129
- [discriminant_value](library-features/discriminant-value.md)
133-
- [enumset](library-features/enumset.md)
134130
- [error_type_id](library-features/error-type-id.md)
135131
- [exact_size_is_empty](library-features/exact-size-is-empty.md)
136132
- [fd](library-features/fd.md)
137133
- [fd_read](library-features/fd-read.md)
138134
- [fixed_size_array](library-features/fixed-size-array.md)
139135
- [float_bits_conv](library-features/float-bits-conv.md)
140-
- [float_extras](library-features/float-extras.md)
141136
- [flt2dec](library-features/flt2dec.md)
142137
- [fmt_flags_align](library-features/fmt-flags-align.md)
143138
- [fmt_internals](library-features/fmt-internals.md)
@@ -157,15 +152,13 @@
157152
- [io_error_internals](library-features/io-error-internals.md)
158153
- [io](library-features/io.md)
159154
- [ip](library-features/ip.md)
160-
- [is_unique](library-features/is-unique.md)
161155
- [iter_rfind](library-features/iter-rfind.md)
162156
- [libstd_io_internals](library-features/libstd-io-internals.md)
163157
- [libstd_sys_internals](library-features/libstd-sys-internals.md)
164158
- [libstd_thread_internals](library-features/libstd-thread-internals.md)
165159
- [linked_list_extras](library-features/linked-list-extras.md)
166160
- [lookup_host](library-features/lookup-host.md)
167161
- [manually_drop](library-features/manually-drop.md)
168-
- [map_entry_recover_keys](library-features/map-entry-recover-keys.md)
169162
- [mpsc_select](library-features/mpsc-select.md)
170163
- [n16](library-features/n16.md)
171164
- [never_type_impls](library-features/never-type-impls.md)
@@ -188,7 +181,6 @@
188181
- [rand](library-features/rand.md)
189182
- [range_contains](library-features/range-contains.md)
190183
- [raw](library-features/raw.md)
191-
- [rc_would_unwrap](library-features/rc-would-unwrap.md)
192184
- [retain_hash_collection](library-features/retain-hash-collection.md)
193185
- [reverse_cmp_key](library-features/reverse-cmp-key.md)
194186
- [rt](library-features/rt.md)
@@ -224,4 +216,3 @@
224216
- [windows_handle](library-features/windows-handle.md)
225217
- [windows_net](library-features/windows-net.md)
226218
- [windows_stdio](library-features/windows-stdio.md)
227-
- [zero_one](library-features/zero-one.md)

src/doc/unstable-book/src/library-features/as-unsafe-cell.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/doc/unstable-book/src/library-features/binary-heap-extras.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/doc/unstable-book/src/library-features/borrow-state.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/doc/unstable-book/src/library-features/enumset.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/doc/unstable-book/src/library-features/float-extras.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/doc/unstable-book/src/library-features/is-unique.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/doc/unstable-book/src/library-features/map-entry-recover-keys.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/doc/unstable-book/src/library-features/rc-would-unwrap.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/doc/unstable-book/src/library-features/zero-one.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/liballoc/heap.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
issue = "27700")]
1717

1818
use core::{isize, usize};
19-
#[cfg(not(test))]
2019
use core::intrinsics::{min_align_of_val, size_of_val};
2120

2221
#[allow(improper_ctypes)]
@@ -158,10 +157,9 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
158157
}
159158
}
160159

161-
#[cfg(not(test))]
162-
#[lang = "box_free"]
160+
#[cfg_attr(not(test), lang = "box_free")]
163161
#[inline]
164-
unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
162+
pub(crate) unsafe fn box_free<T: ?Sized>(ptr: *mut T) {
165163
let size = size_of_val(&*ptr);
166164
let align = min_align_of_val(&*ptr);
167165
// We do not allocate for Box<T> when T is ZST, so deallocation is also not necessary.

src/liballoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
#![feature(needs_allocator)]
8888
#![feature(optin_builtin_traits)]
8989
#![feature(placement_in_syntax)]
90+
#![cfg_attr(stage0, feature(pub_restricted))]
9091
#![feature(shared)]
9192
#![feature(staged_api)]
9293
#![feature(unboxed_closures)]

src/liballoc/rc.rs

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ use core::ops::CoerceUnsized;
239239
use core::ptr::{self, Shared};
240240
use core::convert::From;
241241

242-
use heap::deallocate;
242+
use heap::{allocate, deallocate, box_free};
243243
use raw_vec::RawVec;
244244

245245
struct RcBox<T: ?Sized> {
@@ -248,7 +248,6 @@ struct RcBox<T: ?Sized> {
248248
value: T,
249249
}
250250

251-
252251
/// A single-threaded reference-counting pointer.
253252
///
254253
/// See the [module-level documentation](./index.html) for more details.
@@ -341,19 +340,6 @@ impl<T> Rc<T> {
341340
}
342341
}
343342

344-
/// Checks whether [`Rc::try_unwrap`][try_unwrap] would return
345-
/// [`Ok`].
346-
///
347-
/// [try_unwrap]: struct.Rc.html#method.try_unwrap
348-
/// [`Ok`]: ../../std/result/enum.Result.html#variant.Ok
349-
#[unstable(feature = "rc_would_unwrap",
350-
reason = "just added for niche usecase",
351-
issue = "28356")]
352-
#[rustc_deprecated(since = "1.15.0", reason = "too niche; use `strong_count` instead")]
353-
pub fn would_unwrap(this: &Self) -> bool {
354-
Rc::strong_count(&this) == 1
355-
}
356-
357343
/// Consumes the `Rc`, returning the wrapped pointer.
358344
///
359345
/// To avoid a memory leak the pointer must be converted back to an `Rc` using
@@ -438,6 +424,38 @@ impl Rc<str> {
438424
}
439425
}
440426

427+
impl<T> Rc<[T]> {
428+
/// Constructs a new `Rc<[T]>` from a `Box<[T]>`.
429+
#[doc(hidden)]
430+
#[unstable(feature = "rustc_private",
431+
reason = "for internal use in rustc",
432+
issue = "0")]
433+
pub fn __from_array(value: Box<[T]>) -> Rc<[T]> {
434+
unsafe {
435+
let ptr: *mut RcBox<[T]> =
436+
mem::transmute([mem::align_of::<RcBox<[T; 1]>>(), value.len()]);
437+
// FIXME(custom-DST): creating this invalid &[T] is dubiously defined,
438+
// we should have a better way of getting the size/align
439+
// of a DST from its unsized part.
440+
let ptr = allocate(size_of_val(&*ptr), align_of_val(&*ptr));
441+
let ptr: *mut RcBox<[T]> = mem::transmute([ptr as usize, value.len()]);
442+
443+
// Initialize the new RcBox.
444+
ptr::write(&mut (*ptr).strong, Cell::new(1));
445+
ptr::write(&mut (*ptr).weak, Cell::new(1));
446+
ptr::copy_nonoverlapping(
447+
value.as_ptr(),
448+
&mut (*ptr).value as *mut [T] as *mut T,
449+
value.len());
450+
451+
// Free the original allocation without freeing its (moved) contents.
452+
box_free(Box::into_raw(value));
453+
454+
Rc { ptr: Shared::new(ptr as *const _) }
455+
}
456+
}
457+
}
458+
441459
impl<T: ?Sized> Rc<T> {
442460
/// Creates a new [`Weak`][weak] pointer to this value.
443461
///
@@ -501,11 +519,7 @@ impl<T: ?Sized> Rc<T> {
501519
///
502520
/// [weak]: struct.Weak.html
503521
#[inline]
504-
#[unstable(feature = "is_unique", reason = "uniqueness has unclear meaning",
505-
issue = "28356")]
506-
#[rustc_deprecated(since = "1.15.0",
507-
reason = "too niche; use `strong_count` and `weak_count` instead")]
508-
pub fn is_unique(this: &Self) -> bool {
522+
fn is_unique(this: &Self) -> bool {
509523
Rc::weak_count(this) == 0 && Rc::strong_count(this) == 1
510524
}
511525

src/libcollections/binary_heap.rs

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -555,82 +555,6 @@ impl<T: Ord> BinaryHeap<T> {
555555
self.sift_up(0, old_len);
556556
}
557557

558-
/// Pushes an item onto the binary heap, then pops the greatest item off the queue in
559-
/// an optimized fashion.
560-
///
561-
/// # Examples
562-
///
563-
/// Basic usage:
564-
///
565-
/// ```
566-
/// #![feature(binary_heap_extras)]
567-
/// #![allow(deprecated)]
568-
///
569-
/// use std::collections::BinaryHeap;
570-
/// let mut heap = BinaryHeap::new();
571-
/// heap.push(1);
572-
/// heap.push(5);
573-
///
574-
/// assert_eq!(heap.push_pop(3), 5);
575-
/// assert_eq!(heap.push_pop(9), 9);
576-
/// assert_eq!(heap.len(), 2);
577-
/// assert_eq!(heap.peek(), Some(&3));
578-
/// ```
579-
#[unstable(feature = "binary_heap_extras",
580-
reason = "needs to be audited",
581-
issue = "28147")]
582-
#[rustc_deprecated(since = "1.13.0", reason = "use `peek_mut` instead")]
583-
pub fn push_pop(&mut self, mut item: T) -> T {
584-
match self.data.get_mut(0) {
585-
None => return item,
586-
Some(top) => {
587-
if *top > item {
588-
swap(&mut item, top);
589-
} else {
590-
return item;
591-
}
592-
}
593-
}
594-
595-
self.sift_down(0);
596-
item
597-
}
598-
599-
/// Pops the greatest item off the binary heap, then pushes an item onto the queue in
600-
/// an optimized fashion. The push is done regardless of whether the binary heap
601-
/// was empty.
602-
///
603-
/// # Examples
604-
///
605-
/// Basic usage:
606-
///
607-
/// ```
608-
/// #![feature(binary_heap_extras)]
609-
/// #![allow(deprecated)]
610-
///
611-
/// use std::collections::BinaryHeap;
612-
/// let mut heap = BinaryHeap::new();
613-
///
614-
/// assert_eq!(heap.replace(1), None);
615-
/// assert_eq!(heap.replace(3), Some(1));
616-
/// assert_eq!(heap.len(), 1);
617-
/// assert_eq!(heap.peek(), Some(&3));
618-
/// ```
619-
#[unstable(feature = "binary_heap_extras",
620-
reason = "needs to be audited",
621-
issue = "28147")]
622-
#[rustc_deprecated(since = "1.13.0", reason = "use `peek_mut` instead")]
623-
pub fn replace(&mut self, mut item: T) -> Option<T> {
624-
if !self.is_empty() {
625-
swap(&mut item, &mut self.data[0]);
626-
self.sift_down(0);
627-
Some(item)
628-
} else {
629-
self.push(item);
630-
None
631-
}
632-
}
633-
634558
/// Consumes the `BinaryHeap` and returns the underlying vector
635559
/// in arbitrary order.
636560
///
@@ -1042,7 +966,7 @@ impl<'a, T> FusedIterator for Iter<'a, T> {}
1042966

1043967
/// An owning iterator over the elements of a `BinaryHeap`.
1044968
///
1045-
/// This `struct` is created by the [`into_iter`] method on [`BinaryHeap`]
969+
/// This `struct` is created by the [`into_iter`] method on [`BinaryHeap`][`BinaryHeap`]
1046970
/// (provided by the `IntoIterator` trait). See its documentation for more.
1047971
///
1048972
/// [`into_iter`]: struct.BinaryHeap.html#method.into_iter

src/libcollections/btree/map.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ pub struct IterMut<'a, K: 'a, V: 'a> {
298298

299299
/// An owning iterator over the entries of a `BTreeMap`.
300300
///
301-
/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`]
301+
/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`][`BTreeMap`]
302302
/// (provided by the `IntoIterator` trait). See its documentation for more.
303303
///
304304
/// [`into_iter`]: struct.BTreeMap.html#method.into_iter
@@ -2217,13 +2217,6 @@ impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
22172217
self.handle.reborrow().into_kv().0
22182218
}
22192219

2220-
/// Deprecated, renamed to `remove_entry`
2221-
#[unstable(feature = "map_entry_recover_keys", issue = "34285")]
2222-
#[rustc_deprecated(since = "1.12.0", reason = "renamed to `remove_entry`")]
2223-
pub fn remove_pair(self) -> (K, V) {
2224-
self.remove_entry()
2225-
}
2226-
22272220
/// Take ownership of the key and value from the map.
22282221
///
22292222
/// # Examples

src/libcollections/btree/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<'a, T: 'a + fmt::Debug> fmt::Debug for Iter<'a, T> {
9797

9898
/// An owning iterator over the items of a `BTreeSet`.
9999
///
100-
/// This `struct` is created by the [`into_iter`] method on [`BTreeSet`]
100+
/// This `struct` is created by the [`into_iter`] method on [`BTreeSet`][`BTreeSet`]
101101
/// (provided by the `IntoIterator` trait). See its documentation for more.
102102
///
103103
/// [`BTreeSet`]: struct.BTreeSet.html

0 commit comments

Comments
 (0)