Skip to content

Commit d04b1ec

Browse files
authored
Rollup merge of rust-lang#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`?
2 parents a4b4253 + 8733b2a commit d04b1ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub use alloc_crate::alloc::*;
130130
/// program opts in to using jemalloc as the global allocator, `System` will
131131
/// still allocate memory using `malloc` and `HeapAlloc`.
132132
#[stable(feature = "alloc_system_type", since = "1.28.0")]
133-
#[derive(Debug, Copy, Clone)]
133+
#[derive(Debug, Default, Copy, Clone)]
134134
pub struct System;
135135

136136
// The Alloc impl just forwards to the GlobalAlloc impl, which is in `std::sys::*::alloc`.

0 commit comments

Comments
 (0)