Commit Graph

161846 Commits

Author SHA1 Message Date
Eric Huss
c64d6bf5af Only disable dialogs on CI.
The "CI" environment var isn't universal (for example, I think Azure
uses TF_BUILD). However, we are mostly concerned with rust-lang/rust's
own CI which currently is GitHub Actions which does set "CI". And I
think most other providers use "CI" as well.
2022-02-03 07:03:44 -08:00
Eric Huss
e1eff1b0e8 Windows: Disable LLVM crash dialog boxes. 2022-01-27 16:53:17 -08:00
bors
21b4a9cfdc Auto merge of #92889 - tmiasko:unbounded-recursion, r=ecstatic-morse
Ignore unwinding edges when checking for unconditional recursion

The unconditional recursion lint determines if all execution paths
eventually lead to a self-recursive call.

The implementation always follows unwinding edges which limits its
practical utility. For example, it would not lint function `f` because a
call to `g` might unwind. It also wouldn't lint function `h` because an
overflow check preceding the self-recursive call might unwind:

```rust
pub fn f() {
    g();
    f();
}

pub fn g() { /* ... */ }

pub fn h(a: usize) {
  h(a + 1);
}
```

To avoid the issue, assume that terminators that might continue
execution along non-unwinding edges do so.

Fixes #78474.
2022-01-27 06:21:53 +00:00
bors
563250a65c Auto merge of #93081 - nikic:aarch64-fix, r=cuviper
Update LLVM submodule

Update LLVM to fix #92786.
2022-01-27 01:53:24 +00:00
bors
009c1d0248 Auto merge of #93352 - matthiaskrgr:rollup-5peret4, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #90247 (Improve Duration::try_from_secs_f32/64 accuracy by directly processing exponent and mantissa)
 - #91861 (Replace iterator-based construction of collections by `Into<T>`)
 - #92098 (add OpenBSD platform-support page)
 - #92134 (Add x86_64-pc-windows-msvc linker-plugin-lto instructions)
 - #92256 (Improve selection errors for `~const` trait bounds)
 - #92778 (fs: Use readdir() instead of readdir_r() on Linux and Android)
 - #93338 (Update minifier crate version to 0.0.42)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-26 22:54:26 +00:00
Matthias Krüger
4276626299
Rollup merge of #93338 - GuillaumeGomez:update-minifier, r=notriddle
Update minifier crate version to 0.0.42

Some issues on the CSS minification.

r? `@notriddle`
2022-01-26 23:45:24 +01:00
Matthias Krüger
253f64c9c6
Rollup merge of #92778 - tavianator:linux-readdir-no-r, r=joshtriplett
fs: Use readdir() instead of readdir_r() on Linux and Android

See #40021 for more details.  Fixes #86649.  Fixes #34668.
2022-01-26 23:45:23 +01:00
Matthias Krüger
e2b2bfe10c
Rollup merge of #92256 - fee1-dead:improve-selection-err, r=oli-obk
Improve selection errors for `~const` trait bounds
2022-01-26 23:45:22 +01:00
Matthias Krüger
e249812597
Rollup merge of #92134 - nico-abram:patch-1, r=michaelwoerister
Add x86_64-pc-windows-msvc linker-plugin-lto instructions

I had some trouble getting cross language LTO working for this target, in part because the very few links of documentation I could find were linux-centric and because of a few very specific errors I ran into. I'm not sure if this is the correct place to document this, but this is one of the first links I found when looking for documentation so it might be the best place for it.
2022-01-26 23:45:21 +01:00
Matthias Krüger
75eb96301d
Rollup merge of #92098 - semarie:openbsd-platform, r=pietroalbini
add OpenBSD platform-support page

It mentions x86_64, i686, aarch64 and sparc64 which are actively maintained and used on OpenBSD (binaries provided by standard package distribution on OpenBSD).

I volontary kept `powerpc-unknown-openbsd` unmentioned as it was added by `@Yn0ga` in #82733, and I am unaware if it is functional or not (I doubt as I added libc support only few days ago, and std `c_char` signess was wrong). `@Yn0ga` maybe you comment on your `powerpc-unknown-openbsd` usage ?
2022-01-26 23:45:20 +01:00
Matthias Krüger
1dd0ac1f6a
Rollup merge of #91861 - juniorbassani:use-from-array-in-collections-examples, r=yaahc
Replace iterator-based construction of collections by `Into<T>`

Just a few quality of life improvements in the doc examples. I also removed some `Vec`s in favor of arrays.
2022-01-26 23:45:19 +01:00
Matthias Krüger
faf2b7f455
Rollup merge of #90247 - newpavlov:duration_float_fract, r=nagisa
Improve Duration::try_from_secs_f32/64 accuracy by directly processing exponent and mantissa

Closes: #90225

The methods now implement direct processing of exponent and mantissa, which should result in the best possible conversion accuracy (modulo truncation, i.e. float value of 19.995 ns will be represented as 19 ns).
2022-01-26 23:45:18 +01:00
bors
6abb6385b2 Auto merge of #93301 - spastorino:perf-test-1, r=oli-obk
Store hir_id_to_def_id in OwnerInfo.

This is for perf test purposes only. Related to #89278
2022-01-26 19:45:09 +00:00
Guillaume Gomez
91f39315e8 Update minifier crate version to 0.0.42 2022-01-26 17:24:34 +01:00
Santiago Pastorino
384189c3d9
Filter out local_id == 0, those are already considered on the call site 2022-01-26 12:25:31 -03:00
Camille GILLOT
14a64e0a55
Bless incremental tests. 2022-01-26 12:25:30 -03:00
Артём Павлов [Artyom Pavlov]
e0bcf771d6 Improve Duration::try_from_secs_f32/64 accuracy by directly processing exponent and mantissa 2022-01-26 18:14:25 +03:00
Tomasz Miąsko
10b722cc79 Ignore unwinding edges when checking for unconditional recursion
The unconditional recursion lint determines if all execution paths
eventually lead to a self-recursive call.

The implementation always follows unwinding edges which limits its
practical utility. For example, it would not lint function `f` because a
call to `g` might unwind. It also wouldn't lint function `h` because an
overflow check preceding the self-recursive call might unwind:

```rust
pub fn f() {
    g();
    f();
}

pub fn g() { /* ... */ }

pub fn h(a: usize) {
  h(a + 1);
}
```

To avoid the issue, assume that terminators that might continue
execution along non-unwinding edges do so.
2022-01-26 13:46:01 +01:00
bors
a7f375789b Auto merge of #91840 - JakobDegen:fix_early_otherwise, r=oli-obk
Fix the unsoundness in the `early_otherwise_branch` mir opt pass

Closes #78496 .

This change is a significant rewrite of much of the pass. Exactly what it does is documented in the source file (with ascii art!), and all the changes that are made to the MIR that are not trivially sound are carefully documented. That being said, this is my first time touching MIR, so there are probably some invariants I did not know about that I broke.

This version of the optimization is also somewhat more flexible than the original; for example, we do not care how or where the value on which the parent is switching is computed. There is no requirement that any types be the same. This could be made even more flexible in the future by allowing a wider range of statements in the bodies of `BBC, BBD` (as long as they are all the same of course). This should be a good first step though.

Probably needs a perf run.

r? `@oli-obk` who reviewed things the last time this was touched
2022-01-26 12:10:54 +00:00
bors
788b1fe5b7 Auto merge of #88679 - petrochenkov:doctrscope, r=GuillaumeGomez
rustdoc: Pre-calculate traits that are in scope for doc links

This eliminates one more late use of resolver (part of #83761).
At early doc link resolution time we go through parent modules of items from the current crate, reexports of items from other crates, trait items, and impl items collected by `collect-intra-doc-links` pass, determine traits that are in scope in each such module, and put those traits into a map used by later rustdoc passes.
r? `@jyn514`
2022-01-26 09:10:27 +00:00
Nikita Popov
48a625d385 Update LLVM submodule 2022-01-26 09:39:15 +01:00
bors
d502eda250 Auto merge of #93314 - ehuss:update-cargo, r=ehuss
Update cargo

9 commits in 95bb3c92bf516017e812e7f1c14c2dea3845b30e..1c034752de0df744fcd7788fcbca158830b8bf85
2022-01-18 17:39:35 +0000 to 2022-01-25 22:36:53 +0000
- Sync toml_edit versions (rust-lang/cargo#10329)
- Check --config for dotted keys only (rust-lang/cargo#10176)
- Remove deprecated --host arg for search and publish cmds (rust-lang/cargo#10327)
- doc: it's valid to use OUT_DIR for intermediate artifacts (rust-lang/cargo#10326)
- Use local git info for version. (rust-lang/cargo#10323)
- Fix documenting with undocumented dependencies. (rust-lang/cargo#10324)
- do not compile test for bins flagged as `test = false` (rust-lang/cargo#10305)
- Port cargo from toml-rs to toml_edit (rust-lang/cargo#10086)
- Fix new::git_default_branch with different default (rust-lang/cargo#10306)
2022-01-26 01:47:08 +00:00
Eric Huss
af8048b21d Update cargo 2022-01-25 16:24:21 -08:00
Nicolas Abram
b75cb95c26
Update src/doc/rustc/src/linker-plugin-lto.md
Co-authored-by: Noah Lev <camelidcamel@gmail.com>
2022-01-25 20:19:43 -03:00
bors
c54dfee651 Auto merge of #93308 - matthiaskrgr:rollup-9tc73ft, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #93250 (Remove deduplication of early lints)
 - #93286 (Add white-space: nowrap to links in the sidebar)
 - #93291 (minor fix for #93231)
 - #93300 (make Windows abort_internal Miri-compatible)
 - #93303 (Fix ICE when parsing bad turbofish with lifetime argument)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-25 22:30:07 +00:00
Matthias Krüger
086be2b6c4
Rollup merge of #93303 - compiler-errors:issue-93282, r=wesleywiser
Fix ICE when parsing bad turbofish with lifetime argument

Generalize conditions where we suggest adding the turbofish operator, so we don't ICE during code like

```rust
fn foo() {
  A<'a,>
}
```

but instead suggest adding a turbofish.

Fixes #93282
2022-01-25 23:06:04 +01:00
Matthias Krüger
04f915b332
Rollup merge of #93300 - RalfJung:win-abort-miri, r=Amanieu
make Windows abort_internal Miri-compatible

https://github.com/rust-lang/rust/pull/92828 started calling `abort_internal` on double-panics, uncovering that on Windows this function does not work in Miri because of its use of inline assembly.

Cc `@Amanieu`
2022-01-25 23:06:03 +01:00
Matthias Krüger
b2c21abb9c
Rollup merge of #93291 - conradludgate:minor-fix-93231, r=GuillaumeGomez
minor fix for #93231

In #93231 I introduced the new sidebar colours to make the contrast more balanced and easier to read, but it seems I made a copy-paste error in the light theme, resulting in functions appearing green.

This one line change replaces that colour with it's corrected orange/brown colour.

I have double checked the rest of the colours and they seem ok. Sorry for the inconvenience
2022-01-25 23:06:02 +01:00
Matthias Krüger
c8999d9d91
Rollup merge of #93286 - jsha:sidebar-nowrap, r=GuillaumeGomez
Add white-space: nowrap to links in the sidebar

We already have overflow: hidden on these links, but if there is a possibility to wrap, they will wrap. This happens in particular for trait implementations because the punctuation (`<>, `) introduces opportunities for breaks. That produces inconsistent UI. Fix it by forcing them not to wrap.

Demo: https://rustdoc.crud.net/jsha/sidebar-nowrap/std/string/struct.String.html

To see the effect, scroll down to the "Trait Implementations" portion of the sidebar and look at IndexMut. Compare vs:

https://doc.rust-lang.org/std/string/struct.String.html
https://doc.rust-lang.org/nightly/std/string/struct.String.html

r? `@camelid`
2022-01-25 23:06:01 +01:00
Matthias Krüger
83cc776d7c
Rollup merge of #93250 - Aaron1011:remove-early-dedup, r=oli-obk
Remove deduplication of early lints

We already have a general mechanism for deduplicating reported
lints, so there's no need to have an additional one for early lints
specifically. This allows us to remove some `PartialEq` impls.
2022-01-25 23:06:00 +01:00
Michael Goulet
37bed05986 delay the bug once again, generalize turbofish suggestion 2022-01-25 11:11:13 -08:00
bors
8cdb3cd94e Auto merge of #93095 - Aaron1011:remove-assoc-ident, r=cjgillot
Store a `Symbol` instead of an `Ident` in `AssocItem`

This is the same idea as #92533, but for `AssocItem` instead
of `VariantDef`/`FieldDef`.

With this change, we no longer have any uses of
`#[stable_hasher(project(...))]`
2022-01-25 18:53:45 +00:00
Michael Goulet
a090bb1dea Remove delayed bug when encountering label in bad turbofish 2022-01-25 10:47:10 -08:00
Camille GILLOT
80132c3ce4
Store hir_id_to_def_id in OwnerInfo. 2022-01-25 15:05:19 -03:00
Ralf Jung
53d2401f3f make Windows abort_internal Miri-compatible 2022-01-25 12:44:40 -05:00
bors
92ed8747f2 Auto merge of #92353 - Kobzol:doc-attr-lists-gat, r=GuillaumeGomez
Rustdoc: remove ListAttributesIter and use impl Iterator instead

This is a continuation of https://github.com/rust-lang/rust/pull/92227.

I found that `ListAttributesIter` did not optimize well and replacing it with a simple `impl Iterator` resulted in 1-3 % instruction count wins locally.

Because I needed to use `impl Iterator` on a slice of AST attributes, I had to implement it using GAT + impl trait. I also have a version without GAT [here](5470e2a65c), if GATs are not welcome in rustdoc :D Locally it resulted in equal performance numbers.

Can I ask for a perf. run? Thanks.

r? rust-lang/rustdoc
2022-01-25 15:43:29 +00:00
Deadbeef
8b76cad0a7
Add a minimal working append_const_msg argument 2022-01-26 00:48:08 +11:00
Deadbeef
fdf7d01088
Improve selection errors for ~const trait bounds 2022-01-26 00:48:01 +11:00
Vadim Petrochenkov
00ba815a58 rustdoc: Pre-calculate traits that are in scope for doc links
This eliminates one more late use of resolver
2022-01-25 21:45:21 +08:00
bors
17dfae79bb Auto merge of #93089 - pierwill:rm-outlivesconstraint-ord, r=michaelwoerister
Remove ordering traits from `OutlivesConstraint`

In two cases where this ordering was used, I've replaced the sorting to use a key that does not rely on `DefId` being `Ord`. This is part of #90317. If I understand correctly, whether this is correct depends on whether the `RegionVid`s are tracked during incremental compilation. But I might be mistaken in this approach. cc `@cjgillot`
2022-01-25 08:18:25 +00:00
Conrad Ludgate
e947dc6225 give light-theme fns the correct orange-brown colour 2022-01-25 08:00:34 +00:00
bors
df368ae457 Auto merge of #93288 - matthiaskrgr:rollup-uu4uwd1, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #88794 (Add a `try_clone()` function to `OwnedFd`.)
 - #93064 (Properly track `DepNode`s in trait evaluation provisional cache)
 - #93118 (Move param count error emission to end of `check_argument_types`)
 - #93144 (Work around missing code coverage data causing llvm-cov failures)
 - #93169 (Fix inconsistency of local blanket impls)
 - #93175 (Implement stable overlap check considering negative traits)
 - #93251 (rustdoc settings: use radio buttons for theme)
 - #93269 (Use error-on-mismatch policy for PAuth module flags.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-25 05:15:21 +00:00
Matthias Krüger
13b87d8cc7
Rollup merge of #93269 - jacobbramley:dev/pauth-option-1, r=petrochenkov
Use error-on-mismatch policy for PAuth module flags.

This agrees with Clang, and avoids an error when using LTO with mixed
C/Rust. LLVM considers different behaviour flags to be a mismatch,
even when the flag value itself is the same.

This also makes the flag setting explicit for all uses of
LLVMRustAddModuleFlag.

----

I believe that this fixes #92885, but have only reproduced it locally on Linux hosts so cannot confirm that it fixes the issue as reported.

I have not included a test for this because it is covered by an existing test (`src/test/run-make-fulldeps/cross-lang-lto-clang`). It is not without its problems, though:
* The test requires Clang and `--run-clang-based-tests-with=...` to run, and this is not the case on the CI.
   * Any test I add would have a similar requirement.
* With this patch applied, the test gets further, but it still fails (for other reasons). I don't think that affects #92885.
2022-01-25 05:51:14 +01:00
Matthias Krüger
c3ddca6d4a
Rollup merge of #93251 - jsha:theme-radio, r=GuillaumeGomez
rustdoc settings: use radio buttons for theme

This reduces the number of clicks required to change theme.

Also, simplify the UI a bit (remove setting grouping), and add a "Back" link close to the settings icon.

Demo: https://rustdoc.crud.net/jsha/theme-radio/settings.html

r? ``@GuillaumeGomez``

New:

![image](https://user-images.githubusercontent.com/220205/150702647-4826d525-54fa-439a-b24c-6d5bca6f95bf.png)

Old:

![image](https://user-images.githubusercontent.com/220205/150702669-6a4214ed-1dab-4fee-b1aa-59acfce3dbca.png)
2022-01-25 05:51:13 +01:00
Matthias Krüger
3d6f276ca7
Rollup merge of #93175 - spastorino:negative-traits-coherence-new, r=nikomatsakis
Implement stable overlap check considering negative traits

This PR implement the new disjointness rules for overlap check described in https://rust-lang.github.io/negative-impls-initiative/explainer/coherence-check.html#new-disjointness-rules

r? ``@nikomatsakis``
2022-01-25 05:51:12 +01:00
Matthias Krüger
677126cac0
Rollup merge of #93169 - CraftSpider:rustdoc-clean-inconsistency, r=GuillaumeGomez
Fix inconsistency of local blanket impls

When a blanket impl is local, go through HIR instead of middle. This fixes inconsistencies with data detected during JSON generation.

Expected this change to take longer. I also tried doing the whole item through existing clean architecture, but it didn't work out trivially, and felt like it would have added more complexity than it removed.

Properly fixes #83718
2022-01-25 05:51:12 +01:00
Matthias Krüger
8dddc86477
Rollup merge of #93144 - wesleywiser:uninhabited_type_code_cov2, r=tmandry
Work around missing code coverage data causing llvm-cov failures

If we do not add code coverage instrumentation to the `Body` of a
function, then when we go to generate the function record for it, we
won't write any data and this later causes llvm-cov to fail when
processing data for the entire coverage report.

I've identified two main cases where we do not currently add code
coverage instrumentation to the `Body` of a function:

  1. If the function has a single `BasicBlock` and it ends with a
     `TerminatorKind::Unreachable`.

  2. If the function is created using a proc macro of some kind.

For case 1, this is typically not important as this most often occurs as
a result of function definitions that take or return uninhabited
types. These kinds of functions, by definition, cannot even be called so
they logically should not be counted in code coverage statistics.

For case 2, I haven't looked into this very much but I've noticed while
testing this patch that (other than functions which are covered by case
1) the skipped function coverage debug message is occasionally triggered
in large crate graphs by functions generated from a proc macro. This may
have something to do with weird spans being generated by the proc macro
but this is just a guess.

I think it's reasonable to land this change since currently, we fail to
generate *any* results from llvm-cov when a function has no coverage
instrumentation applied to it. With this change, we get coverage data
for all functions other than the two cases discussed above.

Fixes #93054 which occurs because of uncallable functions which shouldn't
have code coverage anyway.

I will open an issue for missing code coverage of proc macro generated
functions and leave a link here once I have a more minimal repro.

r? ``@tmandry``
cc ``@richkadel``
2022-01-25 05:51:11 +01:00
Matthias Krüger
c8ede152a5
Rollup merge of #93118 - jackh726:param-heuristics-3, r=estebank
Move param count error emission to end of `check_argument_types`

The error emission here isn't exactly what is done in #92364, but replicating that is hard . The general move should make for a smaller diff.

Also included the `(usize, Ty, Ty)` to -> `Option<(Ty, Ty)>` commit.

r? ``@estebank``
2022-01-25 05:51:10 +01:00
Matthias Krüger
cf7041186c
Rollup merge of #93064 - Aaron1011:provisional-dep-node, r=michaelwoerister
Properly track `DepNode`s in trait evaluation provisional cache

Fixes #92987

During evaluation of an auto trait predicate, we may encounter a cycle.
This causes us to store the evaluation result in a special 'provisional
cache;. If we later end up determining that the type can legitimately
implement the auto trait despite the cycle, we remove the entry from
the provisional cache, and insert it into the evaluation cache.

Additionally, trait evaluation creates a special anonymous `DepNode`.
All queries invoked during the predicate evaluation are added as
outoging dependency edges from the `DepNode`. This `DepNode` is then
store in the evaluation cache - if a different query ends up reading
from the cache entry, it will also perform a read of the stored
`DepNode`. As a result, the cached evaluation will still end up
(transitively) incurring all of the same dependencies that it would
if it actually performed the uncached evaluation (e.g. a call to
`type_of` to determine constituent types).

Previously, we did not correctly handle the interaction between the
provisional cache and the created `DepNode`. Storing an evaluation
result in the provisional cache would cause us to lose the `DepNode`
created during the evaluation. If we later moved the entry from the
provisional cache to the evaluation cache, we would use the `DepNode`
associated with the evaluation that caused us to 'complete' the cycle,
not the evaluatoon where we first discovered the cycle. As a result,
future reads from the evaluation cache would miss some incremental
compilation dependencies that would have otherwise been added if the
evaluation was *not* cached.

Under the right circumstances, this could lead to us trying to force
a query with a no-longer-existing `DefPathHash`, since we were missing
the (red) dependency edge that would have caused us to bail out before
attempting forcing.

This commit makes the provisional cache store the `DepNode` create
during the provisional evaluation. When we move an entry from the
provisional cache to the evaluation cache, we create a *new* `DepNode`
that has dependencies going to *both* of the evaluation `DepNodes` we
have available. This ensures that cached reads will incur all of
the necessary dependency edges.
2022-01-25 05:51:10 +01:00
Matthias Krüger
687bb583c8
Rollup merge of #88794 - sunfishcode:sunfishcode/try-clone, r=joshtriplett
Add a `try_clone()` function to `OwnedFd`.

As suggested in #88564. This adds a `try_clone()` to `OwnedFd` by
refactoring the code out of the existing `File`/`Socket` code.

r? ``@joshtriplett``
2022-01-25 05:51:09 +01:00