about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2021-03-24Revert "Revert stabilizing integer::BITS."Mara Bos-1/+0
2021-02-27Rollup merge of #82057 - upsuper-forks:cstr, r=davidtwco,wesleywiserDylan DPC-1/+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.
2021-02-14Replace const_cstr with cstr crateXidorn Quan-1/+0
2021-02-03Revert stabilizing integer::BITS.Mara Bos-0/+1
2021-01-31stabilize int_bits_constAshley Mannix-1/+0
2020-12-30Bump bootstrap compiler to 1.50 betaMark Rousskov-2/+1
2020-12-26stabilize min_const_genericsBastian Kauschke-1/+1
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-1/+2
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-11-20Set unaligned_references lint to deny in rustc_data_structuresTyson Nottingham-0/+1
To detect misuse of private packed field in `PackedFingerprint`.
2020-11-16compiler: fold by valueBastian Kauschke-0/+2
2020-11-15Rollup merge of #79058 - dtolnay:likelymacro, r=Mark-SimulacrumJonas Schievink-6/+6
Move likely/unlikely argument outside of invisible unsafe block The previous `likely!`/`unlikely!` macros were unsound because it permits the caller's expr to contain arbitrary unsafe code. ```rust pub fn huh() -> bool { likely!(std::ptr::read(&() as *const () as *const bool)) } ``` **Before:** compiles cleanly. **After:** ```console error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | 70 | likely!(std::ptr::read(&() as *const () as *const bool)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior ```
2020-11-14Move likely/unlikely argument outside of invisible unsafe blockDavid Tolnay-6/+6
The previous `likely!`/`unlikely!` macros were unsound because it permits the caller's expr to contain arbitrary unsafe code. pub fn huh() -> bool { likely!(std::ptr::read(&() as *const () as *const bool)) } Before: compiles cleanly. After: error[E0133]: call to unsafe function is unsafe and requires unsafe function or block | 70 | likely!(std::ptr::read(&() as *const () as *const bool)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior
2020-11-14Move Steal to rustc_data_structures.Camille GILLOT-0/+1
2020-10-25Auto merge of #77476 - tgnottingham:buffered_siphasher128, r=nnethercotebors-0/+1
perf: buffer SipHasher128 This is an attempt to improve Siphasher128 performance by buffering input. Although it reduces instruction count, I'm not confident the effect on wall times, or lack-thereof, is worth the change. --- Additional notes not reflected in source comments: * Implementation choices were guided by a combination of results from rustc-perf and micro-benchmarks, mostly the former. * ~~I tried a couple of different struct layouts that might be more cache friendly with no obvious effect.~~ Update: a particular struct layout was chosen, but it's not critical to performance. See comments in source and discussion below. * I suspect that buffering would be important to a SIMD-accelerated algorithm, but from what I've read and my own tests, SipHash does not seem very amenable to SIMD acceleration, at least by SSE.
2020-10-05Auto merge of #77171 - VFLashM:better_sso_structures, r=oli-obkbors-2/+1
Better sso structures This change greatly expands interface of MiniSet/MiniMap and renames them because they are no longer "Mini".
2020-10-03perf: buffer SipHasher128Tyson Nottingham-0/+1
2020-09-26MiniSet/MiniMap moved and renamed into SsoHashSet/SsoHashMapValerii Lashmanov-2/+1
It is a more descriptive name and with upcoming changes there will be nothing "mini" about them.
2020-09-26Remove unused #[allow(...)] statements from compiler/est31-1/+0
2020-09-25Rollup merge of #77121 - duckymirror:html-root-url, r=jyn514Jonas Schievink-1/+1
Updated html_root_url for compiler crates Closes #77103 r? @jyn514
2020-09-23/nightly/nightly-rustcErik Hofmayer-1/+1
2020-09-23Updated html_root_url for compiler cratesErik Hofmayer-1/+1
2020-09-23Move MiniSet to data_structuresAndreas Jonson-0/+1
remove the need for T to be copy from MiniSet as was done for MiniMap
2020-09-22Auto merge of #76928 - lcnr:opaque-types-cache, r=tmandrybors-5/+7
cache types during normalization partially fixes #75992 reduces the following test from 14 to 3 seconds locally. cc `@Mark-Simulacrum` would it make sense to add that test to `perf`? ```rust #![recursion_limit="2048"] #![type_length_limit="112457564"] pub async fn h0(v: &String, x: &u64) { println!("{} {}", v, x) } pub async fn h1(v: &String, x: &u64) { h0(v, x).await } pub async fn h2(v: &String, x: &u64) { h1(v, x).await } pub async fn h3(v: &String, x: &u64) { h2(v, x).await } pub async fn h4(v: &String, x: &u64) { h3(v, x).await } pub async fn h5(v: &String, x: &u64) { h4(v, x).await } pub async fn h6(v: &String, x: &u64) { h5(v, x).await } pub async fn h7(v: &String, x: &u64) { h6(v, x).await } pub async fn h8(v: &String, x: &u64) { h7(v, x).await } pub async fn h9(v: &String, x: &u64) { h8(v, x).await } pub async fn h10(v: &String, x: &u64) { h9(v, x).await } pub async fn h11(v: &String, x: &u64) { h10(v, x).await } pub async fn h12(v: &String, x: &u64) { h11(v, x).await } pub async fn h13(v: &String, x: &u64) { h12(v, x).await } pub async fn h14(v: &String, x: &u64) { h13(v, x).await } pub async fn h15(v: &String, x: &u64) { h14(v, x).await } pub async fn h16(v: &String, x: &u64) { h15(v, x).await } pub async fn h17(v: &String, x: &u64) { h16(v, x).await } pub async fn h18(v: &String, x: &u64) { h17(v, x).await } pub async fn h19(v: &String, x: &u64) { h18(v, x).await } macro_rules! async_recursive { (29, $inner:expr) => { async { async_recursive!(28, $inner) }.await }; (28, $inner:expr) => { async { async_recursive!(27, $inner) }.await }; (27, $inner:expr) => { async { async_recursive!(26, $inner) }.await }; (26, $inner:expr) => { async { async_recursive!(25, $inner) }.await }; (25, $inner:expr) => { async { async_recursive!(24, $inner) }.await }; (24, $inner:expr) => { async { async_recursive!(23, $inner) }.await }; (23, $inner:expr) => { async { async_recursive!(22, $inner) }.await }; (22, $inner:expr) => { async { async_recursive!(21, $inner) }.await }; (21, $inner:expr) => { async { async_recursive!(20, $inner) }.await }; (20, $inner:expr) => { async { async_recursive!(19, $inner) }.await }; (19, $inner:expr) => { async { async_recursive!(18, $inner) }.await }; (18, $inner:expr) => { async { async_recursive!(17, $inner) }.await }; (17, $inner:expr) => { async { async_recursive!(16, $inner) }.await }; (16, $inner:expr) => { async { async_recursive!(15, $inner) }.await }; (15, $inner:expr) => { async { async_recursive!(14, $inner) }.await }; (14, $inner:expr) => { async { async_recursive!(13, $inner) }.await }; (13, $inner:expr) => { async { async_recursive!(12, $inner) }.await }; (12, $inner:expr) => { async { async_recursive!(11, $inner) }.await }; (11, $inner:expr) => { async { async_recursive!(10, $inner) }.await }; (10, $inner:expr) => { async { async_recursive!(9, $inner) }.await }; (9, $inner:expr) => { async { async_recursive!(8, $inner) }.await }; (8, $inner:expr) => { async { async_recursive!(7, $inner) }.await }; (7, $inner:expr) => { async { async_recursive!(6, $inner) }.await }; (6, $inner:expr) => { async { async_recursive!(5, $inner) }.await }; (5, $inner:expr) => { async { async_recursive!(4, $inner) }.await }; (4, $inner:expr) => { async { async_recursive!(3, $inner) }.await }; (3, $inner:expr) => { async { async_recursive!(2, $inner) }.await }; (2, $inner:expr) => { async { async_recursive!(1, $inner) }.await }; (1, $inner:expr) => { async { async_recursive!(0, $inner) }.await }; (0, $inner:expr) => { async { h19(&String::from("owo"), &0).await; $inner }.await }; } async fn f() { async_recursive!(14, println!("hello")); } fn main() { let _ = f(); } ``` r? `@eddyb` requires a perf run.
2020-09-20Rollup merge of #76825 - lcnr:array-windows-apply, r=varkorRalf Jung-0/+1
use `array_windows` instead of `windows` in the compiler I do think these changes are beautiful, but do have to admit that using type inference for the window length can easily be confusing. This seems like a general issue with const generics, where inferring constants adds an additional complexity which users have to learn and keep in mind.
2020-09-20Rollup merge of #76821 - est31:remove_redundant_nightly_features, ↵Ralf Jung-2/+1
r=oli-obk,Mark-Simulacrum Remove redundant nightly features Removes a bunch of redundant/outdated nightly features. The first commit removes a `core_intrinsics` use for which a stable wrapper has been provided since. The second commit replaces the `const_generics` feature with `min_const_generics` which might get stabilized this year. The third commit is the result of a trial/error run of removing every single feature and then adding it back if compile failed. A bunch of unused features are the result that the third commit removes.
2020-09-20use `array_windows` instead of `windows` in the compilerBastian Kauschke-0/+1
2020-09-19cache types during normalizationBastian Kauschke-5/+7
2020-09-19Use `T::BITS` instead of `size_of::<T> * 8`.Mara Bos-0/+1
2020-09-17Remove redundant #![feature(...)] 's from compiler/est31-1/+0
2020-09-17Replace const_generics feature gate with min_const_genericsest31-1/+1
The latter is on the path to stabilization.
2020-09-04Use ops::ControlFlow in graph::iterateScott McMurray-0/+1
2020-09-01Avoid rehashing Fingerprint as a map keyJosh Stone-0/+1
This introduces a no-op `Unhasher` for map keys that are already hash- like, for example `Fingerprint` and its wrapper `DefPathHash`. For these we can directly produce the `u64` hash for maps. The first use of this is `def_path_hash_to_def_id: Option<UnhashMap<DefPathHash, DefId>>`.
2020-08-30datastructures: replace `once_cell` crate with an impl from stdmarmeladema-0/+1
2020-08-30mv compiler to compiler/mark-0/+126