Skip to content

Commit 0537478

Browse files
CoVec, PlVec, DefVec, WeVec. Cleanup.
1 parent 023bdd1 commit 0537478

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

library/alloc/src/borrow.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ use crate::string::String;
1717

1818
use Cow::*;
1919

20-
// @FIXME check if used & needed
21-
pub(crate) const BORROW_COOP_PREFERRED: bool = DEFAULT_COOP_PREFERRED!();
22-
2320
#[stable(feature = "rust1", since = "1.0.0")]
2421
impl<'a, B: ?Sized, const COOP_PREFERRED: bool> Borrow<B> for Cow<'a, B, COOP_PREFERRED>
2522
where

library/alloc/src/vec/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,29 +419,30 @@ pub struct Vec<
419419
len: usize,
420420
}
421421

422+
/// "Cooperative" Vector. Preferring co-alloc API (if Global alloc supports it).
422423
#[unstable(feature = "global_co_alloc_covec", issue = "none")]
423-
pub type CoVec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> =
424+
pub type CoVec<T, A = Global> =
424425
Vec<T, A, true>;
425426

426427
/// "Plain" Vec. Not "cooperative" - not carrying extra data to assist the allocator.
427428
/// FIXME after cleanup, see if we still use this in core:: and/or alloc::
428429
#[unstable(feature = "global_co_alloc_plvec", issue = "none")]
429-
pub type PlVec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> =
430+
pub type PlVec<T, A = Global> =
430431
Vec<T, A, false>;
431432

432433
/// "Default" Vec. Either "cooperative" or not - as specified by `DEFAULT_COOP_PREFERRED`. The
433434
/// difference to `Vec` (used without specifying `COOP_PREFERRED`): `DefVec` indicates that the
434435
/// author considered using `CoVec` or `PlVec`, but left it to default instead.
435436
#[unstable(feature = "global_co_alloc_defvec", issue = "none")]
436437
#[allow(unused_braces)]
437-
pub type DefVec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> =
438+
pub type DefVec<T, A = Global> =
438439
Vec<T, A, {DEFAULT_COOP_PREFERRED!()}>;
439440

440441
/// "Weighted cooperative" Vec. Weight means how much it wants to cooperate (with the allocator). 0
441442
/// = always pack; u8::MAX = always cooperate (if `Global` supports it).
442443
/// @FIXME A `pub const` threshold.
443444
#[unstable(feature = "global_co_alloc_vec", issue = "none")]
444-
pub type WeVec<T, const weight: u8> = Vec<T, Global, { weight > 127 }>;
445+
pub type WeVec<T, const WEIGHT: u8> = Vec<T, Global, { WEIGHT > 127 }>;
445446

446447
////////////////////////////////////////////////////////////////////////////////
447448
// Inherent methods

0 commit comments

Comments
 (0)