Skip to content

Commit 4f583b2

Browse files
author
gitbot
committed
Merge from 646a3f8 with conflicts
2 parents 2f8269d + 88f8387 commit 4f583b2

440 files changed

Lines changed: 30310 additions & 7942 deletions

File tree

Some content is hidden

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

library/Cargo.lock

Lines changed: 64 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/alloc/src/alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
361361
unsafe extern "Rust" {
362362
// This is the magic symbol to call the global alloc error handler. rustc generates
363363
// it to call `__rg_oom` if there is a `#[alloc_error_handler]`, or to call the
364-
// default implementations below (`__rdl_oom`) otherwise.
364+
// default implementations below (`__rdl_alloc_error_handler`) otherwise.
365365
#[rustc_std_internal_symbol]
366366
fn __rust_alloc_error_handler(size: usize, align: usize) -> !;
367367
}
@@ -425,7 +425,7 @@ pub mod __alloc_error_handler {
425425
// called via generated `__rust_alloc_error_handler` if there is no
426426
// `#[alloc_error_handler]`.
427427
#[rustc_std_internal_symbol]
428-
pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
428+
pub unsafe fn __rdl_alloc_error_handler(size: usize, _align: usize) -> ! {
429429
unsafe extern "Rust" {
430430
// This symbol is emitted by rustc next to __rust_alloc_error_handler.
431431
// Its value depends on the -Zoom={panic,abort} compiler option.

library/alloc/src/borrow.rs

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ use crate::fmt;
1616
#[cfg(not(no_global_oom_handling))]
1717
use crate::string::String;
1818

19+
// FIXME(inference): const bounds removed due to inference regressions found by crater;
20+
// see https://github.com/rust-lang/rust/issues/147964
21+
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
1922
#[stable(feature = "rust1", since = "1.0.0")]
20-
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
21-
impl<'a, B: ?Sized> const Borrow<B> for Cow<'a, B>
22-
where
23-
B: ToOwned,
24-
B::Owned: [const] Borrow<B>,
23+
impl<'a, B: ?Sized + ToOwned> Borrow<B> for Cow<'a, B>
24+
// where
25+
// B::Owned: [const] Borrow<B>,
2526
{
2627
fn borrow(&self) -> &B {
2728
&**self
@@ -214,43 +215,51 @@ impl<B: ?Sized + ToOwned> Clone for Cow<'_, B> {
214215
impl<B: ?Sized + ToOwned> Cow<'_, B> {
215216
/// Returns true if the data is borrowed, i.e. if `to_mut` would require additional work.
216217
///
218+
/// Note: this is an associated function, which means that you have to call
219+
/// it as `Cow::is_borrowed(&c)` instead of `c.is_borrowed()`. This is so
220+
/// that there is no conflict with a method on the inner type.
221+
///
217222
/// # Examples
218223
///
219224
/// ```
220225
/// #![feature(cow_is_borrowed)]
221226
/// use std::borrow::Cow;
222227
///
223228
/// let cow = Cow::Borrowed("moo");
224-
/// assert!(cow.is_borrowed());
229+
/// assert!(Cow::is_borrowed(&cow));
225230
///
226231
/// let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
227-
/// assert!(!bull.is_borrowed());
232+
/// assert!(!Cow::is_borrowed(&bull));
228233
/// ```
229234
#[unstable(feature = "cow_is_borrowed", issue = "65143")]
230-
pub const fn is_borrowed(&self) -> bool {
231-
match *self {
235+
pub const fn is_borrowed(c: &Self) -> bool {
236+
match *c {
232237
Borrowed(_) => true,
233238
Owned(_) => false,
234239
}
235240
}
236241

237242
/// Returns true if the data is owned, i.e. if `to_mut` would be a no-op.
238243
///
244+
/// Note: this is an associated function, which means that you have to call
245+
/// it as `Cow::is_owned(&c)` instead of `c.is_owned()`. This is so that
246+
/// there is no conflict with a method on the inner type.
247+
///
239248
/// # Examples
240249
///
241250
/// ```
242251
/// #![feature(cow_is_borrowed)]
243252
/// use std::borrow::Cow;
244253
///
245254
/// let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
246-
/// assert!(cow.is_owned());
255+
/// assert!(Cow::is_owned(&cow));
247256
///
248257
/// let bull = Cow::Borrowed("...moo?");
249-
/// assert!(!bull.is_owned());
258+
/// assert!(!Cow::is_owned(&bull));
250259
/// ```
251260
#[unstable(feature = "cow_is_borrowed", issue = "65143")]
252-
pub const fn is_owned(&self) -> bool {
253-
!self.is_borrowed()
261+
pub const fn is_owned(c: &Self) -> bool {
262+
!Cow::is_borrowed(c)
254263
}
255264

256265
/// Acquires a mutable reference to the owned form of the data.
@@ -327,11 +336,13 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
327336
}
328337
}
329338

339+
// FIXME(inference): const bounds removed due to inference regressions found by crater;
340+
// see https://github.com/rust-lang/rust/issues/147964
341+
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
330342
#[stable(feature = "rust1", since = "1.0.0")]
331-
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
332-
impl<B: ?Sized + ToOwned> const Deref for Cow<'_, B>
333-
where
334-
B::Owned: [const] Borrow<B>,
343+
impl<B: ?Sized + ToOwned> Deref for Cow<'_, B>
344+
// where
345+
// B::Owned: [const] Borrow<B>,
335346
{
336347
type Target = B;
337348

@@ -441,11 +452,13 @@ where
441452
}
442453
}
443454

455+
// FIXME(inference): const bounds removed due to inference regressions found by crater;
456+
// see https://github.com/rust-lang/rust/issues/147964
457+
// #[rustc_const_unstable(feature = "const_convert", issue = "143773")]
444458
#[stable(feature = "rust1", since = "1.0.0")]
445-
#[rustc_const_unstable(feature = "const_convert", issue = "143773")]
446-
impl<T: ?Sized + ToOwned> const AsRef<T> for Cow<'_, T>
447-
where
448-
T::Owned: [const] Borrow<T>,
459+
impl<T: ?Sized + ToOwned> AsRef<T> for Cow<'_, T>
460+
// where
461+
// T::Owned: [const] Borrow<T>,
449462
{
450463
fn as_ref(&self) -> &T {
451464
self

0 commit comments

Comments
 (0)