-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
mark std::str::replace(,n) as #[must_use] #50177
mark std::str::replace(,n) as #[must_use] #50177
Conversation
r? @aidanhs (rust_highfive has picked a reviewer for you, use r? to override) |
The same reasoning applies to the |
src/liballoc/str.rs
Outdated
@@ -247,6 +247,7 @@ impl str { | |||
/// assert_eq!(s, s.replacen("cookie monster", "little lamb", 10)); | |||
/// ``` | |||
#[stable(feature = "str_replacen", since = "1.16.0")] | |||
#[must_use] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for consistency, the #[must_use]
attribute usually comes before the stability attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will update. I'll wait with that + the replace() must_use attr until travis is done, in case this introduces bootstrap compiler warnings.
5f8bc3c
to
61ced23
Compare
src/liballoc/str.rs
Outdated
@@ -37,6 +37,7 @@ | |||
// Many of the usings in this module are only used in the test configuration. | |||
// It's cleaner to just turn off the unused_imports warning than to fix them. | |||
#![allow(unused_imports)] | |||
#![feature(fn_must_use)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I hoped this would get rid of
[00:24:20] warning: `#[must_use]` on methods is experimental (see issue #43302)
[00:24:20] --> liballoc/str.rs:211:5
[00:24:20] |
[00:24:20] 211 | #[must_use]
[00:24:20] | ^^^^^^^^^^^
[00:24:20] |
[00:24:20] = help: add #![feature(fn_must_use)] to the crate attributes to enable
[00:24:20]
[00:24:20] warning: `#[must_use]` on methods is experimental (see issue #43302)
[00:24:20] --> liballoc/str.rs:251:5
[00:24:20] |
[00:24:20] 251 | #[must_use]
[00:24:20] | ^^^^^^^^^^^
[00:24:20] |
[00:24:20] = help: add #![feature(fn_must_use)] to the crate attributes to enable
[00:24:20]
but apparently it does't. What am I doing wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add #![feature(fn_must_use)]
to src/liballoc/lib.rs instead.
61ced23
to
5d37ba1
Compare
@bors r+ |
📌 Commit 5d37ba1 has been approved by |
@bors rollup |
⌛ Testing commit 5d37ba1 with merge 765cd68743868b2c9568307cf43d5df96dc361e8... |
💔 Test failed - status-appveyor |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors: retry
* crates.io was down
…On Tue, Apr 24, 2018 at 8:11 PM, bors ***@***.***> wrote:
💔 Test failed - status-appveyor
<https://ci.appveyor.com/project/rust-lang/rust/build/1.0.7136>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#50177 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AaPN0AlYANhbbvvxrkAIZQiwT2CeHUdlks5tr80kgaJpZM4TfwOv>
.
--
You received this message because you are subscribed to the Google Groups
"rust-ops" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to ***@***.***
To post to this group, send email to ***@***.***
To view this discussion on the web visit https://groups.google.com/d/
msgid/rust-ops/rust-lang/rust/pull/50177/c384128494%40github.com
<https://groups.google.com/d/msgid/rust-ops/rust-lang/rust/pull/50177/c384128494%40github.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
|
@nagbot-rs: 🔑 Insufficient privileges: not in try users |
@bors: retry |
…_use, r=oli-obk mark std::str::replace(,n) as #[must_use] let x = "a b c c"; x.replacen("c", "d", 2"); might not do what people might think it does.
☔ The latest upstream changes (presumably #50245) made this pull request unmergeable. Please resolve the merge conflicts. |
let x = "a b c c";
x.replacen("c", "d", 2");
might not do what people might think it does.