Commit graph

158873 commits

Author SHA1 Message Date
Noah Lev db4a06e9bd Use path.def_id() in Type::inner_def_id() 2021-11-24 12:00:54 -08:00
Noah Lev 47266bacf1 Return the actual DefId for assoc. items in register_res
Before, if `register_res` were called on an associated item or enum
variant, it would return the parent's `DefId`. Now, it returns the
actual `DefId`.

This change is a step toward removing `Type::ResolvedPath.did` and
potentially removing `kind_side_channel` in rustdoc. It also just
simplifies rustdoc's behavior.
2021-11-24 12:00:53 -08:00
Jacob Hoffman-Andrews 04cb0dc8a9 Fix clicking on anchors inside summary tags. 2021-11-24 10:46:55 -08:00
Noah Lev f0b990a8f9 Remove -Z force-overflow-checks
It was replaced several years ago by the stable option `-C
overflow-checks`. The goal was to delete the `-Z` flag once users had
migrated [1]. Now that it's been several years, it makes sense to delete
the old flag.

See also the discussion on Zulip [2].

[1]: https://github.com/rust-lang/rust/issues/33134#issuecomment-280484097
[2]: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/overflow.20checks/near/262497224
2021-11-24 10:19:23 -08:00
bors 8a48b376d5 Auto merge of #90491 - Mark-Simulacrum:push-pred-faster, r=matthewjasper
Optimize live point computation

This refactors the live-point computation to lower per-MIR-instruction costs by operating on a largely per-block level. This doesn't fundamentally change the number of operations necessary, but it greatly improves the practical performance by aggregating bit manipulation into ranges rather than single-bit; this scales much better with larger blocks.

On the benchmark provided in #90445, with 100,000 array elements, walltime for a check build is improved from 143 seconds to 15.

I consider the tiny losses here acceptable given the many small wins on real world benchmarks and large wins on stress tests. The new code scales much better, but on some subset of inputs the slightly higher constant overheads decrease performance somewhat. Overall though, this is expected to be a big win for pathological cases (as illustrated by the test case motivating this work) and largely not material for non-pathological cases. I consider the new code somewhat easier to follow, too.
2021-11-24 15:51:46 +00:00
Stefan Lankes 644b445428 If the thread does not get the lock in the short term, yield the CPU
Reduces the amount of wasted processor cycles
2021-11-24 15:59:28 +01:00
Guillaume Gomez 0ba92fe5a3 Update GUI tests for <a> color 2021-11-24 14:27:05 +01:00
Guillaume Gomez 58720096f2 Fix more <a> color 2021-11-24 14:27:05 +01:00
bors c6a7ca196a Auto merge of #90579 - cjgillot:no-ee-ii, r=Aaron1011
Remove eval_always for inherent_impls.

Split off https://github.com/rust-lang/rust/pull/86056
r? `@ghost`
2021-11-24 12:51:19 +00:00
bors 982c552c90 Auto merge of #91171 - jsha:fix-rustdoc-gui-test, r=GuillaumeGomez
Fix toggle-click-deadspace rustdoc-gui test

In #91103 I introduced a rustdoc-gui test for clicks on toggles. I introduced some documentation on a method in lib2/struct.Foo.html so there would be something to toggle, but accidentally left the test checking test_docs/struct.Foo.html. That caused the test to reliably fail.

I'm not sure how that test got past GitHub Actions and bors, but it's manifesting in test failures at https://github.com/rust-lang/rust/pull/91062#issuecomment-977589705 and https://github.com/rust-lang/rust/pull/91170#issuecomment-977636159.

This fixes by pointing at the right file.

r? `@GuillaumeGomez`
2021-11-24 09:43:47 +00:00
Jacob Hoffman-Andrews 420be4a282 Fix toggle-click-deadspace rustdoc-gui test 2021-11-24 00:58:07 -08:00
Deadbeef 4f29f3cef8
Add impl polarity to fields 2021-11-24 16:31:47 +08:00
Deadbeef b2005117bc
Allow features like const_try in d_m_b_i_c 2021-11-24 15:57:44 +08:00
Deadbeef e0c2ff7ccc
Allow more cases to match ~const Drop. 2021-11-24 15:57:40 +08:00
Deadbeef 3b25e92a8f
Debug 2021-11-24 15:55:21 +08:00
Jacob Hoffman-Andrews 4198fac739 Preload the most commonly used fonts.
Don't preload italic font faces because they aren't used on all pages,
and when they are used, they are used sparingly so it's okay if they are
slower to load.
2021-11-23 23:13:52 -08:00
rdambrosio 870b8311c1 Feat: make cg_ssa get_param borrow the builder mutable 2021-11-23 22:30:20 -05:00
Ralf Jung 5f6ccf6121 document BinOp behavior quirks in the corresponding enum 2021-11-23 20:30:26 -05:00
Arpad Borsos 566ad8da45 Update CoverageMappingFormat Support to Version6
Version 5 adds Branch Regions which are a prerequisite for branch coverage.
Version 6 can use the zeroth filename as prefix for other relative files.
2021-11-23 15:49:03 -08:00
bors de4b242e1e Auto merge of #91149 - notriddle:notriddle/rustdoc-doctest-semicolon, r=jyn514
fix(doctest): detect extern crate items in statement doctests

This partially reverts #91026, because rustdoc needs to detect the extern statements, even when they appear inside implicit `main()`. It does not entirely revert it, so the old bug is still fixed, by duplicating some of the logic from `parse_mod` instead of trying to use it directly.

Fixes #91134
2021-11-23 23:48:55 +00:00
the8472 53fc69f87c
Apply suggestions from code review
Co-authored-by: pierwill <19642016+pierwill@users.noreply.github.com>
2021-11-23 23:55:05 +01:00
Dom 4389a4ce49 fix: do not wrap reference-style doc links
Prevents wrap_comments from incorrectly wrapping reference-style doc
links.
2021-11-23 16:17:52 -06:00
Badel2 6955afe8fd Fix stack overflow in usefulness.rs 2021-11-23 23:07:11 +01:00
Camille GILLOT ae126ad282 Do not visit attributes in ItemLowerer.
By default, AST visitors visit expressions that appear in key-value attributes.
Those expressions should not be lowered to HIR, as they do not correspond to actually compiled code.

Since an attribute cannot produce meaningful HIR, just skip them altogether.
2021-11-23 22:06:22 +01:00
bors 65c55bf931 Auto merge of #91159 - matthiaskrgr:rollup-91mgg5v, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #90856 (Suggestion to wrap inner types using 'allocator_api' in tuple)
 - #91103 (Inhibit clicks on summary's children)
 - #91137 (Give people a single link they can click in the contributing guide)
 - #91140 (Split inline const to two feature gates and mark expression position inline const complete)
 - #91148 (Use `derive_default_enum` in the compiler)
 - #91153 (kernel_copy: avoid panic on unexpected OS error)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-23 20:44:33 +00:00
Esteban Kuber 5402e4833f Sort FxHashSet's contents before emitting errors for consistent output 2021-11-23 20:37:24 +00:00
Esteban Kuber 38979a3ba1 udpate comment to be more accurate 2021-11-23 20:37:23 +00:00
Esteban Kuber 143f784199 replace_tabs -> normalize_whitespace 2021-11-23 20:37:21 +00:00
Esteban Kuber d68add9ecc review comment: plural of emoji is emoji 2021-11-23 20:36:19 +00:00
Esteban Kuber 21224e6ee0 Account for confusable codepoints when recovering emoji identifiers 2021-11-23 20:36:19 +00:00
Esteban Kuber 4489aeb907 fix fmt 2021-11-23 20:36:18 +00:00
Esteban Kuber 081198a6c8 Add unic-emoji-char and its dependencies to the allow list 2021-11-23 20:36:17 +00:00
Esteban Kuber 20b69e6863 Fix RustDoc 2021-11-23 20:36:17 +00:00
Esteban Kuber a96fe02f6c Replace ZWJ with nothing in terminal output 2021-11-23 20:36:14 +00:00
Esteban Kuber 5a68abb094 Tokenize emoji as if they were valid indentifiers
In the lexer, consider emojis to be valid identifiers and reject
them later to avoid knock down parse errors.
2021-11-23 20:35:07 +00:00
Ralf Jung 94c9c22b39 explain why CTFE/Miri perform truncation on shift offset 2021-11-23 14:12:14 -05:00
Michael Goulet 9cc117930b Fix printing unit return ty, don't elaborate FnOnce unless we see it 2021-11-23 11:05:07 -08:00
Michael Goulet 9ae575c795 Update test outputs 2021-11-23 10:34:17 -08:00
Michael Goulet 471334e996 Suppress noisy generator associated type 2021-11-23 10:34:16 -08:00
Michael Goulet b84a52c95a Add generator lang-item 2021-11-23 10:34:16 -08:00
Michael Goulet ce182d17f8 Elaborate trait generics and associated types 2021-11-23 10:34:16 -08:00
Michael Goulet c969b1dea0 Add supertraits method to rustc_middle 2021-11-23 10:34:16 -08:00
Michael Goulet 8756d0701e Derive Ord and PartialOrd for TraitRef 2021-11-23 10:34:16 -08:00
Matthias Krüger 3dc00111f2
Rollup merge of #91153 - birkenfeld:kernel_copy_fallback, r=the8472
kernel_copy: avoid panic on unexpected OS error

According to documentation, the listed errnos should only occur
if the `copy_file_range` call cannot be made at all, so the
assert be correct.  However, since in practice file system
drivers (incl. FUSE etc.) can return any errno they want, we
should not panic here.

Fixes #91152
2021-11-23 19:28:12 +01:00
Matthias Krüger e52e3a4bb3
Rollup merge of #91148 - jhpratt:use-default-enum, r=petrochenkov
Use `derive_default_enum` in the compiler

Let's get this feature some real-world love.

``@rustbot`` label: +C-cleanup +S-waiting-on-review
2021-11-23 19:28:11 +01:00
Matthias Krüger a26c2c7495
Rollup merge of #91140 - nbdd0121:const_typeck, r=oli-obk
Split inline const to two feature gates and mark expression position inline const complete

This PR splits inline const in pattern position into its own `#![feature(inline_const_pat)]` feature gate, and make the usage in expression position complete.

I think I have resolved most outstanding issues related to `inline_const` with #89561 and other PRs. The only thing left that I am aware of is #90150 and the lack of lifetime checks when inline const is used in pattern position (FIXME in #89561). Implementation-wise when used in pattern position it has to be lowered during MIR building while in expression position it's evaluated only when monomorphizing (just like normal consts), so it makes some sense to separate it into two feature gates so one can progress without being blocked by another.

``@rustbot`` label: T-compiler F-inline_const
2021-11-23 19:28:10 +01:00
Matthias Krüger 4484224710
Rollup merge of #91137 - jyn514:contributing, r=spastorino
Give people a single link they can click in the contributing guide

Doc Jones mentioned that one of the things making it hard to get started
is that the amount of information is overwhelming, between the
dev-guide, contributing guide, and discussion platforms. This gives
people a single link they can click to ask for help.

cc ``@doc-jones`` - is this what you had in mind?
2021-11-23 19:28:09 +01:00
Matthias Krüger eb5c2d3895
Rollup merge of #91103 - jsha:non-toggle-click-doesnt-toggle, r=Manishearth,GuillaumeGomez
Inhibit clicks on summary's children

A byproduct of using `<details>` and `<summary>` to show/hide detailed documentation was that clicking any part of a method heading (or impl heading) would show or hide the documentation. This was not super noticeable because clicking a link inside the method heading would navigate to that link. But clicking any unlinked black text in a method heading would trigger the behavior.

That behavior was somewhat unexpected, and means that if you try to click a type name in a method heading, but miss by a few pixels, you get a confusing surprise.

This change inhibits that behavior by putting an event listener on most summaries that cancels the event unless the event target was the summary itself. In practice, that means it cancels the event unless the target was the "[+]" / "[-]", because the rest of the heading is wrapped inside a `<div>`, which is the target for anything that doesn't have a more specific target.

r? ``@Manishearth``
2021-11-23 19:28:07 +01:00
Matthias Krüger 68a44c8228
Rollup merge of #90856 - ken-matsui:suggestion-to-wrap-vec-allocator-api-in-tuple, r=davidtwco
Suggestion to wrap inner types using 'allocator_api' in tuple

This PR provides a suggestion to wrap the inner types in tuple when being along with 'allocator_api'.

Closes https://github.com/rust-lang/rust/issues/83250

```rust
fn main() {
    let _vec: Vec<u8, _> = vec![]; //~ ERROR use of unstable library feature 'allocator_api'
}
```

```diff
 error[E0658]: use of unstable library feature 'allocator_api'
   --> $DIR/suggest-vec-allocator-api.rs:2:23
    |
 LL |     let _vec: Vec<u8, _> = vec![];
-   |                       ^
+   |                   ----^
+   |                   |
+   |                   help: consider wrapping the inner types in tuple: `(u8, _)`
    |
    = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information
    = help: add `#![feature(allocator_api)]` to the crate attributes to enable
```
2021-11-23 19:28:06 +01:00
bors 7b3cd075bb Auto merge of #90788 - ecstatic-morse:issue-90752, r=wesleywiser
Mark places as initialized when mutably borrowed

Fixes the example in #90752, but does not handle some corner cases involving raw pointers and unsafe. See [this comment](https://github.com/rust-lang/rust/issues/90752#issuecomment-965822895) for more information, or the second test.

Although I talked about both `MaybeUninitializedPlaces` and `MaybeInitializedPlaces` in #90752, this PR only changes the latter. That's because "maybe uninitialized" is the conservative choice, and marking them as definitely initialized (`!maybe_uninitialized`) when a mutable borrow is created could lead to problems if `addr_of_mut` to an uninitialized local is allowed. Additionally, places cannot become uninitialized via a mutable reference, so if a place is definitely initialized, taking a mutable reference to it should not change that.

I think it's correct to ignore interior mutability as nbdd0121 suggests below. Their analysis doesn't work inside of `core::cell`, which *does* have access to `UnsafeCell`'s field, but that won't be an issue unless we explicitly instantiate one with an `enum` within that module.

r? `@wesleywiser`
2021-11-23 17:44:33 +00:00