diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-16 17:09:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-16 17:09:34 +0200 |
| commit | be327a8f692919fd26742e6b88918878f67d60dd (patch) | |
| tree | e19cbb400b987b43bb86402085db3ca10d11c9f9 /src/test | |
| parent | f432d5030ed4c16932cab88bbf71175cd285a03b (diff) | |
| parent | 9b3e11f635c0354040ce515ac0ed4fade6fe928f (diff) | |
| download | rust-be327a8f692919fd26742e6b88918878f67d60dd.tar.gz rust-be327a8f692919fd26742e6b88918878f67d60dd.zip | |
Rollup merge of #64028 - Centril:stabilize-alloc-new-2, r=alexcrichton
Stabilize `Vec::new` and `String::new` as `const fn`s Closes https://github.com/rust-lang/rust/issues/64022. r? @oli-obk
Diffstat (limited to 'src/test')
3 files changed, 5 insertions, 16 deletions
diff --git a/src/test/ui/collections-const-new.rs b/src/test/ui/collections-const-new.rs index e01b0dfa14d..a93f9a136db 100644 --- a/src/test/ui/collections-const-new.rs +++ b/src/test/ui/collections-const-new.rs @@ -1,15 +1,11 @@ -// run-pass +// check-pass -#![allow(dead_code)] // Test several functions can be used for constants // 1. Vec::new() // 2. String::new() -#![feature(const_vec_new)] -#![feature(const_string_new)] - const MY_VEC: Vec<usize> = Vec::new(); const MY_STRING: String = String::new(); -pub fn main() {} +fn main() {} diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs index 5fb92535502..8b17f6885ad 100644 --- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.rs @@ -14,8 +14,9 @@ trait Bar<T, U: Foo<T>> { impl Foo<u32> for () { const X: u32 = 42; } + impl Foo<Vec<u32>> for String { - const X: Vec<u32> = Vec::new(); //~ ERROR not yet stable as a const fn + const X: Vec<u32> = Vec::new(); } impl Bar<u32, ()> for () {} diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr index c56ebf60df4..5bc7b70638c 100644 --- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr @@ -4,13 +4,5 @@ error[E0493]: destructors cannot be evaluated at compile-time LL | const F: u32 = (U::X, 42).1; | ^^^^^^^^^^ constants cannot evaluate destructors -error: `std::vec::Vec::<T>::new` is not yet stable as a const fn - --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:18:25 - | -LL | const X: Vec<u32> = Vec::new(); - | ^^^^^^^^^^ - | - = help: add `#![feature(const_vec_new)]` to the crate attributes to enable - -error: aborting due to 2 previous errors +error: aborting due to previous error |
