summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
AgeCommit message (Collapse)AuthorLines
2021-06-11Auto merge of #85885 - bjorn3:remove_box_region, r=cjgillotbors-171/+0
Don't use a generator for BoxedResolver The generator is non-trivial and requires unsafe code anyway. Using regular unsafe code without a generator is much easier to follow. Based on #85810 as it touches rustc_interface too.
2021-06-08add VecMap docsSantiago Pastorino-0/+14
2021-06-08Use impl FnMut directly as predicate typeSantiago Pastorino-4/+1
2021-06-08Explicitly pass find arguments down the predicate so coercions can applySantiago Pastorino-2/+2
2021-06-08Inline the rest of box_regionbjorn3-82/+0
2021-06-08Inline box_region macro callsbjorn3-80/+0
2021-06-08Simplify box_region macrosbjorn3-26/+17
2021-06-08Add VecMap::get_by(FnMut -> bool)Santiago Pastorino-0/+7
2021-06-07Add VecMap to rustc_data_structuresSantiago Pastorino-0/+186
2021-06-06Rollup merge of #85436 - tamird:save-clone, r=estebankYuki Okushi-3/+2
Avoid cloning cache key r? `@estebank`
2021-06-04Unify parallel and non-parallel APIsJoshua Nelson-2/+54
It's confusing for these to be different, even if some of the methods are unused.
2021-06-04Remove unused code from `rustc_data_structures::sync`Joshua Nelson-110/+0
Found using https://github.com/est31/warnalyzer.
2021-06-04Rollup merge of #85850 - bjorn3:less_feature_gates, r=jyn514Yuki Okushi-21/+1
Remove unused feature gates The first commit removes a usage of a feature gate, but I don't expect it to be controversial as the feature gate was only used to workaround a limitation of rust in the past. (closures never being `Clone`) The second commit uses `#[allow_internal_unstable]` to avoid leaking the `trusted_step` feature gate usage from inside the index newtype macro. It didn't work for the `min_specialization` feature gate though. The third commit removes (almost) all feature gates from the compiler that weren't used anyway.
2021-06-02Auto merge of #85892 - tmiasko:i, r=oli-obkbors-0/+10
Miscellaneous inlining improvements
2021-06-02Miscellaneous inlining improvementsTomasz Miąsko-0/+10
2021-06-01Remove StableVec.Camille GILLOT-32/+0
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-0/+32
2021-05-31Remove unused feature gatesbjorn3-1/+0
2021-05-31Remove unnecessary unboxed_closures feature usagebjorn3-20/+1
It has been possible to clone closures for a while now
2021-05-30Remove StableVec.Camille GILLOT-32/+0
2021-05-25Don't panic when failing to initialize incremental directory.Eric Huss-0/+13
2021-05-18Simplify `map | unwrap_or` to `map_or`Tamir Duberstein-2/+1
2021-05-18Avoid cloning cache keyTamir Duberstein-2/+2
2021-05-04Only compute Obligation `cache_key` once in `register_obligation_at`Esteban Küber-3/+4
2021-04-21Use arrayvec 0.7, drop smallvec 0.6Jubilee Young-8/+5
With the arrival of min const generics, many alt-vec libraries have updated to use it in some way and arrayvec is no exception. Use the latest with minor refactoring. Also, rustc_workspace_hack is the only user of smallvec 0.6 in the entire tree, so drop it.
2021-04-08Fix outdated crate names in compiler docspierwill-1/+1
Changes `librustc_X` to `rustc_X`, only in documentation comments. Plain code comments are left unchanged. Also fix incorrect file paths.
2021-04-06Auto merge of #83821 - camelid:improve-thinvec, r=petrochenkovbors-0/+91
Add `FromIterator` and `IntoIterator` impls for `ThinVec` These should make using `ThinVec` feel much more like using `Vec`. They will allow users of `Vec` to switch to `ThinVec` while continuing to use `collect()`, `for` loops, and other parts of the iterator API. I don't know if there were use cases before for using the iterator API with `ThinVec`, but I would like to start using `ThinVec` in rustdoc, and having it conform to the iterator API would make the transition *a lot* easier. I added a `FromIterator` impl, an `IntoIterator` impl that yields owned elements, and `IntoIterator` impls that yield immutable or mutable references to elements. I also added some unit tests for `ThinVec`.
2021-04-05Add `FromIterator` and `IntoIterator` impls for `ThinVec`Camelid-0/+91
These should make using `ThinVec` feel much more like using `Vec`. They will allow users of `Vec` to switch to `ThinVec` while continuing to use `collect()`, `for` loops, and other parts of the iterator API. I don't know if there were use cases before for using the iterator API with `ThinVec`, but I would like to start using `ThinVec` in rustdoc, and having it conform to the iterator API would make the transition *a lot* easier. I added a `FromIterator` impl, an `IntoIterator` impl that yields owned elements, and `IntoIterator` impls that yield immutable or mutable references to elements. I also added some unit tests for `ThinVec`.
2021-04-03Auto merge of #83682 - bjorn3:mmap_wrapper, r=cjgillotbors-0/+48
Add an Mmap wrapper to rustc_data_structures This wrapper implements StableAddress and falls back to directly reading the file on wasm32. Taken from #83640, which I will close due to the perf regression.
2021-04-03Add safety comment to StableAddress impl for Mmapbjorn3-0/+4
2021-03-31Inline a few methodsbjorn3-0/+3
2021-03-30Add an Mmap wrapper to rustc_data_structuresbjorn3-0/+41
This wrapper implements StableAddress and falls back to directly reading the file on wasm32
2021-03-29Revert changes to sync data structuresJoshua Nelson-0/+110
There isn't currently a good reviewer for these, and I don't want to remove things that will just be added again. I plan to make a separate PR for these changes so the rest of the cleanup can land.
2021-03-27Address review commentsJoshua Nelson-2/+0
- Add back `HirIdVec`, with a comment that it will soon be used. - Add back `*_region` functions, with a comment they may soon be used. - Remove `-Z borrowck_stats` completely. It didn't do anything. - Remove `make_nop` completely. - Add back `current_loc`, which is used by an out-of-tree tool. - Fix style nits - Remove `AtomicCell` with `cfg(parallel_compiler)` for consistency.
2021-03-27Remove (lots of) dead codeJoshua Nelson-123/+0
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-26Auto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillotbors-8/+28
Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code The current `read_raw_bytes` method requires using `MaybeUninit` and `unsafe`. I don't think this is necessary. Let's see if a safe interface has any performance drawbacks. This is a followup to #83273 and will make it easier to rebase #82183. r? `@cjgillot`
2021-03-25Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code.Michael Woerister-8/+28
2021-03-24Revert "Revert stabilizing integer::BITS."Mara Bos-1/+0
2021-03-22Auto merge of #83273 - cjgillot:endecode, r=michaelwoeristerbors-56/+10
Simplify encoder and decoder Extracted from https://github.com/rust-lang/rust/pull/83036 and https://github.com/rust-lang/rust/pull/82780.
2021-03-19Remove FingerprintEncoder/Decoder.Camille GILLOT-56/+10
2021-03-19Move raw bytes handling to Encoder/Decoder.Camille GILLOT-2/+2
2021-03-19Rollup merge of #83197 - jyn514:cfg-test-dead-code, r=joshtriplettDylan DPC-20/+23
Move some test-only code to test files Split out from https://github.com/rust-lang/rust/pull/83185.
2021-03-17Move some test-only code to test filesJoshua Nelson-20/+23
This also relaxes the bounds on some structs and moves them to the impl block instead.
2021-03-13Auto merge of #83064 - cjgillot:fhash, r=jackh726bors-0/+1
Tweaks to stable hashing
2021-03-11Add inlining.Camille GILLOT-0/+1
2021-03-11Auto merge of #82641 - camelid:lang-item-docs, r=jyn514bors-4/+4
Improve lang item generated docs cc https://rust-lang.zulipchat.com/#narrow/stream/146229-wg-secure-code/topic/Is.20.60core.60.20part.20of.20the.20compiler.3F/near/226738260 r? `@jyn514`
2021-03-07Auto merge of #81635 - michaelwoerister:structured_def_path_hash, r=pnkfelixbors-3/+25
Let a portion of DefPathHash uniquely identify the DefPath's crate. This allows to directly map from a `DefPathHash` to the crate it originates from, without constructing side tables to do that mapping -- something that is useful for incremental compilation where we deal with `DefPathHash` instead of `DefId` a lot. It also allows to reliably and cheaply check for `DefPathHash` collisions which allows the compiler to gracefully abort compilation instead of running into a subsequent ICE at some random place in the code. The following new piece of documentation describes the most interesting aspects of the changes: ```rust /// A `DefPathHash` is a fixed-size representation of a `DefPath` that is /// stable across crate and compilation session boundaries. It consists of two /// separate 64-bit hashes. The first uniquely identifies the crate this /// `DefPathHash` originates from (see [StableCrateId]), and the second /// uniquely identifies the corresponding `DefPath` within that crate. Together /// they form a unique identifier within an entire crate graph. /// /// There is a very small chance of hash collisions, which would mean that two /// different `DefPath`s map to the same `DefPathHash`. Proceeding compilation /// with such a hash collision would very probably lead to an ICE and, in the /// worst case, to a silent mis-compilation. The compiler therefore actively /// and exhaustively checks for such hash collisions and aborts compilation if /// it finds one. /// /// `DefPathHash` uses 64-bit hashes for both the crate-id part and the /// crate-internal part, even though it is likely that there are many more /// `LocalDefId`s in a single crate than there are individual crates in a crate /// graph. Since we use the same number of bits in both cases, the collision /// probability for the crate-local part will be quite a bit higher (though /// still very small). /// /// This imbalance is not by accident: A hash collision in the /// crate-local part of a `DefPathHash` will be detected and reported while /// compiling the crate in question. Such a collision does not depend on /// outside factors and can be easily fixed by the crate maintainer (e.g. by /// renaming the item in question or by bumping the crate version in a harmless /// way). /// /// A collision between crate-id hashes on the other hand is harder to fix /// because it depends on the set of crates in the entire crate graph of a /// compilation session. Again, using the same crate with a different version /// number would fix the issue with a high probability -- but that might be /// easier said then done if the crates in questions are dependencies of /// third-party crates. /// /// That being said, given a high quality hash function, the collision /// probabilities in question are very small. For example, for a big crate like /// `rustc_middle` (with ~50000 `LocalDefId`s as of the time of writing) there /// is a probability of roughly 1 in 14,750,000,000 of a crate-internal /// collision occurring. For a big crate graph with 1000 crates in it, there is /// a probability of 1 in 36,890,000,000,000 of a `StableCrateId` collision. ``` Given the probabilities involved I hope that no one will ever actually see the error messages. Nonetheless, I'd be glad about some feedback on how to improve them. Should we create a GH issue describing the problem and possible solutions to point to? Or a page in the rustc book? r? `@pnkfelix` (feel free to re-assign)
2021-02-28Allow variant attributes in `enum_from_u32!`Camelid-4/+4
2021-02-27Rollup merge of #82057 - upsuper-forks:cstr, r=davidtwco,wesleywiserDylan DPC-31/+0
Replace const_cstr with cstr crate This PR replaces the `const_cstr` macro inside `rustc_data_structures` with `cstr` macro from [cstr](https://crates.io/crates/cstr) crate. The two macros basically serve the same purpose, which is to generate `&'static CStr` from a string literal. `cstr` is better because it validates the literal at compile time, while the existing `const_cstr` does it at runtime when `debug_assertions` is enabled. In addition, the value `cstr` generates can be used in constant context (which is seemingly not needed anywhere currently, though).
2021-02-20Update the bootstrap compilerJoshua Nelson-1/+0
Note this does not change `core::derive` since it was merged after the beta bump.