From 75d1f24eca16d882120b487e5ef16fde4a56e7cc Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 10 Feb 2020 04:31:27 +0100 Subject: [PATCH] leave a note re. new specializations moratorium --- src/libs/maintaining-std.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libs/maintaining-std.md b/src/libs/maintaining-std.md index db89a1a4b..89630777b 100644 --- a/src/libs/maintaining-std.md +++ b/src/libs/maintaining-std.md @@ -161,6 +161,12 @@ Blanket trait impls can't be added to `#[fundamental]` types because they have d ### Is specialization involved? +[#68358]: https://github.com/rust-lang/rust/pull/68358 +[#67194]: https://github.com/rust-lang/rust/issues/67194 +[lang_design_specialization]: https://paper.dropbox.com/doc/Specialization-Review-2020-02-03--AuBwAqGbsHDmBlBy~XUlmqUcAg-jFYgiknJi6j00SbN83dWX + +**NOTE(2019-02-10):** Due to recent soundness holes introduced by specialization in the standard library (c.f. [#68358] and [#67194]) the language team decided on a design meeting to place a moratorium on new uses of specialization until we have some checks in place ensuring soundness for internal uses. + We try to avoid leaning on specialization too heavily, limiting its use to optimizing specific implementations. These specialized optimizations use a private trait to find the correct implementation, rather than specializing the public method itself. Any use of specialization that changes how methods are dispatched for external callers should be carefully considered. ### Are there public enums?