Rollup merge of #59451 - TimDiekmann:patch-1, r=sfackler
Add `Default` to `std::alloc::System`
`System` is a unit struct, thus, it can be constructed without any additional information. Therefore `Default` is a noop. However, in generic code, a `T: Default` may happen as in
```rust
#[derive(Default)]
struct Foo<A> {
allocator: A
}
```
Does this need a feature gate?
Should I also add `PartialEq/Eq/PartialOrd/Ord/Hash`?
This commit is contained in:
commit
44c411ec6f
1 changed files with 1 additions and 1 deletions
|
|
@ -130,7 +130,7 @@ pub use alloc_crate::alloc::*;
|
|||
/// program opts in to using jemalloc as the global allocator, `System` will
|
||||
/// still allocate memory using `malloc` and `HeapAlloc`.
|
||||
#[stable(feature = "alloc_system_type", since = "1.28.0")]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
pub struct System;
|
||||
|
||||
// The Alloc impl just forwards to the GlobalAlloc impl, which is in `std::sys::*::alloc`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue