about summary refs log tree commit diff
path: root/library/alloc/src/string.rs
diff options
context:
space:
mode:
authorLzu Tao <taolzu@gmail.com>2020-07-29 07:38:06 +0000
committerLzu Tao <taolzu@gmail.com>2020-07-29 07:38:06 +0000
commit27e1b0632cea37733050b7e130c3fbaf0b70b52d (patch)
tree0ae338bab4815e3661320294bf8bcf2cb2d10bfc /library/alloc/src/string.rs
parent4cca9505ea9faab261c2769032101cda6a04c212 (diff)
downloadrust-27e1b0632cea37733050b7e130c3fbaf0b70b52d.tar.gz
rust-27e1b0632cea37733050b7e130c3fbaf0b70b52d.zip
Explain why inline default ToString impl
Diffstat (limited to 'library/alloc/src/string.rs')
-rw-r--r--library/alloc/src/string.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index 05398ca68c8..d7d7b6bd157 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -2196,6 +2196,9 @@ pub trait ToString {
 /// since `fmt::Write for String` never returns an error itself.
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T: fmt::Display + ?Sized> ToString for T {
+    // A common guideline is to not inline generic functions. However,
+    // remove `#[inline]` from this method causes non-negligible regression.
+    // See <https://github.com/rust-lang/rust/pull/74852> as last attempt try to remove it.
     #[inline]
     default fn to_string(&self) -> String {
         use fmt::Write;