Skip to content

Commit

Permalink
Const-stabilize String::new.
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Sep 16, 2019
1 parent d5fe583 commit 9b3e11f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ impl String {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_string_new")]
#[cfg_attr(bootstrap, rustc_const_unstable(feature = "const_string_new"))]
pub const fn new() -> String {
String { vec: Vec::new() }
}
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/collections-const-new.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// run-pass
// check-pass

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

#![feature(const_string_new)]

const MY_VEC: Vec<usize> = Vec::new();

const MY_STRING: String = String::new();
Expand Down

0 comments on commit 9b3e11f

Please sign in to comment.