Commit graph

138575 commits

Author SHA1 Message Date
Yuki Okushi
56ae3fb2f0
Rollup merge of #81706 - SkiFire13:document-binaryheap-unsafe, r=Mark-Simulacrum
Document BinaryHeap unsafe functions

`BinaryHeap` contains some private safe functions but that are actually unsafe to call. This PR marks them `unsafe` and documents all the `unsafe` function calls inside them.

While doing this I might also have found a bug: some "SAFETY" comments in `sift_down_range` and `sift_down_to_bottom` are valid only if you assume that `child` doesn't overflow. However it may overflow if `end > isize::MAX` which can be true for ZSTs (but I think only for them). I guess the easiest fix would be to skip any sifting if `mem::size_of::<T> == 0`.

Probably conflicts with #81127 but solving the eventual merge conflict should be pretty easy.
2021-02-21 15:26:40 +09:00
Yuki Okushi
3219a100fa
Rollup merge of #81300 - ssomers:btree_cleanup_leak_tests, r=Mark-Simulacrum
BTree: share panicky test code & test panic during clear, clone

Bases almost all tests of panic on the same, richer definition, and extends it to cloning to test panic during clone.

r? ```@Mark-Simulacrum```
2021-02-21 15:26:36 +09:00
bors
a31c16212d Auto merge of #82253 - RalfJung:miri, r=RalfJung
update Miri

Fixes Miri breakage (no issue was created as the toolstate tracking is currently broken: https://github.com/rust-lang/rust/issues/82254)
2021-02-21 00:19:45 +00:00
bors
d2b38d6b3c Auto merge of #82341 - GuillaumeGomez:rollup-t7y7tyg, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #80595 (`impl PartialEq<Punct> for char`; symmetry for #78636)
 - #81991 (Fix panic in 'remove semicolon' when types are not local)
 - #82176 (fix MIR fn-ptr pretty-printing)
 - #82244 (Keep consistency in example for Stdin StdinLock)
 - #82260 (rustc: Show ``@path`` usage in stable)
 - #82316 (Fix minor mistake in LTO docs.)
 - #82332 (Don't generate src link on dummy spans)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-02-20 21:38:53 +00:00
Giacomo Stevanato
3ec1a28418 Add FIXME for safety comments that are invalid when T is a ZST 2021-02-20 15:44:17 -05:00
Giacomo Stevanato
9b4e61255c Document BinaryHeap unsafe functions 2021-02-20 15:44:17 -05:00
Guillaume Gomez
fc0cb5d5eb
Rollup merge of #82332 - GuillaumeGomez:no-src-link-on-dummy-spans, r=jyn514
Don't generate src link on dummy spans

Just realized that the "auto trait impls" had `[src]` links were leading to the crate root because they were dummy spans. This PR fixes this issue.

cc `@jyn514`
r? `@camelid`
2021-02-20 20:37:04 +01:00
Guillaume Gomez
77b6f96054
Rollup merge of #82316 - ehuss:lto-doc-fix, r=GuillaumeGomez
Fix minor mistake in LTO docs.

`-C lto=true` isn't a valid option.
2021-02-20 20:37:03 +01:00
Guillaume Gomez
8c095619cb
Rollup merge of #82260 - ojeda:rustc-argfile, r=jyn514
rustc: Show `@path` usage in stable

The feature was stabilized in #66172, but the usage string was not updated to be shown.
2021-02-20 20:37:02 +01:00
Guillaume Gomez
c26a8bbd6d
Rollup merge of #82244 - pickfire:patch-6, r=dtolnay
Keep consistency in example for Stdin StdinLock

Stdin uses handle whereas StdinLock uses stdin_lock, changed it to handle.
2021-02-20 20:37:01 +01:00
Guillaume Gomez
2d39300e2f
Rollup merge of #82176 - RalfJung:mir-fn-ptr-pretty, r=oli-obk
fix MIR fn-ptr pretty-printing

An uninitialized function pointer would get printed as `{{uninit  fn()}` (notice the unbalanced parentheses), and a dangling fn ptr would ICE. This fixes both of that.

However, I have no idea how to add tests for this.

Also, I don't understand this MIR pretty-printing code. Somehow the print function `pretty_print_const_scalar` actually *returns* a transformed form of the const (but there is no doc comment explaining what is being returned); some match arms do `p!` while others do `self =`, and there's a wild mixture of `p!` and `write!`... all very mysterious and confusing.^^

r? ``@oli-obk``
2021-02-20 20:37:00 +01:00
Guillaume Gomez
39af025741
Rollup merge of #81991 - osa1:issue81839, r=estebank
Fix panic in 'remove semicolon' when types are not local

It's not possible to check if removing a semicolon fixes the type error
when checking match arms and one or both of the last arm's and the
current arm's return types are imported "opaque" types. In these cases
we don't generate a "consider removing semicolon" suggestions.

Fixes #81839

---

I'm not sure how to add a test for this. I think the test would need at least two crates. Do we have any existing tests that do this so that I can take a look?
2021-02-20 20:36:57 +01:00
Guillaume Gomez
d38f6e82a4
Rollup merge of #80595 - pthariensflame:patch-1, r=m-ou-se
`impl PartialEq<Punct> for char`; symmetry for #78636

Also fixes the "since" version of the original.

Pinging ``@dtolnay`` and ``@petrochenkov.``
2021-02-20 20:36:54 +01:00
bors
83b30a639d Auto merge of #70951 - cjgillot:anarchy, r=oli-obk
Move the query engine out of rustc_middle

The handling of queries is moved to a trait `QueryEngine`.
It replaces `query::Queries` in the `TyCtxt`, allowing to move the query engine out of librustc_middle.

There are 2 modes to access the query engine: through `TyCtxt` and dynamic dispatch,
or through a `QueryCtxt`. The `QueryCtxt` is  required for everything touching the `OnDiskCache`.

For now, I put it in librustc_incremental, which is very small.
This may not be the best place.

A significant part of the codegen time for librustc_middle is moved to the recipient crate.

This PR may require a perf run.

cc #65031
r? `@Zoxc`
2021-02-20 18:58:05 +00:00
Guillaume Gomez
0c511c9115 Add test for no src links on dummy spans 2021-02-20 19:51:38 +01:00
Guillaume Gomez
3071685505 Don't render [src] link on dummy spans 2021-02-20 19:51:38 +01:00
Ralf Jung
3b81b47617 update Miri 2021-02-20 18:55:50 +01:00
Ralf Jung
e90674574d fn ptr pretty printing: fall back to raw ptr printing 2021-02-20 11:34:35 +01:00
bors
e7c23ab933 Auto merge of #82124 - tmiasko:op-ty-ref, r=oli-obk
Pass large interpreter types by reference, not value

r? `@ghost`
2021-02-20 10:20:42 +00:00
bors
da5f7f1093 Auto merge of #81427 - klensy:eat-digits, r=m-ou-se
simplify eat_digits

Simplify eat_digits by checking values in iterator, plus decrease function size, by returning unchecked slices.

https://godbolt.org/z/cxjav4
2021-02-20 07:31:43 +00:00
bors
b75baad5c3 Auto merge of #78181 - GuillaumeGomez:sized-trait, r=jyn514
Add Sized trait display when implemented on type

Fixes https://github.com/rust-lang/rust/issues/24183.

I'm not too happy about the hack I had to add in here, however, it seems like the `Sized` trait is **very** special.

cc `@jyn514`
r? `@ollie27`
2021-02-20 04:35:58 +00:00
Eric Huss
bf8563dc9b Fix minor mistake in LTO docs.
`-C lto=true` isn't a valid option.
2021-02-19 19:34:46 -08:00
Alexander Ronald Altman
1839748772 impl PartialEq<Punct> for char; symmetry for #78636
Also fixes the "since" version of the original.
2021-02-19 17:28:19 -08:00
Guillaume Gomez
46f24c912f Add tests for !Sized trait display 2021-02-19 22:38:07 +01:00
Guillaume Gomez
d20e05b78b Show negative implementation of Sized trait 2021-02-19 22:38:07 +01:00
Camille GILLOT
9823c2cc70 Workaround rustdoc not honouring cfg(parallel_compiler). 2021-02-19 22:05:27 +01:00
Camille GILLOT
4581d16bcb Move the query system to rustc_query_impl. 2021-02-19 17:51:58 +01:00
Camille GILLOT
71f749a683 Introduce a QueryEngine trait object. 2021-02-19 17:51:57 +01:00
Camille GILLOT
23f9d10ea7 Make encode_query_results more generic. 2021-02-19 17:51:57 +01:00
Camille GILLOT
24dbb61e58 Move query names and Providers to parent module. 2021-02-19 17:51:57 +01:00
Camille GILLOT
8e5d613a11 Wrap QueryDescription into a macro. 2021-02-19 17:51:57 +01:00
Camille GILLOT
cdc0b199a9 Split DepKindStruct in two. 2021-02-19 17:51:56 +01:00
Camille GILLOT
1ac21e4571 Use QueryCtxt in DepKindStruct. 2021-02-19 17:51:56 +01:00
Camille GILLOT
b27266fdb2 Use a QueryContext for try_mark_green. 2021-02-19 17:51:56 +01:00
Camille GILLOT
3bd14c7bbe Select caching strategy per query.
The per-Key choice was not used.
2021-02-19 17:51:56 +01:00
Camille GILLOT
6e4af4a2d1 Move definition of callbacks to parent module. 2021-02-19 17:51:56 +01:00
Camille GILLOT
a4b1158f78 Move handle_deadlock where it is used. 2021-02-19 17:51:55 +01:00
Camille GILLOT
ea3d465c95 Move try_load_from_on_disk_cache to the QueryContext. 2021-02-19 17:51:55 +01:00
Camille GILLOT
4dbf83a209 Move try_print_query_stack to rustc_interface. 2021-02-19 17:51:55 +01:00
Camille GILLOT
0e9cac40a6 Make alloc_self_profile_query_strings a standalone function. 2021-02-19 17:51:55 +01:00
Camille GILLOT
5d71b99690 Make QueryEngine opaque to TyCtxt. 2021-02-19 17:51:54 +01:00
Camille GILLOT
3f868b1791 Opacify query invocation. 2021-02-19 17:51:50 +01:00
Camille GILLOT
2db2776589 Wrap TyCtxt inside a QueryCtxt for queries. 2021-02-19 17:51:50 +01:00
Camille GILLOT
dab9b89221 Decouple the on-disk cache from the query engine. 2021-02-19 17:51:50 +01:00
Camille GILLOT
49c1b07a9e Decouple QueryContext from DepContext. 2021-02-19 17:51:49 +01:00
Camille GILLOT
6f04883023 Remove QueryAccessors::to_dep_node. 2021-02-19 17:51:49 +01:00
Camille GILLOT
211b05aef3 Don't require a QueryContext to access the DepGraph. 2021-02-19 17:51:49 +01:00
Camille GILLOT
7794fbb478 Group logic about the Providers struct. 2021-02-19 17:51:48 +01:00
bors
9b471a3f5f Auto merge of #82020 - jyn514:mut-passes, r=camelid,GuillaumeGomez
Make `Clean` take &mut DocContext

- Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics`
- Take `&mut DocContext` in most of `clean`
- Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad.

This combined with https://github.com/rust-lang/rust/pull/82018 should hopefully help with https://github.com/rust-lang/rust/pull/82014 by allowing `cx.cache.exported_traits` to be modified in `register_res`. Previously it had to use interior mutability, which required either adding a RefCell to `cache.exported_traits` on *top* of the existing `RefCell<Cache>` or mixing reads and writes between `cx.exported_traits` and `cx.cache.exported_traits`. I don't currently have that working but I expect it to be reasonably easy to add after this.
2021-02-19 16:39:03 +00:00
klensy
ec09d7fc8b simplify eat_digits 2021-02-19 18:51:25 +03:00