about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2021-03-13Auto merge of #82891 - cjgillot:monoparent, r=petrochenkovbors-11/+55
Make def_key and HIR parenting consistent. r? `@petrochenkov`
2021-03-13Add regression testshyd-dev-0/+29
2021-03-13Auto merge of #82878 - sexxi-goose:repr_packed, r=nikomatsakisbors-0/+326
2229: Handle capturing a reference into a repr packed struct RFC 1240 states that it is unsafe to capture references into a packed-struct. This PR ensures that when a closure captures a precise path, we aren't violating this safety constraint. To acheive so we restrict the capture precision to the struct itself. An interesting edge case where we decided to restrict precision: ```rust struct Foo(String); let foo: Foo; let c = || { println!("{}", foo.0); let x = foo.0; } ``` Given how closures get desugared today, foo.0 will be moved into the closure, making the `println!`, safe. However this can be very subtle and also will be unsafe if the closure gets inline. Closes: https://github.com/rust-lang/project-rfc-2229/issues/33 r? `@nikomatsakis`
2021-03-13Eagerly generate the underscore-less name to search onMichael Howell-2/+4
Basically, it doesn't make sense to generate those things every time you search. That generates a bunch of stuff for the GC to clean up, when, if the user wanted to do another search, it would just need to re-do it again.
2021-03-13In checkGenerics and checkType, don't use Array.prototype.splice so muchMichael Howell-37/+57
Every time splice() is called, another temporary object is created. This version, which uses plain objects as a sort of Hash Bag, should only produce one temporary object each time it's called.
2021-03-12Get rid of the garbage produced by getObjectFromIdMichael Howell-7/+7
There is no reason for this function to return an object, since it is always used for getting at the name anyhow. It's used in the inner loop for some popular functions, so we want to avoid allocating in it.
2021-03-13Auto merge of #82436 - osa1:issue80258, r=nikomatsakisbors-0/+116
Allow calling *const methods on *mut values This allows `*const` methods to be called on `*mut` values. TODOs: - [x] ~~Remove debug logs~~ Done. - [x] ~~I haven't tested, but I think this currently won't work when the `self` value has type like `&&&&& *mut X` because I don't do any autoderefs when probing. To fix this the new code in `rustc_typeck::check::method::probe` needs to reuse `pick_method` somehow as I think that's the function that autoderefs.~~ This works, because autoderefs are done before calling `pick_core`, in `method_autoderef_steps`, called by `probe_op`. - [x] ~~I should probably move the new `Pick` to `pick_autorefd_method`. If not, I should move it to its own function.~~ Done. - [ ] ~~Test this with a `Pick` with `to_ptr = true` and `unsize = true`.~~ I think this case cannot happen, because we don't have any array methods with `*mut [X]` receiver. I should confirm that this is true and document this. I've placed two assertions about this. - [x] ~~Maybe give `(Mutability, bool)` a name and fields~~ I now have a `to_const_ptr` field in `Pick`. - [x] ~~Changes in `adjust_self_ty` is quite hacky. The problem is we can't deref a pointer, and even if we don't have an adjustment to get the address of a value, so to go from `*mut` to `*const` we need a special case.~~ There's still a special case for `to_const_ptr`, but I'm not sure if we can avoid this. - [ ] Figure out how `reached_raw_pointer` stuff is used. I suspect only for error messages. Fixes #80258
2021-03-12Update cargoEric Huss-0/+0
2021-03-13Rollup merge of #83059 - notriddle:config-toml-disable-minification, ↵Yuki Okushi-0/+16
r=Mark-Simulacrum Allow configuring `rustdoc --disable-minification` in config.toml This way, you can debug rustdoc's JavaScript and CSS file with normal F12 Dev Tools and you'll have useful line numbers to work with.
2021-03-13Rollup merge of #83020 - hi-rustin:rustin-patch-enum, r=lcnrYuki Okushi-0/+16
Emit the enum range assumption if the range only contains one element close https://github.com/rust-lang/rust/issues/82871
2021-03-13Rollup merge of #83012 - flip1995:clippyup, r=ManishearthYuki Okushi-12241/+15392
Update Clippy Bi-weekly Clippy sync. r? ``@Manishearth``
2021-03-12Make docs-minification default to trueMichael Howell-0/+1
2021-03-12Make def_key and HIR parenting consistent.Camille GILLOT-11/+55
2021-03-13Improve the wording for the `can't reassign` errorYuki Okushi-0/+6
2021-03-12Add a `disable-minification` option for rustdocMichael Howell-0/+15
This way, you can debug rustdoc's JavaScript and CSS file with normal F12 Dev Tools and you'll have useful line numbers to work with.
2021-03-12Auto merge of #83024 - Xanewok:update-rls, r=Dylan-DPCbors-0/+0
Update RLS Fixes #82932 r? `@ghost`
2021-03-12Clippy: HACK! Fix bootstrap errorflip1995-2/+5
This will be removed in the next sync, once beta is at 1.52. Until then this hack avoids to put `cfg(bootstrap)` into Clippy.
2021-03-12Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyupflip1995-14/+46
2021-03-12Merge commit '6ed6f1e6a1a8f414ba7e6d9b8222e7e5a1686e42' into clippyupflip1995-12241/+15389
2021-03-12Auto merge of #83030 - nikic:update-llvm, r=nagisabors-0/+36
Update llvm-project submodule Fixes #82833. Fixes #82859. Probably also `fixes` #83025. This also merges in the current upstream 12.x branch. r? `@nagisa`
2021-03-12Auto merge of #82935 - henryboisdequin:diagnostic-cleanups, r=estebankbors-4/+37
Diagnostic cleanups Follow up to #81503 Helps with #82916 (don't show note if `span` is `DUMMY_SP`)
2021-03-12Run analyses before thir-tree dumpsÖmer Sinan Ağacan-0/+14
Fixes #83048
2021-03-12Emit the enum range assumption if the range only contains one elementhi-rustin-0/+16
test: add test case make tidy happy
2021-03-12Add support for storing code model to LLVM module IRHiroki Noda-0/+18
This patch avoids undefined behavior by linking different object files. Also this would it could be propagated properly to LTO. See https://reviews.llvm.org/D52322 and https://reviews.llvm.org/D52323. This patch is based on https://github.com/rust-lang/rust/pull/74002
2021-03-12Don't show note if `span` is `DUMMY_SP`Henry Boisdequin-0/+33
2021-03-12Rollup merge of #83003 - notriddle:rustdoc-index-v3, r=GuillaumeGomezYuki Okushi-42/+74
rustdoc: tweak the search index format This essentially switches search-index.js from a "array of struct" to a "struct of array" format, like this: { "doc": "Crate documentation", "t": [ 1, 1, 2, 3, ... ], "n": [ "Something", "SomethingElse", "whatever", "do_stuff", ... ], "q": [ "a::b", "", "", "", ... ], "d": [ "A Struct That Does Something", "Another Struct", "a function", "another function", ... ], "i": [ 0, 0, 1, 1, ... ], "f": [ null, null, [], [], ... ], "p": ..., "a": ... } So `{ty: 1, name: "Something", path: "a::b", desc: "A Struct That Does Something", parent_idx: 0, search_type: null}` is the first item. This makes the uncompressed version smaller, but it really shows on the compressed version: notriddle:rust$ wc -c new-search-index1.52.0.js 2622427 new-search-index1.52.0.js notriddle:rust$ wc -c old-search-index1.52.0.js 2725046 old-search-index1.52.0.js notriddle:rust$ gzip new-search-index1.52.0.js notriddle:rust$ gzip old-search-index1.52.0.js notriddle:rust$ wc -c new-search-index1.52.0.js.gz 239385 new-search-index1.52.0.js.gz notriddle:rust$ wc -c old-search-index1.52.0.js.gz 296328 old-search-index1.52.0.js.gz That's a 4% improvement on the uncompressed version (fewer `[]`, and also changing `null` to `0` in the parent_idx list), and 20% improvement after gzipping it, thanks to putting like-typed data next to each other. Any compression algorithm based on a sliding window will probably show this kind of improvement.
2021-03-12Rollup merge of #82979 - GuillaumeGomez:run-button-pos, r=Nemo157Yuki Okushi-1/+2
Fix "run" button position in error index This isn't really a rustdoc issue but I still made the same fix in the `rustdoc.css` file (doesn't hurt). Before: ![Screenshot from 2021-03-10 16-35-49](https://user-images.githubusercontent.com/3050060/110655807-aa402800-81bf-11eb-8a88-bc979efd1697.png) After: ![Screenshot from 2021-03-10 16-40-08](https://user-images.githubusercontent.com/3050060/110655843-b4622680-81bf-11eb-8670-42975d92b4eb.png) cc ````@jyn514```` (considering this is quite a big bug and an easy fix) r? ````@Nemo157````
2021-03-12Rollup merge of #82965 - XAMPPRocky:spv-ext, r=nagisaYuki Okushi-0/+2
Add spirv extension handling in compiletest We're trying to use `compiletest` for Rust-GPU's testsuite, and ran into an issue with host specific extensions. This adds handling to fix that.
2021-03-12Rollup merge of #82950 - mockersf:slice-intra-doc-link, r=jyn514Yuki Okushi-5/+0
convert slice doc link to intra-doc links Continuing where #80189 stopped, with `core::slice`. I had an issue with two dead links in my doc when implementing `Deref<Target = [T]>` for one of my type. This means that [`binary_search_by_key`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.binary_search_by_key) was available, but not [`sort_by_key`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.sort_by_key) even though it was linked in it's doc (same issue with [`as_ptr`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_ptr) and [`as_mut_pbr`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_mut_ptr)). It becomes available if I implement `DerefMut`, as it needs an `&mut self`. <details> <summary>Code that will have dead links in its doc</summary> ```rust pub struct A; pub struct B; impl std::ops::Deref for B{ type Target = [A]; fn deref(&self) -> &Self::Target { &A } } ``` </details> I removed the link to `sort_by_key` from `binary_search_by_key` doc as I didn't find a nice way to have a live link: - `binary_search_by_key` is in `core` - `sort_by_key` is in `alloc` - intra-doc link `slice::sort_by_key` doesn't work, as `alloc` is not available when `core` is being build (the warning can't be ignored: ```error[E0710]: an unknown tool name found in scoped lint: `rustdoc::broken_intra_doc_links` ```) - keeping the link as an anchor `#method.sort_by_key` meant a dead link - an absolute link would work but doesn't feel right...
2021-03-12Rollup merge of #82571 - aDotInTheVoid:reexport-tests, r=CraftSpiderYuki Okushi-2/+114
Rustdoc Json: Add tests for Reexports, and improve jsondocck The two changes are orthognal, so you can land just one if you want, but the improved errors realy helped write the tests. Notably does not have the case from #80664, but I want to have all the ajacent cases tested before starting work on that to ensure I dont break anything. Improves #81359 cc ```@CraftSpider``` r? ```@jyn514``` ```@rustbot``` modify labels: +A-testsuite +T-rustdoc +A-rustdoc-json
2021-03-11Add tests for issues #82833 and #82859Nikita Popov-0/+36
2021-03-11Improve code by removing similar function calls and using loops instead for ↵Guillaume Gomez-17/+16
collecting iterators
2021-03-11Update doc alias ui testsGuillaume Gomez-24/+148
2021-03-11Update llvm-project submoduleNikita Popov-0/+0
2021-03-11Prevent JS error when there is no dependency or other crate documentedGuillaume Gomez-1/+5
2021-03-11Auto merge of #82806 - nikic:memcpyopt-mssa, r=nagisabors-0/+0
Enable MemorySSA in MemCpyOpt LLVM 12 ships with an implementation of MemCpyOpt which is based on MSSA instead of MDA. This implementation can eliminate memcpys across blocks, and as such fixes many (but not all) failures to eliminate redundant memcpys for Rust code. Unfortunately this was only enabled by default shortly after LLVM 12 was cut. This backports the enablement to our LLVM fork. Perf results: https://perf.rust-lang.org/compare.html?start=8fd946c63a6c3aae9788bd459d278cb2efa77099&end=0628b91ce17035fb5b6a1a99a4f2ab9ab69be7a8 There are improvements on check and debug builds, which indicate that rustc itself has become faster. For opt builds this is, on average, a very minor improvement as well, although there is one significant outlier with deep-vector-opt. This benchmark creates ~140000 zero stores, which are now coalesced into a memset slightly later, resulting in longer compile-time for intermediate passes.
2021-03-11Update RLSIgor Matuszewski-0/+0
2021-03-12fix: check before index into generated patternscsmoe-30/+22
2021-03-12add ui testcase for issue 82772csmoe-8/+52
2021-03-11Clean up handling of child processRyan Levick-19/+9
2021-03-11Enable MemorySSA-based MemCpyOptNikita Popov-0/+0
This updates the LLVM submodule to pick up a backported patch to enable MemorySSA-based MemCpyOpt, which is capable of optimizing away memcpy's across basic blocks.
2021-03-11Auto merge of #83009 - RalfJung:miri, r=RalfJungbors-17/+7
bump Miri Fixes https://github.com/rust-lang/rust/issues/82961 Cc `@rust-lang/miri` r? `@ghost`
2021-03-11Merge remote-tracking branch 'upstream/master' into rustupflip1995-14/+46
2021-03-11Auto merge of #82947 - GuillaumeGomez:fix-nojs-style-issues, r=Nemo157bors-1/+21
Fix nojs style issues There are two issues fixed here: 1. The position of "{version}" and "[src]" spans. 2. The position of attributes (on top of functions) Please note that these issues only happen if you have disabled javascript. Before: ![Screenshot from 2021-03-09 20-45-54](https://user-images.githubusercontent.com/3050060/110534652-9e048e00-811f-11eb-979e-6d85545edd65.png) After: ![Screenshot from 2021-03-09 21-01-32](https://user-images.githubusercontent.com/3050060/110534667-a1981500-811f-11eb-8a19-32f4d5381a2b.png) In the last commit, I added a test to enforce the attributes position. I need to think how to enforce it for the spans but that can comes later on. r? `@Nemo157`
2021-03-11bump MiriRalf Jung-17/+7
2021-03-10rustdoc: tweak the search index formatMichael Howell-42/+74
This essentially switches search-index.js from a "array of struct" to a "struct of array" format, like this: { "doc": "Crate documentation", "t": [ 1, 1, 2, 3, ... ], "n": [ "Something", "SomethingElse", "whatever", "do_stuff", ... ], "q": [ "a::b", "", "", "", ... ], "d": [ "A Struct That Does Something", "Another Struct", "a function", "another function", ... ], "i": [ 0, 0, 1, 1, ... ], "f": [ null, null, [], [], ... ], "p": ..., "a": ... } So `{ty: 1, name: "Something", path: "a::b", desc: "A Struct That Does Something", parent_idx: 0, search_type: null}` is the first item. This makes the uncompressed version smaller, but it really shows on the compressed version: notriddle:rust$ wc -c new-search-index1.52.0.js 2622427 new-search-index1.52.0.js notriddle:rust$ wc -c old-search-index1.52.0.js 2725046 old-search-index1.52.0.js notriddle:rust$ gzip new-search-index1.52.0.js notriddle:rust$ gzip old-search-index1.52.0.js notriddle:rust$ wc -c new-search-index1.52.0.js.gz 239385 new-search-index1.52.0.js.gz notriddle:rust$ wc -c old-search-index1.52.0.js.gz 296328 old-search-index1.52.0.js.gz notriddle:rust$ That's a 4% improvement on the uncompressed version (fewer `[]`), and 20% improvement after gzipping it, thanks to putting like-typed data next to each other. Any compression algorithm based on a sliding window will probably show this kind of improvement.
2021-03-11Validate rustc_layout_scalar_valid_range_{start,end} attributesTomasz Miąsko-0/+54
2021-03-10Improve some jsondocck errorsNixon Enraght-Moony-2/+22
2021-03-10Add reexport testsNixon Enraght-Moony-0/+92
2021-03-10Auto merge of #82960 - camelid:masked_crates, r=jyn514bors-7/+6
Remove `masked_crates` from `clean::Crate` Previously, `masked_crates` existed both on `Cache` and on `clean::Crate`. During cache population, the `clean::Crate` version was `take`n and moved to `Cache`. This change removes the version on `clean::Crate` and instead directly mutates `Cache.masked_crates` to initialize it. This has the advantage of avoiding duplication and avoiding unnecessary allocation, as well as making the flow of information through rustdoc less confusing. The one downside I see is that `clean::utils::krate()` now uses the side effect of mutating `DocContext.cache` instead of returning the data directly, but it already mutated the `Cache` for other things (e.g., `deref_trait_did`) so it's not really new behavior. Also, `clean::utils::krate()` is only called once (and is meant to only be called once since it performs expensive and potentially destructive operations) so the mutation shouldn't be an issue. Follow-up to https://github.com/rust-lang/rust/pull/82018#discussion_r584197747. cc `@jyn514`