-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rename .cap() methods to .capacity() #60340
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c8b7629
to
4d5a405
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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 |
... but leave the old names in there for backwards compatibility.
Turns out that |
We don't need to keep the I'm uncertain what to do about the |
src/liballoc/raw_vec.rs
Outdated
if mem::size_of::<T>() == 0 { | ||
!0 | ||
} else { | ||
self.cap | ||
} | ||
} | ||
|
||
// For backwards compatibility | ||
#[inline(always)] |
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.
Instead of #[inline(always)]
could this be #[doc(hidden)]
and #[rustc_deprecated]
?
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.
In case you are asking me: I'm a total Rust newbie, and I don't know what should be used here.
Just tell me, and I can change the PR. Or feel free to make any changes yourself.
@Mark-Simulacrum mentioned that RawVec
is a private internal type and we don't need to keep compatibility?
Seems reasonable to me! Just one nit otherwise r=me |
Thanks @alexcrichton for the review! What about the private method |
I don't personally have a preference one way or another. |
ping from triage @mgeier any updates on this? |
Visiting for triage, @mgeier can you address the review comment? |
As suggested in rust-lang#60340 (comment)
Sorry for the long delay! I've removed I couldn't come up with a better name for the internal function |
@bors: r+ |
@bors rollup=never |
@joelpalmer oops we can close it due to inactivity |
I have made the requested changes and reported the latest status in #60340 (comment). What is there left to do for me? |
@mgeier you need to address the failing tests |
Thanks @Dylan-DPC, can you please point me to the failing tests? |
@mgeier looks to have been due to a spurious issue. @alexcrichton can you review this? |
@bors: r+ |
📌 Commit abe3bdf has been approved by |
Rename .cap() methods to .capacity() As mentioned in #60316, there are a few `.cap()` methods, which seem out-of-place because such methods are called `.capacity()` in the rest of the code. This PR renames them to `.capacity()` but leaves `RawVec::cap()` in there for backwards compatibility. I didn't try to mark the old version as "deprecated", because I guess this would cause too much noise.
☀️ Test successful - checks-azure |
📣 Toolstate changed by #60340! Tested on commit 890881f. 💔 rustfmt on windows: test-pass → build-fail (cc @topecongiro, @rust-lang/infra). |
Tested on commit rust-lang/rust@890881f. Direct link to PR: <rust-lang/rust#60340> 💔 rustfmt on windows: test-pass → build-fail (cc @topecongiro, @rust-lang/infra). 💔 rustfmt on linux: test-pass → build-fail (cc @topecongiro, @rust-lang/infra).
As mentioned in #60316, there are a few
.cap()
methods, which seem out-of-place because such methods are called.capacity()
in the rest of the code.This PR renames them to
.capacity()
but leavesRawVec::cap()
in there for backwards compatibility.I didn't try to mark the old version as "deprecated", because I guess this would cause too much noise.