Skip to content

Commit d86a7f7

Browse files
committed
Auto merge of #44585 - frewsxcv:rollup, r=frewsxcv
Rollup of 23 pull requests - Successful merges: #44131, #44254, #44368, #44374, #44378, #44388, #44430, #44450, #44453, #44472, #44476, #44477, #44485, #44497, #44521, #44534, #44536, #44541, #44552, #44559, #44563, #44569, #44572 - Failed merges:
2 parents 2d288a5 + 68e0f28 commit d86a7f7

File tree

22 files changed

+320
-120
lines changed

22 files changed

+320
-120
lines changed

CONTRIBUTING.md

+28-5
Original file line numberDiff line numberDiff line change
@@ -400,30 +400,53 @@ labels to triage issues:
400400

401401
* Magenta, **B**-prefixed labels identify bugs which are **blockers**.
402402

403+
* Dark blue, **beta-** labels track changes which need to be backported into
404+
the beta branches.
405+
406+
* Light purple, **C**-prefixed labels represent the **category** of an issue.
407+
403408
* Green, **E**-prefixed labels explain the level of **experience** necessary
404409
to fix the issue.
405410

411+
* The dark blue **final-comment-period** label marks bugs that are using the
412+
RFC signoff functionality of [rfcbot][rfcbot] and are currenty in the final
413+
comment period.
414+
406415
* Red, **I**-prefixed labels indicate the **importance** of the issue. The
407416
[I-nominated][inom] label indicates that an issue has been nominated for
408417
prioritizing at the next triage meeting.
409418

419+
* The purple **metabug** label marks lists of bugs collected by other
420+
categories.
421+
422+
* Purple gray, **O**-prefixed labels are the **operating system** or platform
423+
that this issue is specific to.
424+
410425
* Orange, **P**-prefixed labels indicate a bug's **priority**. These labels
411426
are only assigned during triage meetings, and replace the [I-nominated][inom]
412427
label.
413428

414-
* Blue, **T**-prefixed bugs denote which **team** the issue belongs to.
429+
* The gray **proposed-final-comment-period** label marks bugs that are using
430+
the RFC signoff functionality of [rfcbot][rfcbot] and are currently awaiting
431+
signoff of all team members in order to enter the final comment period.
415432

416-
* Dark blue, **beta-** labels track changes which need to be backported into
417-
the beta branches.
433+
* Pink, **regression**-prefixed labels track regressions from stable to the
434+
release channels.
418435

419-
* The purple **metabug** label marks lists of bugs collected by other
420-
categories.
436+
* The light orange **relnotes** label marks issues that should be documented in
437+
the release notes of the next release.
438+
439+
* Gray, **S**-prefixed labels are used for tracking the **status** of pull
440+
requests.
441+
442+
* Blue, **T**-prefixed bugs denote which **team** the issue belongs to.
421443

422444
If you're looking for somewhere to start, check out the [E-easy][eeasy] tag.
423445

424446
[inom]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AI-nominated
425447
[eeasy]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AE-easy
426448
[lru]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-asc
449+
[rfcbot]: https://github.com/dikaiosune/rust-dashboard/blob/master/RFCBOT.md
427450

428451
## Out-of-tree Contributions
429452

src/Cargo.lock

+19-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/native.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ impl Step for Openssl {
389389
drop(fs::remove_dir_all(&dst));
390390
build.run(Command::new("tar").arg("xf").arg(&tarball).current_dir(&out));
391391

392-
let mut configure = Command::new(obj.join("Configure"));
392+
let mut configure = Command::new("perl");
393+
configure.arg(obj.join("Configure"));
393394
configure.arg(format!("--prefix={}", dst.display()));
394395
configure.arg("no-dso");
395396
configure.arg("no-ssl2");

src/liballoc/btree/set.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -1110,15 +1110,13 @@ impl<'a, T: Ord> Iterator for Union<'a, T> {
11101110
type Item = &'a T;
11111111

11121112
fn next(&mut self) -> Option<&'a T> {
1113-
loop {
1114-
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
1115-
Less => return self.a.next(),
1116-
Equal => {
1117-
self.b.next();
1118-
return self.a.next();
1119-
}
1120-
Greater => return self.b.next(),
1113+
match cmp_opt(self.a.peek(), self.b.peek(), Greater, Less) {
1114+
Less => self.a.next(),
1115+
Equal => {
1116+
self.b.next();
1117+
self.a.next()
11211118
}
1119+
Greater => self.b.next(),
11221120
}
11231121
}
11241122

src/liballoc/str.rs

+35
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,19 @@ impl str {
855855
}
856856

857857
/// Returns an iterator of `u16` over the string encoded as UTF-16.
858+
///
859+
/// # Examples
860+
///
861+
/// Basic usage:
862+
///
863+
/// ```
864+
/// let text = "Zażółć gęślą jaźń";
865+
///
866+
/// let utf8_len = text.len();
867+
/// let utf16_len = text.encode_utf16().count();
868+
///
869+
/// assert!(utf16_len <= utf8_len);
870+
/// ```
858871
#[stable(feature = "encode_utf16", since = "1.8.0")]
859872
pub fn encode_utf16(&self) -> EncodeUtf16 {
860873
EncodeUtf16 { encoder: Utf16Encoder::new(self[..].chars()) }
@@ -1783,6 +1796,17 @@ impl str {
17831796
}
17841797

17851798
/// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
1799+
///
1800+
/// # Examples
1801+
///
1802+
/// Basic usage:
1803+
///
1804+
/// ```
1805+
/// let s = "this is a string";
1806+
/// let boxed_str = s.to_owned().into_boxed_str();
1807+
/// let boxed_bytes = boxed_str.into_boxed_bytes();
1808+
/// assert_eq!(*boxed_bytes, *s.as_bytes());
1809+
/// ```
17861810
#[stable(feature = "str_box_extras", since = "1.20.0")]
17871811
pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
17881812
self.into()
@@ -2050,6 +2074,17 @@ impl str {
20502074

20512075
/// Converts a boxed slice of bytes to a boxed string slice without checking
20522076
/// that the string contains valid UTF-8.
2077+
///
2078+
/// # Examples
2079+
///
2080+
/// Basic usage:
2081+
///
2082+
/// ```
2083+
/// let smile_utf8 = Box::new([226, 152, 186]);
2084+
/// let smile = unsafe { std::str::from_boxed_utf8_unchecked(smile_utf8) };
2085+
///
2086+
/// assert_eq!("☺", &*smile);
2087+
/// ```
20532088
#[stable(feature = "str_box_extras", since = "1.20.0")]
20542089
pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
20552090
mem::transmute(v)

src/liballoc/string.rs

+23-1
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,13 @@ impl String {
622622
/// Decode a UTF-16 encoded slice `v` into a `String`, replacing
623623
/// invalid data with the replacement character (U+FFFD).
624624
///
625+
/// Unlike [`from_utf8_lossy`] which returns a [`Cow<'a, str>`],
626+
/// `from_utf16_lossy` returns a `String` since the UTF-16 to UTF-8
627+
/// conversion requires a memory allocation.
628+
///
629+
/// [`from_utf8_lossy`]: #method.from_utf8_lossy
630+
/// [`Cow<'a, str>`]: ../borrow/enum.Cow.html
631+
///
625632
/// # Examples
626633
///
627634
/// Basic usage:
@@ -759,7 +766,22 @@ impl String {
759766
self
760767
}
761768

762-
/// Extracts a string slice containing the entire string.
769+
/// Converts a `String` into a mutable string slice.
770+
///
771+
/// # Examples
772+
///
773+
/// Basic usage:
774+
///
775+
/// ```
776+
/// use std::ascii::AsciiExt;
777+
///
778+
/// let mut s = String::from("foobar");
779+
/// let s_mut_str = s.as_mut_str();
780+
///
781+
/// s_mut_str.make_ascii_uppercase();
782+
///
783+
/// assert_eq!("FOOBAR", s_mut_str);
784+
/// ```
763785
#[inline]
764786
#[stable(feature = "string_as_str", since = "1.7.0")]
765787
pub fn as_mut_str(&mut self) -> &mut str {

src/liballoc/vec.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ impl<T> Vec<T> {
370370
///
371371
/// * `ptr` needs to have been previously allocated via [`String`]/`Vec<T>`
372372
/// (at least, it's highly likely to be incorrect if it wasn't).
373+
/// * `ptr`'s `T` needs to have the same size and alignment as it was allocated with.
373374
/// * `length` needs to be less than or equal to `capacity`.
374375
/// * `capacity` needs to be the capacity that the pointer was allocated with.
375376
///
@@ -1969,16 +1970,19 @@ impl<T> Vec<T> {
19691970
/// Using this method is equivalent to the following code:
19701971
///
19711972
/// ```
1972-
/// # let some_predicate = |x: &mut i32| { *x == 2 };
1973-
/// # let mut vec = vec![1, 2, 3, 4, 5];
1973+
/// # let some_predicate = |x: &mut i32| { *x == 2 || *x == 3 || *x == 6 };
1974+
/// # let mut vec = vec![1, 2, 3, 4, 5, 6];
19741975
/// let mut i = 0;
19751976
/// while i != vec.len() {
19761977
/// if some_predicate(&mut vec[i]) {
19771978
/// let val = vec.remove(i);
19781979
/// // your code here
1980+
/// } else {
1981+
/// i += 1;
19791982
/// }
1980-
/// i += 1;
19811983
/// }
1984+
///
1985+
/// # assert_eq!(vec, vec![1, 4, 5]);
19821986
/// ```
19831987
///
19841988
/// But `drain_filter` is easier to use. `drain_filter` is also more efficient,

src/libcore/intrinsics.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -848,12 +848,12 @@ extern "rust-intrinsic" {
848848
/// // The no-copy, unsafe way, still using transmute, but not UB.
849849
/// // This is equivalent to the original, but safer, and reuses the
850850
/// // same Vec internals. Therefore the new inner type must have the
851-
/// // exact same size, and the same or lesser alignment, as the old
852-
/// // type. The same caveats exist for this method as transmute, for
851+
/// // exact same size, and the same alignment, as the old type.
852+
/// // The same caveats exist for this method as transmute, for
853853
/// // the original inner type (`&i32`) to the converted inner type
854854
/// // (`Option<&i32>`), so read the nomicon pages linked above.
855855
/// let v_from_raw = unsafe {
856-
/// Vec::from_raw_parts(v_orig.as_mut_ptr(),
856+
/// Vec::from_raw_parts(v_orig.as_mut_ptr() as *mut Option<&i32>,
857857
/// v_orig.len(),
858858
/// v_orig.capacity())
859859
/// };

src/libcore/mem.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -712,39 +712,39 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
712712
/// Opaque type representing the discriminant of an enum.
713713
///
714714
/// See the `discriminant` function in this module for more information.
715-
#[stable(feature = "discriminant_value", since = "1.22.0")]
715+
#[stable(feature = "discriminant_value", since = "1.21.0")]
716716
pub struct Discriminant<T>(u64, PhantomData<*const T>);
717717

718718
// N.B. These trait implementations cannot be derived because we don't want any bounds on T.
719719

720-
#[stable(feature = "discriminant_value", since = "1.22.0")]
720+
#[stable(feature = "discriminant_value", since = "1.21.0")]
721721
impl<T> Copy for Discriminant<T> {}
722722

723-
#[stable(feature = "discriminant_value", since = "1.22.0")]
723+
#[stable(feature = "discriminant_value", since = "1.21.0")]
724724
impl<T> clone::Clone for Discriminant<T> {
725725
fn clone(&self) -> Self {
726726
*self
727727
}
728728
}
729729

730-
#[stable(feature = "discriminant_value", since = "1.22.0")]
730+
#[stable(feature = "discriminant_value", since = "1.21.0")]
731731
impl<T> cmp::PartialEq for Discriminant<T> {
732732
fn eq(&self, rhs: &Self) -> bool {
733733
self.0 == rhs.0
734734
}
735735
}
736736

737-
#[stable(feature = "discriminant_value", since = "1.22.0")]
737+
#[stable(feature = "discriminant_value", since = "1.21.0")]
738738
impl<T> cmp::Eq for Discriminant<T> {}
739739

740-
#[stable(feature = "discriminant_value", since = "1.22.0")]
740+
#[stable(feature = "discriminant_value", since = "1.21.0")]
741741
impl<T> hash::Hash for Discriminant<T> {
742742
fn hash<H: hash::Hasher>(&self, state: &mut H) {
743743
self.0.hash(state);
744744
}
745745
}
746746

747-
#[stable(feature = "discriminant_value", since = "1.22.0")]
747+
#[stable(feature = "discriminant_value", since = "1.21.0")]
748748
impl<T> fmt::Debug for Discriminant<T> {
749749
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
750750
fmt.debug_tuple("Discriminant")
@@ -777,7 +777,7 @@ impl<T> fmt::Debug for Discriminant<T> {
777777
/// assert!(mem::discriminant(&Foo::B(1)) == mem::discriminant(&Foo::B(2)));
778778
/// assert!(mem::discriminant(&Foo::B(3)) != mem::discriminant(&Foo::C(3)));
779779
/// ```
780-
#[stable(feature = "discriminant_value", since = "1.22.0")]
780+
#[stable(feature = "discriminant_value", since = "1.21.0")]
781781
pub fn discriminant<T>(v: &T) -> Discriminant<T> {
782782
unsafe {
783783
Discriminant(intrinsics::discriminant_value(v), PhantomData)

0 commit comments

Comments
 (0)