Skip to content

Commit 9b3e11f

Browse files
committed
Const-stabilize String::new.
1 parent d5fe583 commit 9b3e11f

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/liballoc/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ impl String {
369369
/// ```
370370
#[inline]
371371
#[stable(feature = "rust1", since = "1.0.0")]
372-
#[rustc_const_unstable(feature = "const_string_new")]
372+
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_string_new"))]
373373
pub const fn new() -> String {
374374
String { vec: Vec::new() }
375375
}

src/test/ui/collections-const-new.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// run-pass
1+
// check-pass
22

33
// Test several functions can be used for constants
44
// 1. Vec::new()
55
// 2. String::new()
66

7-
#![feature(const_string_new)]
8-
97
const MY_VEC: Vec<usize> = Vec::new();
108

119
const MY_STRING: String = String::new();

0 commit comments

Comments
 (0)