summary refs log tree commit diff
path: root/compiler/rustc_data_structures
AgeCommit message (Collapse)AuthorLines
2023-08-08Auto merge of #114339 - ttsugriy:unsafe-utf8, r=davidtwcobors-1/+4
[rustc_data_structures][base_n][perf] Remove unnecessary utf8 check. Since all output characters taken from `BASE_64` are valid UTF8 chars there is no need to waste cycles on validation. Even though it's obviously a perf win, I've also used a [benchmark](https://gist.github.com/ttsugriy/e1e63c07927d8f31e71695a9c617bbf3) on M1 MacBook Air with following results: ``` Running benches/base_n_benchmark.rs (target/release/deps/base_n_benchmark-825fe5895b5c2693) push_str/old time: [14.670 µs 14.852 µs 15.074 µs] Found 11 outliers among 100 measurements (11.00%) 4 (4.00%) high mild 7 (7.00%) high severe push_str/new time: [12.573 µs 12.674 µs 12.801 µs] Found 11 outliers among 100 measurements (11.00%) 7 (7.00%) high mild 4 (4.00%) high severe ```
2023-08-04Rollup merge of #114418 - klensy:parking_lot, r=oli-obkMatthias Krüger-1/+1
bump parking_lot to 0.12 Bumps parking_lot to 0.12, replaces few explicit uses of parking_lot with rustc_data_structures::sync ones. <strike>cc `@oli-obk` this touches recent https://github.com/rust-lang/rust/pull/114283</strike> cc `@SparrowLii` i've checked that this builds with parallel-compiler measureme's bump https://github.com/rust-lang/measureme/pull/209 https://github.com/rust-lang/rust/blob/fcf3006e0133365ecd26894689c086387edcbecb/compiler/rustc_data_structures/src/sync.rs#L18-L34
2023-08-03bump parking_lot 0.11 to 0.12klensy-1/+1
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-08-01[rustc_data_structures][base_n][perf] Remove unnecessary utf8 check.Taras Tsugrii-1/+4
Since all output characters taken from `BASE_64` are valid UTF8 chars there is no need to waste cycles on validation. Even though it's obviously a perf win, I've also used a [benchmark](https://gist.github.com/ttsugriy/e1e63c07927d8f31e71695a9c617bbf3) on M1 MacBook Air with following results: ``` Running benches/base_n_benchmark.rs (target/release/deps/base_n_benchmark-825fe5895b5c2693) push_str/old time: [14.670 µs 14.852 µs 15.074 µs] Performance has regressed. Found 11 outliers among 100 measurements (11.00%) 4 (4.00%) high mild 7 (7.00%) high severe push_str/new time: [12.573 µs 12.674 µs 12.801 µs] Performance has regressed. Found 11 outliers among 100 measurements (11.00%) 7 (7.00%) high mild 4 (4.00%) high severe ```
2023-08-01Rollup merge of #114306 - ttsugriy:push_str, r=wesleywiserMatthias Krüger-4/+3
[rustc_data_structures][perf] Simplify base_n::push_str. This minor change removes the need to reverse resulting digits. Since reverse is O(|digit_num|) but bounded by 128, it's unlikely to be a noticeable in practice. At the same time, this code is also a 1 line shorter, so combined with tiny perf win, why not? I ran https://gist.github.com/ttsugriy/ed14860ef597ab315d4129d5f8adb191 on M1 macbook air and got a small improvement ``` Running benches/base_n_benchmark.rs (target/release/deps/base_n_benchmark-825fe5895b5c2693) push_str/old time: [14.180 µs 14.313 µs 14.462 µs] Performance has improved. Found 5 outliers among 100 measurements (5.00%) 4 (4.00%) high mild 1 (1.00%) high severe push_str/new time: [13.741 µs 13.839 µs 13.973 µs] Performance has improved. Found 8 outliers among 100 measurements (8.00%) 3 (3.00%) high mild 5 (5.00%) high severe ```
2023-08-01Rollup merge of #114283 - oli-obk:parkin_lot_rwlock, r=SparrowLiiMatthias Krüger-21/+7
Use parking lot's rwlock even without parallel-rustc Considering that this doesn't affect perf, I think we should use the simplest solution.
2023-08-01Always use parking_lot's RwLock, even without parallel compilerOli Scherer-21/+7
2023-08-01Rollup merge of #114313 - ttsugriy:sm-insert, r=petrochenkovMatthias Krüger-3/+2
[rustc_data_structures] Simplify SortedMap::insert. It looks like current usage of `swap` is aimed at achieving what `std::mem::replace` does but more concisely and idiomatically.
2023-07-31[rustc_data_structures] Simplify SortedMap::insert.Taras Tsugrii-3/+2
It looks like current usage of `swap` is aimed at achieving what `std::mem::replace` does but more concisely and idiomatically.
2023-07-31Rollup merge of #113717 - cuishuang:master, r=NilstriebMatthias Krüger-1/+1
remove repetitive words
2023-07-31[rustc_data_structures][perf] Simplify base_n::push_str.Taras Tsugrii-4/+3
This minor change removes the need to reverse resulting digits. Since reverse is O(|digit_num|) but bounded by 128, it's unlikely to be a noticeable in practice. At the same time, this code is also a 1 line shorter, so combined with tiny perf win, why not? I ran https://gist.github.com/ttsugriy/ed14860ef597ab315d4129d5f8adb191 on M1 macbook air and got a small improvement ``` Running benches/base_n_benchmark.rs (target/release/deps/base_n_benchmark-825fe5895b5c2693) push_str/old time: [14.180 µs 14.313 µs 14.462 µs] Performance has improved. Found 5 outliers among 100 measurements (5.00%) 4 (4.00%) high mild 1 (1.00%) high severe push_str/new time: [13.741 µs 13.839 µs 13.973 µs] Performance has improved. Found 8 outliers among 100 measurements (8.00%) 3 (3.00%) high mild 5 (5.00%) high severe ```
2023-07-31remove repetitive wordscui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-07-29[rustc][data_structures] Simplify binary_search_slice.Taras Tsugrii-31/+7
2023-07-23more clippy::style fixes:Matthias Krüger-5/+1
get_first single_char_add_str unnecessary_mut_passed manual_map manual_is_ascii_check
2023-07-14Introduce ExtentUnord trait for collections that can safely consume UnordItems.Michael Woerister-20/+32
2023-07-14Enable potential_query_instability lint in rustc_hir_typeck.Michael Woerister-2/+19
Fix linting errors by using FxIndex(Map|Set) and Unord(Map|Set) as appropriate.
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-3/+1
2023-07-03Upgrade to indexmap 2.0.0Josh Stone-1/+1
The new version was already added to the tree as an indirect dependency in #113046, but now our direct dependents are using it too.
2023-06-29Remove `SmallStr`.Nicholas Nethercote-89/+0
It no longer has any uses. If it's needed in the future, it can be easily reinstated. Or a crate such as `smallstr` can be used, much like we use `smallvec`.
2023-06-21Rollup merge of #112538 - ndrewxie:issue-84447-partial-1, r=compiler-errorsGuillaume Gomez-4/+4
Removed unnecessary &String -> &str, now that &String implements StableOrd as well Applied a few nits suggested by lcnr to PR #110040 (nits can be found [here](https://github.com/rust-lang/rust/pull/110040#pullrequestreview-1469452191).) Making a new PR because the old one was already merged, and given that this just applies changes that were already suggested, reviewing it should be fairly open-and-shut.
2023-06-19Make closure_saved_names_of_captured_variables a query.Camille GILLOT-1/+13
2023-06-11Applied nitsAndrew Xie-4/+4
2023-06-09Don't print Interned or PrivateZstMichael Goulet-1/+7
2023-06-08Removed stable/unstable sort arg from into_sorted_stable_ord, fixed a few ↵Andrew Xie-10/+43
misc issues, added collect to UnordItems
2023-06-05Fixed to_sorted => to_sorted_stable_ordAndrew Xie-0/+11
2023-06-04Fixed unord mistakeAndrew Xie-5/+0
2023-06-04Fixed failing test + minor cleanupAndrew Xie-0/+5
2023-06-02Update dependencies with reported vulnerabilitiesArlo Siemsen-1/+1
bumpalo 3.12.1 (yanked) * updated to 3.13.0 tokio 1.8.4 - https://rustsec.org/advisories/RUSTSEC-2023-0001 * updated to 1.28.2 remove_dir_all 0.5.3 - https://rustsec.org/advisories/RUSTSEC-2023-0018 * removed by using the standard library function in `rust-installer` instead and updating to `tempfile@3.5.0` (which also removes the dependency).
2023-05-31Auto merge of #111076 - ↵bors-3/+8
notriddle:notriddle/silence-private-dep-trait-impl-suggestions, r=cjgillot diagnostics: exclude indirect private deps from trait impl suggest Fixes #88696
2023-05-28Add some commentsJohn Kåre Alsaker-0/+4
2023-05-28Don't access self.mask with a single shardJohn Kåre Alsaker-1/+1
2023-05-28Use only one shard with a single threadJohn Kåre Alsaker-10/+34
2023-05-25rustc_data_structures: sync and atomic consistencyMichael Howell-6/+6
Co-authored-by: @lukas-code
2023-05-25rustc_metadata: specialize private_dep flag with `fetch_and`Michael Howell-13/+4
2023-05-25rustc_metadata: use configurable AtomicBool for privateness flagMichael Howell-0/+14
This switches to using a `Cell` for single-threaded rustc.
2023-05-25Rollup merge of #111875 - WaffleLapkin:defer_on_drop, r=NilstriebMatthias Krüger-10/+16
Don't leak the function that is called on drop It probably wasn't causing problems anyway, but still, a `// this leaks, please don't pass anything that owns memory` is not sustainable. I could implement a version which does not require `Option`, but it would require `unsafe`, at which point it's probably not worth it.
2023-05-24Rollup merge of #111912 - WaffleLapkin:is_some_and_in_the_compiler, ↵Manish Goregaokar-1/+1
r=petrochenkov Use `Option::is_some_and` and `Result::is_ok_and` in the compiler `.is_some_and(..)`/`.is_ok_and(..)` replace `.map_or(false, ..)` and `.map(..).unwrap_or(false)`, making the code more readable. This PR is a sibling of https://github.com/rust-lang/rust/pull/111873#issuecomment-1561316515
2023-05-24Auto merge of #111673 - cjgillot:dominator-preprocess, r=cjgillot,tmiaskobors-10/+85
Preprocess and cache dominator tree Preprocessing dominators has a very strong effect for https://github.com/rust-lang/rust/pull/111344. That pass checks that assignments dominate their uses repeatedly. Using the unprocessed dominator tree caused a quadratic runtime (number of bbs x depth of the dominator tree). This PR also caches the dominator tree and the pre-processed dominators in the MIR cfg cache. Rebase of https://github.com/rust-lang/rust/pull/107157 cc `@tmiasko`
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-1/+1
2023-05-23Don't leak the function that is called on dropMaybe Waffle-10/+16
2023-05-20Auto merge of #111596 - cjgillot:dominator-bucket, r=Mark-Simulacrumbors-8/+35
Process current bucket instead of parent's bucket when starting loop for dominators. The linked paper by Georgiadis suggests in §2.2.3 to process `bucket[w]` when beginning the loop, instead of `bucket[parent[w]]` when finishing it. In the test case, we correctly computed `idom[2] = 0` and `sdom[3] = 1`, but the algorithm returned `idom[3] = 1`, instead of the correct value 0, because of the path 0-7-2-3. This provoked LLVM ICE in https://github.com/rust-lang/rust/pull/111061#issuecomment-1546912112. LLVM checks that SSA assignments dominate uses using its own implementation of Lengauer-Tarjan, and saw case where rustc was breaking the dominance property. r? `@Mark-Simulacrum`
2023-05-18Revert spurious changes.Camille GILLOT-9/+9
2023-05-18Rollup merge of #111707 - nnethercote:rm-WorkerLocal-Vec, r=compiler-errorsDylan DPC-7/+0
Remove unused `impl<T> WorkerLocal<Vec<T>>`. cc ``@SparrowLii`` ``@Zoxc``
2023-05-18Remove unused `impl<T> WorkerLocal<Vec<T>>`.Nicholas Nethercote-7/+0
2023-05-17Merge DominatorTree and Dominators.Camille GILLOT-36/+30
2023-05-17Typo.Camille GILLOT-1/+1
2023-05-17Remove outdated comment.Camille GILLOT-2/+0
2023-05-17Preprocess dominator tree to answer queries in O(1)Tomasz Miąsko-22/+105
2023-05-17Rollup merge of #110145 - WaffleLapkin:share_slice_of_bytes, r=NilstriebDylan DPC-13/+48
Share slice of bytes r? `@Nilstrieb` cc `@noamtashma`