-
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
Use BitVector for global sets of AttrId #52799
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
aab5c1d
to
18f1f60
Compare
@@ -47,7 +47,11 @@ impl<C: Idx> BitVector<C> { | |||
#[inline] | |||
pub fn contains(&self, bit: C) -> bool { | |||
let (word, mask) = word_mask(bit); | |||
(self.data[word] & mask) != 0 | |||
if let Some(word) = self.data.get(word) { |
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.
Tiny Nit (feel free to ignore): this could be written as self.data.get(word).map_or(false, |word| (word & mask) != 0)
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.
map_or
etc usually makes me more confused then seeing code like this so I prefer this in general when not in a conditional or other space-constrained place.
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.
That's completely reasonable =)
src/libsyntax/attr/mod.rs
Outdated
slot.resize(idx + 1, 0); | ||
} | ||
slot[idx] |= 1 << shift; | ||
slot.insert(attr.id); |
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.
Would you mind changing this (and the other cases below) to just globals.used_attrs.lock().insert(attr.id);
? The slot
binding does not really add much to the codes readability.
Thanks for the PR, @Mark-Simulacrum! The changes to attribute tracking look good to me. However, the PR changes the interface of You could add a new type |
18f1f60
to
8c80bbc
Compare
I've split out the BitVector changes into a separate commit; instead of having |
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 |
8c80bbc
to
e6126da
Compare
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 |
e6126da
to
5110d78
Compare
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 |
5110d78
to
6185bcf
Compare
Thanks, Mark! @bors r+ |
📌 Commit 6185bcfa8b574b78a84f43363427957ee35a0743 has been approved by |
@bors r- Merge conflicts |
Rollup of 31 pull requests Successful merges: - #52332 (dead-code lint: say "constructed" for structs) - #52340 (Document From trait implementations for OsStr, OsString, CString, and CStr) - #52628 (Cleanup some rustdoc code) - #52732 (Remove unstable and deprecated APIs) - #52745 (Update clippy to latest master) - #52756 (rustc: Disallow machine applicability in foreign macros) - #52771 (Clarify thread::park semantics) - #52810 ([NLL] Don't make "fake" match variables mutable) - #52821 (pretty print for std::collections::vecdeque) - #52822 (Fix From<LocalWaker>) - #52824 (Fix -Wpessimizing-move warnings in rustllvm/PassWrapper) - #52831 (remove references to AUTHORS.txt file) - #52835 (Fix Alias intra doc ICE) - #52842 (update comment) - #52846 (Add timeout to use of `curl` in bootstrap.py.) - #52851 (Make the tool_lints actually usable) - #52853 (Improve bootstrap help on stages) - #52859 (Use Vec::extend in SmallVec::extend when applicable) - #52861 (Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and port libstd to it.) - #52867 (releases.md: fix 2 typos) - #52870 (Implement Unpin for FutureObj and LocalFutureObj) - #52876 (run-pass/const-endianness: negate before to_le()) - #52878 (Fix wrong issue number in the test name) - #52883 (Include lifetime in mutability suggestion in NLL messages) - #52904 (NLL: sort diagnostics by span) - #52905 (Fix a typo in unsize.rs) - #52907 (NLL: On "cannot move out of type" error, print original before rewrite) - #52908 (Use SetLenOnDrop in Vec::truncate()) - #52914 (Only run the sparc-abi test on sparc) - #52918 (Backport 1.27.2 release notes) - #52929 (Update compatibility note for 1.28.0 to be correct) Failed merges: - #52758 (Cleanup for librustc::session) - #52799 (Use BitVector for global sets of AttrId) r? @ghost
6185bcf
to
9bc4fbb
Compare
@bors r=michaelwoerister |
📌 Commit 9bc4fbb has been approved by |
…michaelwoerister Use BitVector for global sets of AttrId
…michaelwoerister Use BitVector for global sets of AttrId
Rollup of 15 pull requests Successful merges: - #52793 (Add test for NLL: unexpected "free region `` does not outlive" error ) - #52799 (Use BitVector for global sets of AttrId) - #52809 (Add test for unexpected region for local data ReStatic) - #52834 ([NLL] Allow conflicting borrows of promoted length zero arrays) - #52835 (Fix Alias intra doc ICE) - #52854 (fix memrchr in miri) - #52899 (tests/ui: Add missing mips{64} ignores) - #52908 (Use SetLenOnDrop in Vec::truncate()) - #52915 (Don't count MIR locals as borrowed after StorageDead when finding locals live across a yield terminator) - #52926 (rustc: Trim down the `rust_2018_idioms` lint group) - #52930 (rustc_resolve: record single-segment extern crate import resolutions.) - #52939 (Make io::Read::read_to_end consider io::Take::limit) - #52942 (Another SmallVec.extend optimization) - #52947 (1.27 actually added the `armv5te-unknown-linux-musleabi` target) - #52954 (async can begin expressions) Failed merges: r? @ghost
No description provided.