Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve FIXME: String::new is now a const fn #5097

Merged
merged 1 commit into from
Jan 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tests/ui/missing_const_for_fn/could_be_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
10 changes: 5 additions & 5 deletions tests/ui/missing_const_for_fn/could_be_const.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,39 @@ 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()
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
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
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) }
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
Expand Down