about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2023-02-13Use is_str instead of string kind comparisonMichael Goulet-12/+11
2023-02-13Auto merge of #107989 - matthiaskrgr:rollup-jklrd5g, r=matthiaskrgrbors-564/+626
Rollup of 6 pull requests Successful merges: - #107340 (rustdoc: merge doctest tooltip with notable traits tooltip) - #107838 (Introduce `-Zterminal-urls` to use OSC8 for error codes) - #107922 (Print disk usage in PGO CI script) - #107931 (Intern span when length is MAX_LEN with parent.) - #107935 (rustc_ast: Merge impls and reorder methods for attributes and meta items) - #107986 (layout: deal with placeholders, ICE on bound types) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-13Rollup merge of #107986 - lcnr:layout-placeholder, r=petrochenkovMatthias Krüger-5/+2
layout: deal with placeholders, ICE on bound types A placeholder type is the same as a param as they represent "this could be any type". A bound type represents a type inside of a `for<T>` or `exists<T>`. When entering a forall or exists `T` should be instantiated as a existential (inference var) or universal (placeholder). You should never observe a bound variable without its binder.
2023-02-13Rollup merge of #107935 - petrochenkov:attreorder, r=michaelwoeristerMatthias Krüger-311/+307
rustc_ast: Merge impls and reorder methods for attributes and meta items Merge `impl` blocks for the same types, change order of methods to be more predictable and consistent between impls. No functional changes. Follow up to https://github.com/rust-lang/rust/pull/107569.
2023-02-13Rollup merge of #107931 - cjgillot:issue-107353, r=WaffleLapkinMatthias Krüger-1/+15
Intern span when length is MAX_LEN with parent. Fixes https://github.com/rust-lang/rust/issues/107353
2023-02-13Rollup merge of #107922 - Kobzol:ci-print-disk-size, r=Mark-SimulacrumMatthias Krüger-2/+17
Print disk usage in PGO CI script To diagnose issues like https://github.com/rust-lang/rust/pull/94857#issuecomment-1426648675.
2023-02-13Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisaMatthias Krüger-9/+99
Introduce `-Zterminal-urls` to use OSC8 for error codes Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-13Rollup merge of #107340 - notriddle:notriddle/simplify-doctest-tooltip, ↵Matthias Krüger-236/+186
r=GuillaumeGomez rustdoc: merge doctest tooltip with notable traits tooltip Fixes https://discord.com/channels/442252698964721669/443150878111694848/1066420140167680000 <details><summary>a user report where the tooltip arrow overlaps the text</summary> ![](https://cdn.discordapp.com/attachments/443150878111694848/1066420139530145812/this-example-is-not-tested-busted-rendering.png) </details> Fixes #91100 Preview: <https://notriddle.com/notriddle-rustdoc-demos/simplify-doctest-tooltip/std/vec/struct.Vec.html#indexing> Screenshot: ![image](https://user-images.githubusercontent.com/1593513/214975516-72667632-4609-49fa-8c37-e8d2ba1ba7dc.png)
2023-02-13Auto merge of #107634 - scottmcm:array-drain, r=thomccbors-142/+395
Improve the `array::map` codegen The `map` method on arrays [is documented as sometimes performing poorly](https://doc.rust-lang.org/std/primitive.array.html#note-on-performance-and-stack-usage), and after [a question on URLO](https://users.rust-lang.org/t/try-trait-residual-o-trait-and-try-collect-into-array/88510?u=scottmcm) prompted me to take another look at the core [`try_collect_into_array`](https://github.com/rust-lang/rust/blob/7c46fb2111936ad21a8e3aa41e9128752357f5d8/library/core/src/array/mod.rs#L865-L912) function, I had some ideas that ended up working better than I'd expected. There's three main ideas in here, split over three commits: 1. Don't use `array::IntoIter` when we can avoid it, since that seems to not get SRoA'd, meaning that every step writes things like loop counters into the stack unnecessarily 2. Don't return arrays in `Result`s unnecessarily, as that doesn't seem to optimize away even with `unwrap_unchecked` (perhaps because it needs to get moved into a new LLVM type to account for the discriminant) 3. Don't distract LLVM with all the `Option` dances when we know for sure we have enough items (like in `map` and `zip`). This one's a larger commit as to do it I ended up adding a new `pub(crate)` trait, but hopefully those changes are still straight-forward. (No libs-api changes; everything should be completely implementation-detail-internal.) It's still not completely fixed -- I think it needs pcwalton's `memcpy` optimizations still (#103830) to get further -- but this seems to go much better than before. And the remaining `memcpy`s are just `transmute`-equivalent (`[T; N] -> ManuallyDrop<[T; N]>` and `[MaybeUninit<T>; N] -> [T; N]`), so hopefully those will be easier to remove with LLVM16 than the previous subobject copies 🤞 r? `@thomcc` As a simple example, this test ```rust pub fn long_integer_map(x: [u32; 64]) -> [u32; 64] { x.map(|x| 13 * x + 7) } ``` On nightly <https://rust.godbolt.org/z/xK7548TGj> takes `sub rsp, 808` ```llvm start: %array.i.i.i.i = alloca [64 x i32], align 4 %_3.sroa.5.i.i.i = alloca [65 x i32], align 4 %_5.i = alloca %"core::iter::adapters::map::Map<core::array::iter::IntoIter<u32, 64>, [closure@/app/example.rs:2:11: 2:14]>", align 8 ``` (and yes, that's a 6**5**-element array `alloca` despite 6**4**-element input and output) But with this PR it's only `sub rsp, 520` ```llvm start: %array.i.i.i.i.i.i = alloca [64 x i32], align 4 %array1.i.i.i = alloca %"core::mem::manually_drop::ManuallyDrop<[u32; 64]>", align 4 ``` Similarly, the loop it emits on nightly is scalar-only and horrifying ```nasm .LBB0_1: mov esi, 64 mov edi, 0 cmp rdx, 64 je .LBB0_3 lea rsi, [rdx + 1] mov qword ptr [rsp + 784], rsi mov r8d, dword ptr [rsp + 4*rdx + 528] mov edi, 1 lea edx, [r8 + 2*r8] lea r8d, [r8 + 4*rdx] add r8d, 7 .LBB0_3: test edi, edi je .LBB0_11 mov dword ptr [rsp + 4*rcx + 272], r8d cmp rsi, 64 jne .LBB0_6 xor r8d, r8d mov edx, 64 test r8d, r8d jne .LBB0_8 jmp .LBB0_11 .LBB0_6: lea rdx, [rsi + 1] mov qword ptr [rsp + 784], rdx mov edi, dword ptr [rsp + 4*rsi + 528] mov r8d, 1 lea esi, [rdi + 2*rdi] lea edi, [rdi + 4*rsi] add edi, 7 test r8d, r8d je .LBB0_11 .LBB0_8: mov dword ptr [rsp + 4*rcx + 276], edi add rcx, 2 cmp rcx, 64 jne .LBB0_1 ``` whereas with this PR it's unrolled and vectorized ```nasm vpmulld ymm1, ymm0, ymmword ptr [rsp + 64] vpaddd ymm1, ymm1, ymm2 vmovdqu ymmword ptr [rsp + 328], ymm1 vpmulld ymm1, ymm0, ymmword ptr [rsp + 96] vpaddd ymm1, ymm1, ymm2 vmovdqu ymmword ptr [rsp + 360], ymm1 ``` (though sadly still stack-to-stack)
2023-02-13layout: deal with placeholders, ICE on bound typeslcnr-5/+2
a placeholder type is the same as a param as they represent "this could be any type". A bound type represents a type inside of a `for<T>` or `exists<T>`. When entering a forall or exists `T` should be instantiated as a existential (inference var) or universal (placeholder). You should never observe a bound variable without its binder.
2023-02-13Auto merge of #107980 - Dylan-DPC:rollup-u4b19bl, r=Dylan-DPCbors-175/+152
Rollup of 7 pull requests Successful merges: - #107654 (reword descriptions of the deprecated int modules) - #107915 (Add `array::map` benchmarks) - #107961 (Avoid copy-pasting the `ilog` panic string in a bunch of places) - #107962 (Add a doc note about why `Chain` is not `ExactSizeIterator`) - #107966 (Update browser-ui-test version to 0.14.3) - #107970 (Hermit: Remove floor symbol) - #107973 (Fix unintentional UB in SIMD tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-13Rollup merge of #107973 - saethlin:fix-simd-test-ub, r=workingjubileeDylan DPC-121/+60
Fix unintentional UB in SIMD tests r? `@workingjubilee`
2023-02-13Rollup merge of #107970 - hermitcore:hermit-rm-floor, r=thomccDylan DPC-5/+0
Hermit: Remove floor symbol This symbol should be provided by Hermit. It was introduced in 2019 (https://github.com/rust-lang/rust/pull/65167). Since 2020, Hermit provides these math functions on its own (https://github.com/hermitcore/rusty-hermit/pull/37). I think moving this to Hermit was merely an oversight. Related: * https://github.com/hermitcore/libhermit-rs/pull/654 * https://github.com/hermitcore/rusty-hermit/pull/406 CC: `@stlankes`
2023-02-13Rollup merge of #107966 - GuillaumeGomez:update-browser-ui-test, r=notriddleDylan DPC-1/+1
Update browser-ui-test version to 0.14.3 It brings a few fixes to the `NEAR` checks. The PR for it in [here](https://github.com/GuillaumeGomez/browser-UI-test/pull/436). r? `@notriddle`
2023-02-13Rollup merge of #107962 - scottmcm:why-not-exact, r=Mark-SimulacrumDylan DPC-0/+21
Add a doc note about why `Chain` is not `ExactSizeIterator` Inspired by <https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Why.20isn't.20Chain.3CA.2C.20B.3E.20an.20ExactSizeIterator.3F/near/327395874>.
2023-02-13Rollup merge of #107961 - scottmcm:unify-ilog-panics, r=Mark-SimulacrumDylan DPC-12/+38
Avoid copy-pasting the `ilog` panic string in a bunch of places I also ended up changing the implementations to `if let` because it doesn't work to ```rust self.checked_ilog2().unwrap_or_else(panic_for_nonpositive_argument) ``` due to the `!`. But as a bonus that meant I could remove the `rustc_allow_const_fn_unstable` too.
2023-02-13Rollup merge of #107915 - JulianKnodt:array_benches, r=Mark-SimulacrumDylan DPC-0/+20
Add `array::map` benchmarks Since there were no previous benchmarks for `array::map`, and it is known to have mediocre/poor performance, add some simple benchmarks. These benchmarks vary the length of the array and size of each item.
2023-02-13Rollup merge of #107654 - pitaj:reword-integral-modules, r=thomccDylan DPC-36/+12
reword descriptions of the deprecated int modules Based on recommendation by `@est31` here: https://github.com/rust-lang/rust/pull/107587#issuecomment-1416131590 This is meant to make it more clear, when looking at the `std` or `core` docs, that these are deprecated modules - not deprecated integer types (a common misunderstanding). Before: ![image](https://user-images.githubusercontent.com/803701/216733011-fabc22e1-4e77-4a47-96e3-a765ac4690b6.png) After: ![image](https://user-images.githubusercontent.com/803701/216733660-02071ced-883d-4ab5-8c0a-d28547d1d5db.png)
2023-02-13Auto merge of #107191 - Voultapher:reverse-timsort-scan-direction, r=thomccbors-220/+271
Reverse Timsort scan direction Another PR in the series of stable sort improvements. Best reviewed by looking at the individual commits. The main perf gain here is for fully ascending (sorted) or reversed inputs for cheap to compare types such as `u64`, these see a ~1.5x speedup. ![timsort_evo2_hot_u64_10k](https://user-images.githubusercontent.com/6864584/213913351-cfdf452f-a37c-4bc6-a811-d10c60e66eca.png) ![timsort_evo2_hot_string_10k](https://user-images.githubusercontent.com/6864584/213913354-d9cc395a-2b48-4f54-b687-09174b9e35ce.png) Types such as string with indirect pre-fetching see only minor changes. Further speedups are planned in future PRs so, I wouldn't spend too much time for benchmarks here.
2023-02-12Fix unintentional UB in SIMD testsBen Kimock-121/+60
2023-02-13Auto merge of #107869 - nnethercote:reduce-interning, r=compiler-errorsbors-114/+173
Reduce interning r? `@compiler-errors`
2023-02-12Hermit: Remove floor symbolMartin Kröning-5/+0
This symbol should be provided by Hermit.
2023-02-13Avoid interning empty tuples.Nicholas Nethercote-2/+2
2023-02-13Reduce direct `mk_ty` usage.Nicholas Nethercote-82/+92
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
2023-02-13Pre-intern some commonly used type variables.Nicholas Nethercote-30/+79
This requires some rearrangement of plumbing, such as adding `mk_fresh_{,int_,float_}ty` and removing `mk_ty_infer`.
2023-02-12Auto merge of #107967 - matthiaskrgr:rollup-7wvbla5, r=matthiaskrgrbors-32/+65
Rollup of 8 pull requests Successful merges: - #107748 (refer to new home) - #107842 (Patch `build/rustfmt/lib/*.so` for NixOS) - #107930 (Improve JS function itemTypeFromName code a bit) - #107934 (rustdoc: account for intra-doc links in `<meta name="description">`) - #107943 (Document `PointerLike`) - #107954 (avoid mixing accesses of ptrs derived from a mutable ref and parent ptrs) - #107955 (fix UB in ancient test) - #107964 (rustdoc: use tighter line height in h1 and h2) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-12Rollup merge of #107964 - notriddle:notriddle/title-line-height, ↵Matthias Krüger-11/+19
r=GuillaumeGomez rustdoc: use tighter line height in h1 and h2 This keeps the line height for body text the same, as required by WCAG, but for headers, it makes sense to have wrapped lines be a bit tighter packed. ## Before ![image](https://user-images.githubusercontent.com/1593513/218332683-88a02467-7811-4e6b-81f8-67dded691465.png) ## After ![image](https://user-images.githubusercontent.com/1593513/218332698-a1b2a265-0658-4306-8473-b835f663172d.png)
2023-02-12Rollup merge of #107955 - RalfJung:ancient-ub, r=jyn514Matthias Krüger-4/+4
fix UB in ancient test This seems to go back all the way to the [original version of this test](https://github.com/rust-lang/rust/blob/b9aa9def858cfc66d411972b10ce3d98479acd78/src/test/run-pass/regions-mock-trans.rs) from ten years ago... ``@nikomatsakis`` trip down memory lane? ;) Clearly deallocation is a form of mutation so doing it to a (pointer derived from a) shared reference cannot be legal. Let's use mutable references instead.
2023-02-12Rollup merge of #107954 - RalfJung:tree-borrows-fix, r=m-ou-seMatthias Krüger-3/+3
avoid mixing accesses of ptrs derived from a mutable ref and parent ptrs ``@Vanille-N`` is working on a successor for Stacked Borrows. It will mostly accept strictly more code than Stacked Borrows did, with one exception: the following pattern no longer works. ```rust let mut root = 6u8; let mref = &mut root; let ptr = mref as *mut u8; *ptr = 0; // Write assert_eq!(root, 0); // Parent Read *ptr = 0; // Attempted Write ``` This worked in Stacked Borrows kind of by accident: when doing the "parent read", under SB we Disable `mref`, but the raw ptrs derived from it remain usable. The fact that we can still use the "children" of a reference that is no longer usable is quite nasty and leads to some undesirable effects (in particular it is the major blocker for resolving https://github.com/rust-lang/unsafe-code-guidelines/issues/257). So in Tree Borrows we no longer do that; instead, reading from `root` makes `mref` and all its children read-only. Due to other improvements in Tree Borrows, the entire Miri test suite still passes with this new behavior, and even the entire libcore and liballoc test suite, except for these 2 cases this PR fixes. Both of these involve code where the programmer wrote `&mut` but then used pointers derived from that reference in ways that alias with the parent pointer, which arguably is violating uniqueness. They are fixed by properly using raw pointers throughout.
2023-02-12Rollup merge of #107943 - compiler-errors:document-pointer-like, r=jyn514Matthias Krüger-1/+4
Document `PointerLike` I forgot to document this, and even though it's currently more of an implementation detail, the old doc was kinda embarrassing :sweat_smile:
2023-02-12Rollup merge of #107934 - ↵Matthias Krüger-4/+22
notriddle:notriddle/intra-doc-link-meta-description, r=camelid,GuillaumeGomez rustdoc: account for intra-doc links in `<meta name="description">` Similar to #86451, but for the SEO descriptions instead of the search descriptions.
2023-02-12Rollup merge of #107930 - GuillaumeGomez:js-func-improvement, r=notriddleMatthias Krüger-6/+4
Improve JS function itemTypeFromName code a bit Very small code improvement replacing a `for` loop with `findIndex` method. r? ````@notriddle````
2023-02-12Rollup merge of #107842 - fee1-dead-contrib:patch_rustfmt_nixos, ↵Matthias Krüger-2/+8
r=Mark-Simulacrum Patch `build/rustfmt/lib/*.so` for NixOS fixes #107676.
2023-02-12Rollup merge of #107748 - tshepang:renamed, r=cuviperMatthias Krüger-1/+1
refer to new home The module has since been made its own crate... see 2d75a339ca9e7cd11338b165311927e6eb73cca4.
2023-02-12Update browser-ui-test version to 0.14.3Guillaume Gomez-1/+1
2023-02-12rustdoc: use tighter line height in h1 and h2Michael Howell-11/+19
2023-02-12Add a doc note about why `Chain` is not `ExactSizeIterator`Scott McMurray-0/+21
2023-02-12Auto merge of #107643 - Zoxc:single-cache, r=cjgillotbors-4/+50
Create a single value cache for the () query key Since queries using `()` as the key can only store a single value, specialize for that case. This looks like a minor performance improvement: <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check</td><td align="right">1.8477s</td><td align="right">1.8415s</td><td align="right"> -0.33%</td></tr><tr><td>🟣 <b>hyper</b>:check</td><td align="right">0.2666s</td><td align="right">0.2655s</td><td align="right"> -0.40%</td></tr><tr><td>🟣 <b>syntex_syntax</b>:check</td><td align="right">6.3943s</td><td align="right">6.3686s</td><td align="right"> -0.40%</td></tr><tr><td>🟣 <b>syn</b>:check</td><td align="right">1.6413s</td><td align="right">1.6345s</td><td align="right"> -0.42%</td></tr><tr><td>🟣 <b>regex</b>:check</td><td align="right">1.0337s</td><td align="right">1.0313s</td><td align="right"> -0.24%</td></tr><tr><td>Total</td><td align="right">11.1836s</td><td align="right">11.1414s</td><td align="right"> -0.38%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9964s</td><td align="right"> -0.36%</td></tr></table>
2023-02-12fix UB in ancient testRalf Jung-4/+4
2023-02-12Auto merge of #107933 - petrochenkov:rmdlc, r=GuillaumeGomezbors-15/+2
rustdoc: Remove cache for preprocessed markdown links It's quite possible that it's no longer useful after https://github.com/rust-lang/rust/pull/94857 is merged.
2023-02-12avoid mixing accesses of ptrs derived from a mutable ref and parent ptrsRalf Jung-3/+3
2023-02-12Auto merge of #105671 - lukas-code:depreciate-char, r=scottmcmbors-45/+21
Use associated items of `char` instead of freestanding items in `core::char` The associated functions and constants on `char` have been stable since 1.52 and the freestanding items have soft-deprecated since 1.62 (https://github.com/rust-lang/rust/pull/95566). This PR ~~marks them as "deprecated in future", similar to the integer and floating point modules (`core::{i32, f32}` etc)~~ replaces all uses of `core::char::*` with `char::*` to prepare for future deprecation of `core::char::*`.
2023-02-12Auto merge of #105601 - BelovDV:change-rlib-with-not-stable, r=petrochenkovbors-127/+146
Enable new rlib in non stable cases If bundled static library uses cfg (unstable) or whole-archive (wasn't supported) bundled libs are packed even without packed_bundled_libs. r? `@petrochenkov`
2023-02-12Auto merge of #107894 - Voultapher:improve-heapsort-fallback, r=scottmcmbors-2/+5
Speedup heapsort by 1.5x by making it branchless `slice::sort_unstable` will fall back to heapsort if it repeatedly fails to find a good pivot. By making the core child update code branchless it is much faster. On Zen3 sorting 10k `u64` and forcing the sort to pick heapsort, results in: 455us -> 278us
2023-02-12Document PointerLikeMichael Goulet-1/+4
2023-02-11Auto merge of #106677 - tbu-:pr_less_doc_hidden_pub, r=scottmcmbors-132/+48
Remove a couple of `#[doc(hidden)] pub fn` and their `#[feature]` gates
2023-02-11rustdoc: account for intra-doc links in `<meta name="description">`Michael Howell-4/+22
2023-02-11Create a single value cache for the () query keyJohn Kåre Alsaker-4/+50
2023-02-11Auto merge of #107851 - cjgillot:sroa-const, r=oli-obkbors-0/+57
Put deaggregated statements after original constant. Fixes https://github.com/rust-lang/rust/issues/107818
2023-02-11rustc_ast: Merge impls and reorder methods for attributes and meta itemsVadim Petrochenkov-311/+307