about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hansch <dev@phansch.net>2020-01-26 11:03:53 +0100
committerPhilipp Hansch <dev@phansch.net>2020-01-26 11:03:53 +0100
commit45333102d79a7e5738dfd3c4b27661428cc31202 (patch)
tree2d4d76b2ae73cede7414e5bb8baf559558cd1bc7
parentb6a976676c5a9caf5ac7e6305ad52ebc11ab135c (diff)
downloadrust-45333102d79a7e5738dfd3c4b27661428cc31202.tar.gz
rust-45333102d79a7e5738dfd3c4b27661428cc31202.zip
Resolve FIXME: String::new is now a const fn
`const_string_new` is stable since Rust 1.39
-rw-r--r--tests/ui/missing_const_for_fn/could_be_const.rs3
-rw-r--r--tests/ui/missing_const_for_fn/could_be_const.stderr10
2 files changed, 6 insertions, 7 deletions
diff --git a/tests/ui/missing_const_for_fn/could_be_const.rs b/tests/ui/missing_const_for_fn/could_be_const.rs
index a05cc7fee81..9a73dcbe99f 100644
--- a/tests/ui/missing_const_for_fn/could_be_const.rs
+++ b/tests/ui/missing_const_for_fn/could_be_const.rs
@@ -25,8 +25,7 @@ fn two() -> i32 {
     abc
 }
 
-// FIXME: This is a false positive in the `is_min_const_fn` function.
-// At least until the `const_string_new` feature is stabilzed.
+// Could be const (since Rust 1.39)
 fn string() -> String {
     String::new()
 }
diff --git a/tests/ui/missing_const_for_fn/could_be_const.stderr b/tests/ui/missing_const_for_fn/could_be_const.stderr
index 7d3dca1800b..165b8a03077 100644
--- a/tests/ui/missing_const_for_fn/could_be_const.stderr
+++ b/tests/ui/missing_const_for_fn/could_be_const.stderr
@@ -26,7 +26,7 @@ LL | | }
    | |_^
 
 error: this could be a `const fn`
-  --> $DIR/could_be_const.rs:30:1
+  --> $DIR/could_be_const.rs:29:1
    |
 LL | / fn string() -> String {
 LL | |     String::new()
@@ -34,7 +34,7 @@ LL | | }
    | |_^
 
 error: this could be a `const fn`
-  --> $DIR/could_be_const.rs:35:1
+  --> $DIR/could_be_const.rs:34:1
    |
 LL | / unsafe fn four() -> i32 {
 LL | |     4
@@ -42,7 +42,7 @@ LL | | }
    | |_^
 
 error: this could be a `const fn`
-  --> $DIR/could_be_const.rs:40:1
+  --> $DIR/could_be_const.rs:39:1
    |
 LL | / fn generic<T>(t: T) -> T {
 LL | |     t
@@ -50,7 +50,7 @@ LL | | }
    | |_^
 
 error: this could be a `const fn`
-  --> $DIR/could_be_const.rs:44:1
+  --> $DIR/could_be_const.rs:43:1
    |
 LL | / fn sub(x: u32) -> usize {
 LL | |     unsafe { transmute(&x) }
@@ -58,7 +58,7 @@ LL | | }
    | |_^
 
 error: this could be a `const fn`
-  --> $DIR/could_be_const.rs:63:9
+  --> $DIR/could_be_const.rs:62:9
    |
 LL | /         pub fn b(self, a: &A) -> B {
 LL | |             B