Commit Graph

124138 Commits

Author SHA1 Message Date
bors
37f70a0e1e Auto merge of #90214 - tmiasko:indirect-mutation-qualif, r=ecstatic-morse,oli-obk
Consider indirect mutation during const qualification dataflow

Previously a local would be qualified if either one of two separate data
flow computations indicated so. First determined if a local could
contain the qualif, but ignored any forms of indirect mutation. Second
determined if a local could be mutably borrowed (and so indirectly
mutated), but which in turn ignored the qualif.

The end result was incorrect because the effect of indirect mutation was
effectivelly ignored in the all but the final stage of computation.

In the new implementation the indirect mutation is directly incorporated
into the qualif data flow. The local variable becomes immediately
qualified once it is mutably borrowed and borrowed place type can
contain the qualif.

In general we will now reject additional programs, program that were
prevously unintentionally accepted.

There are also some cases which are now accepted but were previously
rejected, because previous implementation didn't consider whether
borrowed place could have the qualif under the consideration.

Fixes #90124.

r? `@ecstatic-morse`
2021-10-29 08:38:39 +00:00
bors
88a5a984fe Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr
Revert "Add rustc lint, warning when iterating over hashmaps"

Fixes perf regressions introduced in https://github.com/rust-lang/rust/pull/90235 by temporarily reverting the relevant PR.
2021-10-29 04:55:51 +00:00
bors
a9f664f37d Auto merge of #90363 - camelid:build-impl-perf, r=jyn514
Improve perf measurements of `build_extern_trait_impl`

Before, it was only measuring one callsite of `build_impl`, and it
incremented the call count even if `build_impl` returned early because
the `did` was already inlined.

Now, it measures all calls, minus calls that return early.
2021-10-29 01:50:08 +00:00
Noah Lev
581dc75888 rustdoc: Remove a single-use macro
I think the new code is simpler and easier to understand.
2021-10-28 18:39:32 -07:00
Brennan Vincent
2b66af1e74 Update miri 2021-10-28 21:38:43 -04:00
Noah Lev
7865a85eb6 rustdoc: Switch to mainline rayon
The rustc fork of rayon integrates with Cargo's jobserver to limit the
amount of parallelism. However, rustdoc's use case is concurrent I/O,
which is not CPU-heavy, so it should be able to use mainline rayon.

See this discussion [1] for more details.

[1]: https://github.com/rust-lang/rust/issues/90227#issuecomment-952468618

Note: I chose rayon 1.3.1 so that the rayon version used elsewhere in
the workspace does not change.
2021-10-28 18:26:57 -07:00
Matthias Krüger
dbe7141ac0
Rollup merge of #90082 - noncombatant:patch-1, r=GuillaumeGomez
Fix minor typos
2021-10-29 00:30:30 +02:00
Mateusz Mikuła
533247c1c8 Add -Zunstable-options instead of feature 2021-10-28 23:38:21 +02:00
Matthew Jasper
a76a2d4ef9 Add comments to hygiene tests 2021-10-28 21:48:39 +01:00
bors
85c0558d03 Auto merge of #90218 - JakobDegen:adt_significant_drop_fix, r=nikomatsakis
Fixes incorrect handling of ADT's drop requirements

Fixes #90024 and a bunch of duplicates.

The main issue was just that the contract of `NeedsDropTypes::adt_components` was inconsistent; the list of types it might return were the generic parameters themselves or the fields of the ADT, depending on the nature of the drop impl. This meant that the caller could not determine whether a `.subst()` call was still needed on those types; it called `.subst()` in all cases, and this led to ICEs when the returned types were the generic params.

First contribution of more than a few lines, so feedback definitely appreciated.
2021-10-28 16:03:13 +00:00
Mark Rousskov
3215eeb99f
Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
Ilya Yanok
9a0a622a04 Add test cases 2021-10-28 14:25:46 +00:00
bors
f2707fec04 Auto merge of #90339 - GuillaumeGomez:doc-alias-doc, r=GuillaumeGomez
Add missing documentation for doc alias
2021-10-28 09:50:16 +00:00
xFrednet
01e441f8e5 Document clippy on nightly-rustc 2021-10-28 11:35:24 +02:00
Guillaume Gomez
47786d3642 Add missing documentation for doc alias 2021-10-28 10:43:34 +02:00
Noah Lev
eb713d272c Improve perf measurements of build_extern_trait_impl
Before, it was only measuring one callsite of `build_impl`, and it
incremented the call count even if `build_impl` returned early because
the `did` was already inlined.

Now, it measures all calls, minus calls that return early.
2021-10-27 20:15:00 -07:00
Tomasz Miąsko
3f778f31b6 Use type based qualification for unions
Union field access is currently qualified based on the qualification of
a value previously assigned to the union. At the same time, every union
access transmutes the content of the union, which might result in a
different qualification.

For example, consider constants A and B as defined below, under the
current rules neither contains interior mutability, since a value used
in the initial assignment did not contain `UnsafeCell` constructor.

```rust
#![feature(untagged_unions)]

union U { i: u32, c: std::cell::Cell<u32> }
const A: U = U { i: 0 };
const B: std::cell::Cell<u32> = unsafe { U { i: 0 }.c };
```

To avoid the issue, the changes here propose to consider the content of
a union as opaque and use type based qualification for union types.
2021-10-28 00:00:00 +00:00
Matthias Krüger
f32c09b82a
Rollup merge of #90304 - vandenheuvel:test_issue_75961, r=Mark-Simulacrum
Add regression test for #75961

Closes #75961.
Closes #21203.
2021-10-27 18:25:46 +02:00
Matthias Krüger
83d5c24071
Rollup merge of #90288 - JakobDegen:import_diagnostics, r=davidtwco
Add hint for people missing `TryFrom`, `TryInto`, `FromIterator` import pre-2021

Adds a hint anytime a `TryFrom`, `TryInto`, `FromIterator` import is suggested noting that these traits are automatically imported in Edition 2021.
2021-10-27 18:25:46 +02:00
Matthias Krüger
17d1742028
Rollup merge of #90267 - EliseZeroTwo:elisezerotwo/fix_invalid_attrs_ice, r=Aaron1011
fix: inner attribute followed by outer attribute causing ICE

Fixes #87936, #88938, and #89971.

This removes the assertion that validates that there are no outer attributes following inner attributes. Where the inner attribute is invalid you get an actual error.
2021-10-27 18:25:44 +02:00
bors
337e1565d3 Auto merge of #90186 - jsha:fix-header-sizes, r=GuillaumeGomez
Fix documentation header sizes

And add a rustdoc-gui test confirming various header sizes.

Split off from #90156. This fixes a regression in #89506 where the heading level of titles within Markdown was too high (h2) for docblocks under structs, unions, and enum impls.

r? `@camelid`

Demo: https://jacob.hoffman-andrews.com/rust/fix-header-sizes/std/string/struct.String.html#impl-Add%3C%26%27_%20str%3E
Stable: https://doc.rust-lang.org/stable/std/string/struct.String.html#impl-Add%3C%26%27_%20str%3E
Beta: https://doc.rust-lang.org/beta/std/string/struct.String.html#impl-Add%3C%26%27_%20str%3E
2021-10-27 12:27:47 +00:00
bors
a8f6e614f8 Auto merge of #89652 - rcvalle:rust-cfi, r=nagisa
Add LLVM CFI support to the Rust compiler

This PR adds LLVM Control Flow Integrity (CFI) support to the Rust compiler. It initially provides forward-edge control flow protection for Rust-compiled code only by aggregating function pointers in groups identified by their number of arguments.

Forward-edge control flow protection for C or C++ and Rust -compiled code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code share the same virtual address space) will be provided in later work as part of this project by defining and using compatible type identifiers (see Type metadata in the design document in the tracking issue #89653).

LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e., -Clto).

Thank you, `@eddyb` and `@pcc,` for all the help!
2021-10-27 09:19:42 +00:00
EliseZeroTwo
7f0d43a003
test: add test for inner attribute followed by outer attribute causing ICE 2021-10-27 10:13:25 +02:00
Ramon de C Valle
c5708caf6a Add documentation for LLVM CFI support
This commit adds initial documentation for LLVM Control Flow Integrity
(CFI) support to the Rust compiler (see #89652 and #89653).
2021-10-26 23:33:55 -07:00
bors
47aeac648e Auto merge of #90337 - matthiaskrgr:rollup-azkr158, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #90154 (rustdoc: Remove `GetDefId`)
 - #90232 (rustdoc: Use TTF based font instead of OTF for CJK glyphs to improve readability)
 - #90278 (rustdoc: use better highlighting for *const, *mut, and &mut)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-27 06:16:47 +00:00
Bram van den Heuvel
dae7c36b42 Add regression test for #75961 2021-10-27 07:46:42 +02:00
Matthias Krüger
96c0e71788
Rollup merge of #90278 - notriddle:notriddle/highlight-ptr, r=jyn541,GuillaumeGomez
rustdoc: use better highlighting for *const, *mut, and &mut

This generates more consistent HTML for these RefKeyWord combinations.

Before:

![image](https://user-images.githubusercontent.com/1593513/138742752-7e00a3f7-4621-4c62-82d1-3e4c2ef503d1.png)

After:

![image](https://user-images.githubusercontent.com/1593513/138743955-90abcdcd-fc88-4e2f-95bb-c1b1635c0001.png)
2021-10-27 06:11:38 +02:00
Matthias Krüger
60cad9789c
Rollup merge of #90232 - konan8205:master, r=GuillaumeGomez
rustdoc: Use TTF based font instead of OTF for CJK glyphs to improve readability

Due to Windows' implementation of font rendering, OpenType fonts can be distorted. So the existing font, Noto Sans KR, is not very readable on Windows. This PR improves readability of Korean glyphs on Windows.

## Before
![원1](https://user-images.githubusercontent.com/11029378/138592394-16b15787-532d-4421-a5eb-ed85675290fa.png)

## After
![원2](https://user-images.githubusercontent.com/11029378/138592409-f3a440ee-f0fc-40e4-9561-42c479439c9f.png)

The fonts included in this PR are licensed under the SIL Open Font License and generated with these commands:

```sh
pyftsubset NanumBarunGothic.ttf \
--unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \
--output-file=NanumBarunGothic.ttf.woff --flavor=woff
```
```sh
pyftsubset NanumBarunGothic.ttf \
--unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \
--output-file=NanumBarunGothic.ttf.woff2 --flavor=woff2
```

r? ``@GuillaumeGomez``
2021-10-27 06:11:36 +02:00
Matthias Krüger
e3eebfeea6
Rollup merge of #90154 - camelid:remove-getdefid, r=jyn514
rustdoc: Remove `GetDefId`

See the individual commit messages for details.

r? `@jyn514`
2021-10-27 06:11:35 +02:00
bors
a9b2bfb5ed Auto merge of #89937 - JohnTitor:fix-89875, r=Amanieu
Properly check `target_features` not to trigger an assertion

Fixes #89875
I think it should be a condition instead of an assertion to check if it's a register as it's possible that `reg` is a register class.
Also, this isn't related to the issue directly, but `is_target_supported` doesn't check `target_features` attributes. Is there any way to check it on rustc_codegen_llvm?

r? `@Amanieu`
2021-10-27 03:08:47 +00:00
Jakob Degen
cb336f1f67 Reverting switching test to no_std and adjust output after rebase. 2021-10-26 22:30:15 -04:00
Jakob Degen
e41ef36435 Fix line numbers in test 2021-10-26 22:17:01 -04:00
Jakob Degen
6ce3ae4b73 Make ui/suggestions/suggest-tryinto-edition-change.rs no_std to avoid getting inconsistent output between local and CI. 2021-10-26 22:17:01 -04:00
Jakob Degen
958e645946 Adds hint if a trait fails to resolve and a newly added one in Edition 2021 is suggested 2021-10-26 22:17:01 -04:00
Jakob Degen
e91d5ca197 Add test checking that Edition 2021 is suggested for .try_into() and fix other test 2021-10-26 22:17:01 -04:00
Matthias Krüger
fcc9a9a928
Rollup merge of #90305 - vandenheuvel:test_issue_87258, r=Mark-Simulacrum
Add regression test for #87258

Closes #87258.
2021-10-26 19:32:46 +02:00
Matthias Krüger
40d3819a3c
Rollup merge of #90303 - WaffleLapkin:regression_test_90164, r=JohnTitor
Add regression test for issue 90164

Closes #90164 (previously fixed by #90181)
2021-10-26 19:32:45 +02:00
Matthias Krüger
76392fbaf3
Rollup merge of #90302 - GuillaumeGomez:rm-unneeded-into_iter, r=jyn514
Remove unneeded into_iter

As ``@camelid`` mentionned [here](https://github.com/rust-lang/rust/pull/89430#discussion_r735889324), the `into_iter` was unneeded.

r? ``@camelid``
2021-10-26 19:32:44 +02:00
Bram van den Heuvel
f9344296c1 Add regression test for #87258 2021-10-26 16:35:48 +02:00
Maybe Waffle
60ffac07cb Add regression test for issue 90164 2021-10-26 13:23:27 +03:00
Guillaume Gomez
cdee839696 Remove unneeded into_iter 2021-10-26 11:50:52 +02:00
bors
c7a30c8b68 Auto merge of #90075 - pierwill:fix-79717, r=petrochenkov
Edit error messages for `rustc_resolve::AmbiguityKind` variants

Edit the language of the ambiguity descriptions for E0659. These strings now appear as notes.

Closes #79717.
2021-10-26 07:57:51 +00:00
Tomasz Miąsko
93f85f5a9d Consider indirect mutation during const qualification dataflow
Previously a local would be qualified if either one of two separate data
flow computations indicated so. First determined if a local could
contain the qualif, but ignored any forms of indirect mutation. Second
determined if a local could be mutably borrowed (and so indirectly
mutated), but which in turn ignored the qualif.

The end result was incorrect because the effect of indirect mutation was
effectivelly ignored in the all but the final stage of computation.

In the new implementation the indirect mutation is directly incorporated
into the qualif data flow. The local variable becomes immediately
qualified once it is mutably borrowed and borrowed place type can
contain the qualif.

In general we will now reject additional programs, program that were
prevously unintentionally accepted.

There are also some cases which are now accepted but were previously
rejected, because previous implementation didn't consider whether
borrowed place could have the qualif under the consideration.
2021-10-26 08:20:01 +02:00
Matthias Krüger
897b5dfeee
Rollup merge of #90295 - ehuss:update-cargo, r=ehuss
Update cargo

4 commits in 7fbbf4e8f23e3c24b8afff541dcb17e53eb5ff88..6c1bc24b8b49d4bc965f67d7037906dc199c72b7
2021-10-19 02:16:48 +0000 to 2021-10-24 17:51:41 +0000
- Fix a clippy warning (rust-lang/cargo#10002)
- Upgrade Cargo to the 2021 edition (rust-lang/cargo#10000)
- Don't canonicalize executable path (rust-lang/cargo#9991)
- Bump to 0.59.0, update changelog (rust-lang/cargo#9998)
2021-10-26 06:14:09 +02:00
Matthias Krüger
02a06ad7f4
Rollup merge of #90294 - ehuss:update-books, r=ehuss
Update books

## nomicon

3 commits in 2d66852a27c5d0ec50ae021820d1de22caa2b1bd..358e6a61d5f4f0496d0a81e70cdcd25d05307342
2021-10-07 19:00:37 +0900 to 2021-10-20 11:23:12 -0700
- Write a basic "call Rust from C" example (rust-lang/nomicon#296)
- Clarify the Safe vs. Unsafe Rust relationship (rust-lang/nomicon#294)
- Fix typo with respect to dangling pointer (rust-lang/nomicon#319)

## book

8 commits in eb1282ec444db94055fa9531b6f3f803e86bb382..fd9299792852c9a368cb236748781852f75cdac6
2021-09-16 21:17:09 -0400 to 2021-10-22 21:59:46 -0400
- Reword description to emphasize what return does in a match arm
- Correct backwards wording describing From impls. Fixes rust-lang/book#2829
- Remove multiple negatives, add examples. Fixes rust-lang/book#2833
- Fix capitalization in sidebar. Fixes rust-lang/book#2860
- fix quotes
- comments from nostarch and responses for chapter 2
-  (rust-lang/book#2906)
- Merge pull request rust-lang/book#2892 from Enrico2/patch-1

## rust-by-example

1 commits in 9a60624fcad0140826c44389571dc622917cd632..27f1ff5e440ef78828b68ab882b98e1b10d9af32
2021-10-04 08:13:53 -0300 to 2021-10-13 08:04:40 -0300
- Added example of `impl Trait` as an argument (rust-lang/rust-by-example#1468)

## embedded-book

1 commits in 270fccd339e5972d9c900e788f197e81a0bcd956..51739471276b1776dea27cf562b974ef07e24685
2021-10-06 16:28:48 +0000 to 2021-10-17 16:48:42 +0000
- Fix typo in 'The Borrow Checker'  (rust-embedded/book#305)
2021-10-26 06:14:08 +02:00
Matthias Krüger
fc8df9b0b8
Rollup merge of #90241 - DrMeepster:thiscall_lint_upgrade, r=petrochenkov
Make thiscall abi on unsupported platforms a hard error

As suggested in https://github.com/rust-lang/rust/issues/42202#issuecomment-950205016, this PR makes use of the `thiscall` abi on unsupported a hard error instead of a lint.
2021-10-26 06:14:07 +02:00
Matthias Krüger
b0df3af5c3
Rollup merge of #90181 - notriddle:notriddle/error-pointer, r=estebank
fix(rustc_typeck): report function argument errors on matching type

Fixes #90101
2021-10-26 06:14:06 +02:00
David Tolnay
c5025f0e4e
Append .0 to unsuffixed float if it would otherwise become int token 2021-10-25 20:30:47 -07:00
Eric Huss
5001cd04a8 Update cargo 2021-10-25 20:30:21 -07:00
Eric Huss
f4c0513f33 Update books 2021-10-25 19:51:09 -07:00
Yuki Okushi
bd309e4628
Add a regression test for issue-89875 2021-10-26 11:02:51 +09:00
Shinwoo Park
9e00501c1c rustdoc: use ttf based font for cjk glyphs 2021-10-26 10:58:13 +09:00
pierwill
7de1ff1ba8 Edit error messages for rustc_resolve::AmbiguityKind variants
Emit description of the ambiguity as a note.

Co-authored-by: Noah Lev <camelidcamel@gmail.com>
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2021-10-25 20:33:07 -05:00
bors
17e13b549f Auto merge of #85830 - bjorn3:separate_provide_extern, r=cjgillot
Avoid a branch on key being local for queries that use the same local and extern providers

Currently based on https://github.com/rust-lang/rust/pull/85810 as it slightly conflicts with it. Only the last two commits are new.
2021-10-26 00:38:58 +00:00
Jacob Hoffman-Andrews
89276ff7ed Fix documentation header sizes
And add a rustdoc-gui test confirming various header sizes.
2021-10-25 16:26:17 -07:00
Ramon de C Valle
5d30e93189 Add LLVM CFI support to the Rust compiler
This commit adds LLVM Control Flow Integrity (CFI) support to the Rust
compiler. It initially provides forward-edge control flow protection for
Rust-compiled code only by aggregating function pointers in groups
identified by their number of arguments.

Forward-edge control flow protection for C or C++ and Rust -compiled
code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code
share the same virtual address space) will be provided in later work as
part of this project by defining and using compatible type identifiers
(see Type metadata in the design document in the tracking issue #89653).

LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e.,
-Clto).
2021-10-25 16:23:01 -07:00
DrMeepster
a46daf050b make thiscall on unsupported platforms an error 2021-10-25 14:56:21 -07:00
bors
ffba430924 Auto merge of #90282 - matthiaskrgr:rollup-c6trbff, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #89581 (Add -Z no-unique-section-names to reduce ELF header bloat.)
 - #90196 (Fix and extent ControlFlow `traverse_inorder` example)
 - #90255 (⬆️ rust-analyzer)
 - #90266 (Prevent duplicate caller bounds candidates by exposing default substs in Unevaluated)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-25 21:33:13 +00:00
Matthias Krüger
26e9a719f2
Rollup merge of #90266 - b-naber:uneval_substs, r=lcnr
Prevent duplicate caller bounds candidates by exposing default substs in Unevaluated

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

The changes introduced in https://github.com/rust-lang/rust/pull/87280 allowed for "duplicate" caller bounds candidates to be assembled that only differed in their default substs having been "exposed" or not and resulted in an ambiguity error during trait selection. To fix this we expose the defaults substs during the creation of the ParamEnv.

r? `@lcnr`
2021-10-25 22:59:49 +02:00
Matthias Krüger
d35ecb949e
Rollup merge of #90255 - lnicola:rust-analyzer-2021-10-25, r=lnicola
⬆️ rust-analyzer

r? ~~``@ghose~~`` sorry, ``@ghost``
2021-10-25 22:59:48 +02:00
Matthias Krüger
2f67647606
Rollup merge of #89581 - jblazquez:master, r=Mark-Simulacrum
Add -Z no-unique-section-names to reduce ELF header bloat.

This change adds a new compiler flag that can help reduce the size of ELF binaries that contain many functions.

By default, when enabling function sections (which is the default for most targets), the LLVM backend will generate different section names for each function. For example, a function `func` would generate a section called `.text.func`. Normally this is fine because the linker will merge all those sections into a single one in the binary. However, starting with [LLVM 12](https://github.com/llvm/llvm-project/commit/ee5d1a04), the backend will also generate unique section names for exception handling, resulting in thousands of `.gcc_except_table.*` sections ending up in the final binary because some linkers like LLD don't currently merge or strip these EH sections (see discussion [here](https://reviews.llvm.org/D83655)). This can bloat the ELF headers and string table significantly in binaries that contain many functions.

The new option is analogous to Clang's `-fno-unique-section-names`, and instructs LLVM to generate the same `.text` and `.gcc_except_table` section for each function, resulting in a smaller final binary.

The motivation to add this new option was because we have a binary that ended up with so many ELF sections (over 65,000) that it broke some existing ELF tools, which couldn't handle so many sections.

Here's our old binary:

```
$ readelf --sections old.elf | head -1
There are 71746 section headers, starting at offset 0x2a246508:

$ readelf --sections old.elf | grep shstrtab
  [71742] .shstrtab      STRTAB          0000000000000000 2977204c ad44bb 00      0   0  1
```

That's an 11MB+ string table. Here's the new binary using this option:

```
$ readelf --sections new.elf | head -1
There are 43 section headers, starting at offset 0x29143ca8:

$ readelf --sections new.elf | grep shstrtab
  [40] .shstrtab         STRTAB          0000000000000000 29143acc 0001db 00      0   0  1
```

The whole binary size went down by over 20MB, which is quite significant.
2021-10-25 22:59:46 +02:00
Michael Howell
8520105464 fix(rustc_typeck): report function argument errors on matching type
Fixes #90101
2021-10-25 12:23:52 -07:00
bors
29b1248025 Auto merge of #89430 - GuillaumeGomez:rustdoc-clippy-lints, r=jyn514,camelid,notriddle
Fix clippy lints in librustdoc

I ran clippy on librustdoc and simply fixed the lints. :)

r? `@notriddle`
2021-10-25 18:24:33 +00:00
Michael Howell
3a79370367 rustdoc: use better highlighting for *const, *mut, and &mut
This generates more consistent HTML for these RefKeyWord combinations.

Before:

![image](https://user-images.githubusercontent.com/1593513/138742752-7e00a3f7-4621-4c62-82d1-3e4c2ef503d1.png)

After:

![image](https://user-images.githubusercontent.com/1593513/138743955-90abcdcd-fc88-4e2f-95bb-c1b1635c0001.png)
2021-10-25 11:13:43 -07:00
bors
84c2a8505d Auto merge of #90265 - GuillaumeGomez:rollup-gx3ficp, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #90017 (Add a couple tests for normalize under binder issues)
 - #90079 (enable `i8mm` target feature on aarch64 and arm)
 - #90233 (Tooltip overflow)
 - #90257 (Changed slice.swap documentation for better readability)
 - #90261 (Move back to linux builder on try builds)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-25 14:40:45 +00:00
Guillaume Gomez
21af58173f
Rollup merge of #90261 - Mark-Simulacrum:fix-try, r=pietroalbini
Move back to linux builder on try builds

Apparently deleted the wrong line when trying to revert changes to try in #90100 which I now see still contains the do not merge commit -- maybe I forgot to force push the local changes I had pending or something.

r? `@pietroalbini`
2021-10-25 16:34:55 +02:00
Guillaume Gomez
6c0dcb41bd
Rollup merge of #90233 - GuillaumeGomez:tooltip-overflow, r=camelid
Tooltip overflow

Fixes #89185.

r? ``@camelid``
2021-10-25 16:34:53 +02:00
Guillaume Gomez
2d85c7eea0
Rollup merge of #90017 - jackh726:issue-tests, r=nikomatsakis
Add a couple tests for normalize under binder issues

Closes #56556
Closes #76956

r? ``@nikomatsakis``
2021-10-25 16:34:52 +02:00
b-naber
0199a81304 add tests 2021-10-25 16:05:03 +02:00
Mark Rousskov
00bca4e957 Move back to linux builder on try builds 2021-10-25 09:38:24 -04:00
bjorn3
13abc1ae30 Fix test 2021-10-25 15:15:05 +02:00
bors
235d9853d8 Auto merge of #90042 - pietroalbini:1.56-master, r=Mark-Simulacrum
Bump bootstrap compiler to 1.57

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

r? `@Mark-Simulacrum`
2021-10-25 11:31:47 +00:00
Laurențiu Nicola
25a82fdb32 ⬆️ rust-analyzer 2021-10-25 13:30:24 +03:00
Guillaume Gomez
345519baa7 Fix scrollbars appearing on information tooltip on mac when they shouldn't 2021-10-25 11:40:13 +02:00
Guillaume Gomez
4614ca4541 Fix clippy lints in librustdoc 2021-10-25 11:30:09 +02:00
Matthias Krüger
915822496d
Rollup merge of #90143 - camelid:tidy-2021-followup, r=Mark-Simulacrum
tidy: Remove submodules from edition exception list

Both style-check and date-check are now on the 2021 edition, and this
PR also updates their repositories' submodules.

cc rust-lang/rustc-dev-guide#1238
cc rust-lang/reference#1099
cc https://github.com/rust-lang/rust/pull/89103#discussion_r711783714
2021-10-25 07:54:15 +02:00
Matthias Krüger
c734a9e076
Rollup merge of #90127 - JohnTitor:fix-90113, r=estebank
Do not mention a reexported item if it's private

Fixes #90113
The _actual_ regression was introduced in #73652, then #88838 made it worse. This fixes the issue by not counting such an import as a candidate.
2021-10-25 07:54:13 +02:00
Matthias Krüger
b25172b504
Rollup merge of #89889 - estebank:unmet-send-bound-on-foreign-future, r=tmandry
Use the "nice E0277 errors"[1] for `!Send` `impl Future` from foreign crate

Partly address #78543 by making the error quieter.

We don't have access to the `typeck` tables from foreign crates, so we
used to completely skip the new code when checking foreign crates. Now,
we carry on and don't provide as nice output (we don't clarify *what* is
making the `Future: !Send`), but at least we no longer emit a sea of
derived obligations in the output.

[1]: https://blog.rust-lang.org/inside-rust/2019/10/11/AsyncAwait-Not-Send-Error-Improvements.html

r? `@tmandry`
2021-10-25 07:54:12 +02:00
bors
41d8c94d45 Auto merge of #89427 - estebank:collect-overlapping-impls, r=jackh726
Point at overlapping impls when type annotations are needed

Address https://github.com/rust-lang/rust/issues/89254.
2021-10-24 22:26:41 +00:00
Noah Lev
f410bc7dc1 tidy: Remove submodules from edition exception list
Both style-check and date-check are now on the 2021 edition, and this
commit also updates their repositories' submodules.
2021-10-24 14:07:46 -07:00
Esteban Kuber
6dcff4e9f6 Use the "nice E0277 errors"[1] for !Send impl Future from foreign crate
Partly address #78543 by making the error quieter.

We don't have access to the `typeck` tables from foreign crates, so we
used to completely skip the new code when checking foreign crates. Now,
we carry on and don't provide as nice output (we don't clarify *what* is
making the `Future: !Send`), but at least we no longer emit a sea of
derived obligations in the output.

[1]: https://blog.rust-lang.org/inside-rust/2019/10/11/AsyncAwait-Not-Send-Error-Improvements.html
2021-10-24 20:45:33 +00:00
Esteban Kuber
881a50c0b7 Always sort suggestions before emitting them 2021-10-24 20:28:44 +00:00
Esteban Kuber
ef212e7fb3 Point at overlapping impls when type annotations are needed 2021-10-24 18:33:04 +00:00
bors
00d5e42e77 Auto merge of #90235 - matthiaskrgr:rollup-7pqtevk, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #89558 (Add rustc lint, warning when iterating over hashmaps)
 - #90100 (Skip documentation for tier 2 targets on dist-x86_64-apple-darwin)
 - #90155 (Fix alignment of method headings for scannability)
 - #90162 (Mark `{array, slice}::{from_ref, from_mut}` as const fn)
 - #90221 (Fix ICE when forgetting to `Box` a parameter to a `Self::func` call)
 - #90234 (Temporarily turn overflow checks off for rustc-rayon-core)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-24 14:12:10 +00:00
Matthias Krüger
d576393e34
Rollup merge of #90221 - JakobDegen:issue-90213, r=cjgillot
Fix ICE when forgetting to `Box` a parameter to a `Self::func` call

Closes #90213 .

Assuming we can get the `DefId` of the receiver causes an ICE if the receiver is `Self`. We can just avoid doing this though.
2021-10-24 15:48:45 +02:00
Matthias Krüger
b837605012
Rollup merge of #90155 - jsha:outdent-methods, r=GuillaumeGomez,camelid
Fix alignment of method headings for scannability

We sometimes use indentation to indicate something is a heading: The section that comes after is indented by 24px relative to the heading. However, the relationship between the "Implementations" section heading, the `impl` headings it contains, and the `pub fn` subheadings within each impl, is awkward. It goes **Implementations**, 15px indent, `impl`, 5px indent, `pub fn`, 4px indent, docblock.

I line up `impl` and `pub fn` with the `Implementations` heading, give `impl` a larger font size to indicate it is higher in the hierarchy, and indent the docblock a full 24px relative to their parent, matching the indents we use elsewhere to distinguish section headings. By letting the `pub fn` stick out to the left of the docblock, I think this makes methods significantly more scannable.

Related to #59829

r? `````@camelid`````

[Old](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations):

[![image](https://user-images.githubusercontent.com/220205/138380233-9c63a0f2-0f80-40a3-ab3d-a1ee9fb7c5d8.png)](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations)

[New](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations):

[![image](https://user-images.githubusercontent.com/220205/138392479-b45fce3f-bf43-42e0-81ee-c4bb9ac35cda.png)](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations)
2021-10-24 15:48:44 +02:00
Matthias Krüger
d814af95ba
Rollup merge of #90100 - Mark-Simulacrum:speed-macos-ci, r=pietroalbini
Skip documentation for tier 2 targets on dist-x86_64-apple-darwin

I don't have an easy way to test this locally, but I believe it should work. Based on one log result should shave ~14 minutes off the dist-x86_64-apple builder (doesn't help with aarch64 dist or x86_64 test builder, so not actually decreasing total CI time most likely).

r? ```@pietroalbini```
2021-10-24 15:48:43 +02:00
Matthias Krüger
87822b27ee
Rollup merge of #89558 - lcnr:query-stable-lint, r=estebank
Add rustc lint, warning when iterating over hashmaps

r? rust-lang/wg-incr-comp
2021-10-24 15:48:42 +02:00
Matthew Jasper
fabede1851 Add more tests for cross-crate hygiene 2021-10-24 12:31:42 +01:00
bors
ed08a67566 Auto merge of #85254 - cjgillot:reveal-mir, r=lcnr
Normalize MIR with RevealAll before optimizations.

Fixes #78442
2021-10-24 11:04:54 +00:00
Jakob Degen
4b970231fd Fix ICE when forgetting to Box a parameter to a Self::func call 2021-10-24 00:33:29 -04:00
Jakob Degen
eae42fd9d0 Add regresstion test for #90024.
Uses 2 MCVEs from the issue tracker that test opposite sides of the problem.
2021-10-23 22:36:50 -04:00
Pietro Albini
aca8bcb48f remove "field is never read" warning 2021-10-23 21:55:57 -04:00
Pietro Albini
5d088abfb3 bump boostrap compiler 2021-10-23 21:55:57 -04:00
bors
a99c9d6518 Auto merge of #89776 - rusticstuff:ci-overflow-checks, r=Mark-Simulacrum
CI: Enable overflow checks for test (non-dist) builds

They stay disabled for Apple builds though, which take the most time already due to running on slow hw.
2021-10-24 01:21:48 +00:00
bors
45591408b1 Auto merge of #90175 - cuviper:min-llvm-12, r=nagisa
Update the minimum external LLVM to 12

With this change, we'll have stable support for LLVM 12 and 13.
For reference, the previous increase to LLVM 10 was #83387,
and this replaces the pending increase to LLVM 11 in #90062.

r? `@nagisa` `@nikic`
2021-10-23 20:59:29 +00:00
Jacob Hoffman-Andrews
542ab2daa6 Outdent method headings so they stand out
The makes the heading / documentation distinction clearer.
2021-10-23 11:50:11 -07:00
Josh Stone
8b1504cfb7 bless the line changes in ui/asm/aarch64/srcloc.rs 2021-10-23 10:16:09 -07:00
bors
91b931926f Auto merge of #90203 - matthiaskrgr:rollup-v215wew, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #85833 (Scrape code examples from examples/ directory for Rustdoc)
 - #88041 (Make all proc-macro back-compat lints deny-by-default)
 - #89829 (Consider types appearing in const expressions to be invariant)
 - #90168 (Reset qualifs when a storage of a local ends)
 - #90198 (Add caveat about changing parallelism and function call overhead)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-23 15:53:50 +00:00
Mateusz Mikuła
a076f2b9b4 Repace use of static_nobundle with native_link_modifiers
This fixes warning when building Rust and running tests:
```
warning: library kind `static-nobundle` has been superseded by specifying `-bundle` on library kind `static`. Try `static:-bundle`
warning: `rustc_llvm` (lib) generated 2 warnings (1 duplicate)
```
2021-10-23 15:51:22 +02:00
Matthias Krüger
74a0c492c1
Rollup merge of #90168 - tmiasko:const-qualif-storage, r=matthewjasper
Reset qualifs when a storage of a local ends

Reset qualifs when a storage of a local ends to ensure that the local qualifs
are affected by the state from previous loop iterations only if the local is
kept alive.

The change should be forward compatible with a stricter handling of indirect
assignments, since storage dead invalidates all existing pointers to the local.
2021-10-23 14:58:42 +02:00
Matthias Krüger
2b874f0242
Rollup merge of #89829 - voidc:assoc-const-variance, r=lcnr
Consider types appearing in const expressions to be invariant

This is an approach to fix #80977.
Currently, a type parameter which is only used in a constant expression is considered bivariant and will trigger error E0392 *"parameter T is never used"*.
Here is a short example:

```rust
pub trait Foo {
    const N: usize;
}

struct Bar<T: Foo>([u8; T::N])
where [(); T::N]:;
```
([playgound](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=b51a272853f75925e72efc1597478aa5))

While it is possible to silence this error by adding a `PhantomData<T>` field, I think the better solution would be to make `T` invariant.
This would be analogous to the invariance constraints added for associated types.
However, I'm quite new to the compiler and unsure whether this is the right approach.

r? ``@varkor`` (since you authored #60058)
2021-10-23 14:58:41 +02:00
Matthias Krüger
17c602d423
Rollup merge of #88041 - Aaron1011:deny-proc-macro-hack, r=wesleywiser
Make all proc-macro back-compat lints deny-by-default

The affected crates have had plenty of time to update.
By keeping these as lints rather than making them hard errors,
we ensure that downstream crates will still be able to compile,
even if they transitive depend on broken versions of the affected
crates.

This should hopefully discourage anyone from writing any
new code which relies on the backwards-compatibility behavior.
2021-10-23 14:58:40 +02:00
Matthias Krüger
dcf9242795
Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514
Scrape code examples from examples/ directory for Rustdoc

Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123

Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525

Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
2021-10-23 14:58:39 +02:00
bors
aa5740c715 Auto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakis
Implement coherence checks for negative trait impls

The main purpose of this PR is to be able to [move Error trait to core](https://github.com/rust-lang/project-error-handling/issues/3).

This feature is necessary to handle the following from impl on box.

```rust
impl From<&str> for Box<dyn Error> { ... }
```

Without having negative traits affect coherence moving the error trait into `core` and moving that `From` impl to `alloc` will cause the from impl to no longer compiler because of a potential future incompatibility. The compiler indicates that `&str` _could_ introduce an `Error` impl in the future, and thus prevents the `From` impl in `alloc` that would cause overlap with `From<E: Error> for Box<dyn Error>`. Adding `impl !Error for &str {}` with the negative trait coherence feature will disable this error by encoding a stability guarantee that `&str` will never implement `Error`, making the `From` impl compile.

We would have this in `alloc`:

```rust
impl From<&str> for Box<dyn Error> {} // A
impl<E> From<E> for Box<dyn Error> where E: Error {} // B
```

and this in `core`:

```rust
trait Error {}
impl !Error for &str {}
```

r? `@nikomatsakis`

This PR was built on top of `@yaahc` PR #85764.

Language team proposal: to https://github.com/rust-lang/lang-team/issues/96
2021-10-23 12:51:15 +00:00
Tomasz Miąsko
e4aeeca667 Reset qualifs when a storage of a local ends
to ensure that the local qualifs are affected by the state from previous
loop iterations only if the local is kept alive.

The change should be forward compatible with a stricter handling of
indirect assignments, since storage dead invalidates all existing
pointers to the local.
2021-10-23 09:26:22 +02:00
bors
cf708558b7 Auto merge of #90188 - matthiaskrgr:rollup-74cwv5c, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #83233 (Implement split_array and split_array_mut)
 - #88300 (Stabilise unix_process_wait_more, extra ExitStatusExt methods)
 - #89416 (nice_region_error: Include lifetime placeholders in error output)
 - #89468 (Report fatal lexer errors in `--cfg` command line arguments)
 - #89730 (add feature flag for `type_changing_struct_update`)
 - #89920 (Implement -Z location-detail flag)
 - #90070 (Add edition configuration to compiletest)
 - #90087 (Sync rustfmt subtree)
 - #90117 (Make RSplit<T, P>: Clone not require T: Clone)
 - #90122 (CI: make docker cache download and `docker load` time out after 10 minutes)
 - #90166 (Add comment documenting why we can't use a simpler solution)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-23 06:13:18 +00:00
Matthias Krüger
1ea34fb463
Rollup merge of #90122 - rusticstuff:ci_curl_max_time, r=Mark-Simulacrum
CI: make docker cache download and `docker load` time out after 10 minutes

Might help to prevent timeouts we have been seeing:
* https://github.com/rust-lang-ci/rust/runs/3946294286?check_suite_focus=true#step:25:23
* https://github.com/rust-lang-ci/rust/runs/3956799200?check_suite_focus=true#step:25:22
* https://github.com/rust-lang-ci/rust/runs/3962928502?check_suite_focus=true#step:25:23
* https://github.com/rust-lang-ci/rust/runs/3967892291?check_suite_focus=true
* https://github.com/rust-lang-ci/rust/runs/3971202204?check_suite_focus=true

If the download or loading the images into docker times out the CI will still continue and rebuild the docker image from scratch.
2021-10-23 05:28:27 +02:00
Matthias Krüger
270c800d35
Rollup merge of #90117 - calebsander:fix/rsplit-clone, r=yaahc
Make RSplit<T, P>: Clone not require T: Clone

This addresses a TODO comment. The behavior of `#[derive(Clone)]` *does* result in a `T: Clone` requirement. Playground example:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a8b1a9581ff8893baf401d624a53d35b

Add a manual `Clone` implementation, mirroring `Split` and `SplitInclusive`.
`(R)?SplitN(Mut)?` don't have any `Clone` implementations, but I'll leave that for its own pull request.
2021-10-23 05:28:26 +02:00
Matthias Krüger
c400feeb84
Rollup merge of #90087 - calebcartwright:rustfmt-subtree, r=calebcartwright
Sync rustfmt subtree

There's a large number of small fixes and new features, but nothing too big. Detailed changelog for those interested can be found in https://github.com/rust-lang/rustfmt/blob/master/CHANGELOG.md#1438-2021-10-20
2021-10-23 05:28:25 +02:00
Matthias Krüger
1782d1333c
Rollup merge of #90070 - llogiq:compiletest-config-edition, r=Mark-Simulacrum
Add edition configuration to compiletest

This allows the compiletest configuration to set a default edition that can still be overridden with header annotations. Doing this will make it far easier for clippy to get our tests to the newest edition.

r? ```@Manishearth```
2021-10-23 05:28:24 +02:00
Matthias Krüger
8fb194c86f
Rollup merge of #89920 - hudson-ayers:location-detail-control, r=davidtwco
Implement -Z location-detail flag

This PR implements the `-Z location-detail` flag as described in https://github.com/rust-lang/rfcs/pull/2091 .

`-Z location-detail=val` controls what location details are tracked when using `caller_location`. This allows users to control what location details are printed as part of panic messages, by allowing them to exclude any combination of filenames, line numbers, and column numbers. This option is intended to provide users with a way to mitigate the size impact of `#[track_caller]`.

Some measurements of the savings of this approach on an embedded binary can be found here: https://github.com/rust-lang/rust/issues/70579#issuecomment-942556822 .

Closes #70580 (unless people want to leave that open as a place for discussion of further improvements).

This is my first real PR to rust, so any help correcting mistakes / understanding side effects / improving my tests is appreciated :)

I have one question: RFC 2091 specified this as a debugging option (I think that is what -Z implies?). Does that mean this can never be stabilized without a separate MCP? If so, do I need to submit an MCP now, or is the initial RFC specifying this option sufficient for this to be merged as is, and then an MCP would be needed for eventual stabilization?
2021-10-23 05:28:23 +02:00
Matthias Krüger
736e8ebd1c
Rollup merge of #89730 - crlf0710:type_changing_feature, r=jackh726
add feature flag for `type_changing_struct_update`

This implements the PR0 part of the mentoring notes within #86618.

overrides the previous inactive #86646 pr.

r? ```@nikomatsakis```
2021-10-23 05:28:22 +02:00
Matthias Krüger
0f81c7faf5
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
Report fatal lexer errors in `--cfg` command line arguments

Fixes #89358. The erroneous behavior was apparently introduced by `@Mark-Simulacrum` in a678e31911; the idea is to silence individual parser errors and instead emit one catch-all error message after parsing. However, for the example in #89358, a fatal lexer error is created here:
edebf77e00/compiler/rustc_parse/src/lexer/mod.rs (L340-L349)

This fatal error aborts the compilation, and so the call to `new_parser_from_source_str()` never returns and the catch-all error message is never emitted. I have therefore changed the `SilentEmitter` to silence only non-fatal errors; with my changes, for the rustc invocation described in #89358:
```sh
rustc --cfg "abc\""
```
I get the following output:
```
error[E0765]: unterminated double quote string
  |
  = note: this error occurred on the command line: `--cfg=abc"`
```
2021-10-23 05:28:22 +02:00
bors
a3f7c4db03 Auto merge of #90054 - michaelwoerister:v0-mangling-in-compiler, r=Mark-Simulacrum
Make new symbol mangling scheme default for compiler itself.

As suggest in https://github.com/rust-lang/rust/pull/89917#issuecomment-945888574, this PR enables the new symbol mangling scheme for the compiler itself. The standard library is still compiled using the legacy mangling scheme so that the new symbol format does not show up in user code (yet).

r? `@Mark-Simulacrum`
2021-10-23 03:06:21 +00:00
Noah Lev
3ad0834700 Fix another place that used def_id_no_primitives() 2021-10-22 16:51:57 -07:00
Michael Howell
98ed5548d7 nice_region_error: Include lifetime placeholders in error output
As you can see in src/test/ui/traits/self-without-lifetime-constraint.stderr
you can get very confusing type names if you don't have this.

Fixes #87763
2021-10-22 15:26:20 -07:00
Noah Lev
865d99f82b docs: Escape brackets to satisfy the linkchecker
My change to use `Type::def_id()` (formerly `Type::def_id_full()`) in
more places caused some docs to show up that used to be missed by
rustdoc. Those docs contained unescaped square brackets, which triggered
linkcheck errors. This commit escapes the square brackets and adds this
particular instance to the linkcheck exception list.
2021-10-22 14:08:43 -07:00
Santiago Pastorino
9534186857
Hide negative coherence checks under negative_impls feature flag 2021-10-22 17:54:20 -03:00
Will Crichton
fd5d614b77 Move def_id logic into render_call_locations 2021-10-22 13:14:46 -07:00
Noah Lev
f93cf66507 Rename Type::def_id_full() to Type::def_id()
It should be preferred over `def_id_no_primitives()`, so it should have
a shorter name. I also put it before `def_id_no_primitives()` so that it
shows up first in the docs.
2021-10-22 13:07:43 -07:00
Noah Lev
6e3561e149 Rename Type::def_id() to Type::def_id_no_primitives()
The old name was confusing because it's easy to assume that using
`def_id()` is fine, but in some situations it's incorrect. In general,
`def_id_full()` should be preferred, so `def_id_full()` should have a
shorter name. That will happen in the next commit.
2021-10-22 13:07:43 -07:00
Noah Lev
0853c33c3b Use def_id_full() where easily possible
In general, it should be preferred over `Type::def_id()`. See each
method's docs for more.
2021-10-22 13:07:43 -07:00
Noah Lev
bf0cc90050 Replace GetDefId with inherent methods
Now that it's only implemented for `Type`, using inherent methods
instead means that imports are no longer necessary. Also, `GetDefId` is
only meant to be used with `Type`, so it shouldn't be a trait.
2021-10-22 13:07:43 -07:00
Noah Lev
7fb1306275 Remove unused impl of GetDefId for Option<T> 2021-10-22 13:07:43 -07:00
Noah Lev
6d82ee839d Remove GetDefId impl for FnRetTy
It was only used in one place, so it seems better to use ordinary
functions.
2021-10-22 13:07:42 -07:00
Will Crichton
d1c29c696e Revert def_id addition from clean::Function, add test for
scrape-examples options
2021-10-22 12:46:45 -07:00
Santiago Pastorino
9e264137e9
Be sure that we do not allow too much 2021-10-22 16:42:06 -03:00
Santiago Pastorino
da79fa964c
Add rustc_strict_coherence attribute and use it to check overlap 2021-10-22 15:49:46 -03:00
Josh Stone
e9f545b9a9 Update the minimum external LLVM to 12 2021-10-22 10:50:07 -07:00
Josh Stone
8b0e7095a0 llvm-dwp-11 fails on absolute paths 2021-10-22 09:22:18 -07:00
Josh Stone
65150af1b4 Update the minimum external LLVM to 11 2021-10-22 09:22:18 -07:00
Charles Lew
7d7ebf8805 add feature flag for type_changing_struct_update 2021-10-22 11:46:55 -04:00
Yuki Okushi
a741f682fe
Rollup merge of #90115 - samlich:test-issue-78561, r=oli-obk
Add test for issue #78561

Adds test for and closes #78561 which previously crashed compiler.
2021-10-22 19:42:52 +09:00
Yuki Okushi
49f2384513
Rollup merge of #90114 - BoxyUwU:cg_defaults_tests, r=lcnr
Add some tests for const_generics_defaults

I think this covers some of the stuff required for stabilisation report, some of these tests are probably covering stuff we already have but it can't hurt to have more :)

r? ````@lcnr````
2021-10-22 19:42:51 +09:00
Yuki Okushi
de306d77db
Rollup merge of #90078 - JohnTitor:test-83479, r=Mark-Simulacrum
Add a regression test for issue-83479

Add a regression test for https://github.com/rust-lang/rust/issues/83479#issue-841147340, but not close the issue, see https://github.com/rust-lang/rust/issues/83479#issuecomment-947255641.
2021-10-22 19:42:50 +09:00
Yuki Okushi
a656bc5b08
Rollup merge of #90069 - tmiasko:promoted-const-qualif, r=oli-obk
Fix const qualification when executed after promotion

The const qualification was so far performed before the promotion and
the implementation assumed that it will never encounter a promoted.

With `const_precise_live_drops` feature, checking for live drops is
delayed until after drop elaboration, which in turn runs after
promotion. so the assumption is no longer true. When evaluating
`NeedsNonConstDrop` it is now possible to encounter promoteds.

Use type base qualification for the promoted. It is a sound
approximation in general, and in the specific case of promoteds and
`NeedsNonConstDrop` it is precise.

Fixes #89938.
2021-10-22 19:42:49 +09:00
Yuki Okushi
9ed9025ea9
Rollup merge of #90028 - tmiasko:structural-match-closure, r=spastorino
Reject closures in patterns

Fixes #90013.
2021-10-22 19:42:48 +09:00
Yuki Okushi
327d8073e2
Rollup merge of #89922 - JohnTitor:update-e0637, r=jackh726
Update E0637 description to mention `&` w/o an explicit lifetime name

Deal with https://github.com/rust-lang/rust/issues/89824#issuecomment-941598647. Another solution would be splitting the error code into two as (I think) it's a bit unclear to users why they have the same error code.
2021-10-22 19:42:46 +09:00
Yuki Okushi
91fb223f59
Rollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwco
Don't mark for loop iter expression as desugared

We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at https://github.com/rust-lang/rust-clippy/pull/7789#issuecomment-939289501.
2021-10-22 19:42:45 +09:00
Yuki Okushi
8738d5d611
Rollup merge of #89257 - aDotInTheVoid:macro-error-2, r=estebank
Give better error for `macro_rules name`

follow up to #89221

r? ``@estebank``

``@rustbot`` modify labels: +A-diagnostics +A-parser
2021-10-22 19:42:43 +09:00
Caleb Sander
afcee19d88 Make RSplit<T, P>: Clone not require T: Clone
This addresses a TODO comment. The behavior of #[derive(Clone)]
*does* result in a T: Clone requirement.

Add a manual Clone implementation, matching Split and SplitInclusive.
2021-10-21 21:25:59 -07:00
Noah Lev
1da8659fa6 Remove unused impl of GetDefId for Typedef 2021-10-21 19:56:33 -07:00
Noah Lev
b987fd78c2 Fix docs for inline::build_impl
Based on looking at the source code, it looks like the `did` needs to be
for an impl, not functions in an impl.
2021-10-21 19:54:14 -07:00
bors
68a698baf6 Auto merge of #90126 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`

This adds a new dep to Clippy: [indoc](https://crates.io/crates/indoc)

And transitively: [unindent](https://crates.io/crates/unindent)
2021-10-21 23:31:13 +00:00
Caleb Cartwright
170214fa16 fix doc issue in rustfmt 2021-10-21 17:22:54 -05:00
Hans Kratz
3e6a69534f Time out docker load after 10 minutes, kill after 12 due to CI hangs. 2021-10-21 23:07:23 +02:00
Matthew Jasper
4ecb49eba3 Handle cross-crate module ExpnIds consistently
- Always use the ExpnId serialized to `tables`
- Use the Id for traits and enums from other crates in resolution.
2021-10-21 22:07:03 +01:00
Hudson Ayers
b802629311 add tests for -Zlocation-detail 2021-10-21 10:44:22 -07:00
Hudson Ayers
8090f67fb7 document the unstable location-detail flag 2021-10-21 10:44:13 -07:00
Mark Rousskov
9296efe3ef Print step timings for try builds 2021-10-21 09:16:16 -04:00
Yuki Okushi
3b2dd702fc
Do not mention a reexported item if it's private 2021-10-21 20:25:45 +09:00
flip1995
9af8e378b9
Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyup 2021-10-21 13:11:36 +02:00
Hans Kratz
5c8fca585c CI: Enable overflow checks for test (non-dist) builds 2021-10-21 13:10:52 +02:00
samlich
ab44e46345
Add test for issue #78561 2021-10-21 10:11:33 +00:00
Hans Kratz
838e673d3b Debug output before loading docker images as that might hang. 2021-10-21 11:40:32 +02:00
Hans Kratz
e1e273fb64 CI: make cache download attempt time out after 10 minutes 2021-10-21 11:39:57 +02:00
Yuki Okushi
68a5680fc5
Rollup merge of #90098 - GuillaumeGomez:add-test-foreign-impl-missing-doc-code-examples, r=jyn514
Add test to ensure that the missing_doc_code_examples is not triggered on foreign trait implementations

Fixes #76450.

r? ````@jyn514````
2021-10-21 14:11:12 +09:00
Yuki Okushi
759a8aee31
Rollup merge of #90097 - GuillaumeGomez:duplicated-sidebar-entry-reexported-macro, r=notriddle
Add test for duplicated sidebar entries for reexported macro

Fixes #90015.

r? ````@notriddle````
2021-10-21 14:11:11 +09:00
Yuki Okushi
47a1f67a8d
Rollup merge of #90048 - GuillaumeGomez:line-number-setting, r=jsha
Add test for line-number setting

The first commit updates the version of the package to be able to have multi-line commands (which looks much nicer for this test).

r? ````@jsha````
2021-10-21 14:11:08 +09:00
Yuki Okushi
632f06d8eb
Rollup merge of #90031 - durin42:allow-llvm-tests, r=Mark-Simulacrum
config: add the option to enable LLVM tests

I'm working on some LLVM patches in concert with a Rust patch, and it's
helping me quite a bit to have this as an option. It doesn't seem that
hard, so I figured I'd formalize it in x.py and send it upstream.
2021-10-21 14:11:07 +09:00
Yuki Okushi
a980587421
Rollup merge of #90029 - tgnottingham:incr-debug-logging-test, r=Mark-Simulacrum
Add test for debug logging during incremental compilation

Debug logging during incremental compilation had been broken for some
time, until #89343 fixed it (among other things). Add a test so this is
less likely to break without being noticed. This test is nearly a copy
of the `src/test/ui/rustc-rust-log.rs` test, but tests debug logging in
the incremental compliation code paths.
2021-10-21 14:11:06 +09:00
bors
4626184caf Auto merge of #89998 - camelid:box-default, r=jyn514
rustdoc: Box some fields of `GenericParamDefKind` to reduce size

This change shrinks `GenericParamDef` from 120 to 56 bytes. `GenericParamDef` is
used a lot, so the extra indirection should hopefully be worth the size savings.

r? `@ghost`
2021-10-21 01:38:55 +00:00
Ellen
e7a9e820d2 *dust dust* 2021-10-21 00:16:49 +01:00
Ellen
c75d8cb212 Ordering 2021-10-20 23:44:50 +01:00
Ellen
7a8bd2d133 add fixme 2021-10-20 23:37:36 +01:00
Ellen
8f237791d5 Inference 2021-10-20 23:36:50 +01:00
Ellen
83a1834c14 Wfness 2021-10-20 23:31:08 +01:00
Ellen
a81e489101 Return pos impl trait 2021-10-20 23:18:26 +01:00
Ellen
6469fba44e Trait objects 2021-10-20 22:56:53 +01:00
Andre Bogus
65b3c85317 Add edition configuration to compiletest 2021-10-20 21:55:34 +02:00
Mark Rousskov
5503dd9b0e [do not merge] try build 2021-10-20 14:43:23 -04:00
Mark Rousskov
9a3c02473b Skip documentation for tier 2 targets 2021-10-20 14:43:23 -04:00
Caleb Cartwright
d3ecb02bdd ensure cargo-fmt tests are excluded from root workspace 2021-10-20 10:12:22 -05:00
Santiago Pastorino
da8873e343
Only assemble_candidates_from_impls for polarity Negative 2021-10-20 12:10:46 -03:00
Santiago Pastorino
511076a102
Test that if we promise to not impl what would overlap it doesn't actually overlap 2021-10-20 12:10:45 -03:00
Guillaume Gomez
69ca324a53 Add test to ensure that the missing_doc_code_examples is not triggered on foreign trait implementations 2021-10-20 16:52:56 +02:00
bors
3d71e749a2 Auto merge of #90050 - michaelwoerister:fix-vtable-debug-name-crash-90019, r=wesleywiser
Erase late-bound regions before computing vtable debuginfo name.

Fixes #90019.

The `msvc_enum_fallback()` for computing enum type names needs to access the memory layout of niche enums in order to determine the type name. `compute_debuginfo_vtable_name()` did not properly erase regions before computing type names which made memory layout computation ICE when encountering un-erased regions.

r? `@wesleywiser`
2021-10-20 14:37:48 +00:00
Guillaume Gomez
50dc319ef0 Add test for duplicated sidebar entries for reexported macro 2021-10-20 15:44:16 +02:00
Guillaume Gomez
457f5782f3 Add test for line-number setting 2021-10-20 13:36:08 +02:00
Caleb Cartwright
714e904969 Merge commit 'efa8f5521d3813cc897ba29ea0ef98c7aef66bb6' into rustfmt-subtree 2021-10-20 00:11:59 -05:00
Caleb Cartwright
923126348d
Merge branch 'master' into 1.4.38-subtree 2021-10-19 23:01:25 -05:00
Chris Palmer
3bb40f2ea0
Make printed message match the code comment
I think this code is getting L0, not L1 cache size, if I'm reading the Intel manual right. (I might not be.) Either way, the code comment and the printed message should match, whichever way is right. :)
2021-10-19 20:40:09 -07:00
Chris Palmer
886f1f87f7
Fix minor typos 2021-10-19 20:23:34 -07:00
Will Crichton
8f80d86d85 Small scrape-example fixes 2021-10-19 20:08:30 -07:00
Yuki Okushi
396a4f4984
Increase ROOT_ENTRY_LIMIT to 1331 2021-10-20 11:28:11 +09:00
Yuki Okushi
21d02bf132
Add a regression test for issue-83479 2021-10-20 11:09:06 +09:00
Yuki Okushi
570b999c96
Rollup merge of #90036 - jsha:less-rule, r=GuillaumeGomez
Remove border-bottom from most docblocks.

Headings in the top-doc docblock still get a border-bottom due to a rule
that covers all h2, h3, and h4. Method docblocks are generally h5, and
so don't get a border-bottom anymore.

This fixes a problem where a sub-sub-heading within a method would have
a line that went all the way across the page, creating a division that
made that sub-sub-heading look much more important than it really is.

Fixes #90033

Demo at https://jacob.hoffman-andrews.com/rust/less-rule/std/string/struct.String.html

r? ``@GuillaumeGomez``
2021-10-20 04:35:17 +09:00
Yuki Okushi
d8b3764bd2
Rollup merge of #90025 - JohnTitor:revert-86011, r=estebank
Revert #86011 to fix an incorrect bound check

This reverts commit 36a1076d24, reversing
changes made to e1e9319d93.

Fixes #89935
r? ``@estebank``
2021-10-20 04:35:17 +09:00
Yuki Okushi
7ceab9ef14
Rollup merge of #90018 - GuillaumeGomez:too-long-item-names, r=jsha
Fix rustdoc UI for very long type names

Fixes #89972.

While working on it, I also discovered that when the item name is too long, it also breaks the flow of the page.

To make things right, I also renamed the `type-decl` CSS class into `item-decl` (because this PR also generates it for more than type declarations).

So here are the before/after screenshots:

![Screenshot from 2021-10-18 16-58-03](https://user-images.githubusercontent.com/3050060/137757247-637fcf04-4406-49c6-8a8a-18c2074aacd9.png)
![Screenshot from 2021-10-18 16-58-26](https://user-images.githubusercontent.com/3050060/137757252-17935e63-53b3-449f-a535-7be91ff0e257.png)

![Screenshot from 2021-10-18 16-58-07](https://user-images.githubusercontent.com/3050060/137757278-8b12e348-2980-4fc4-8853-bef99d58981f.png)
![Screenshot from 2021-10-18 16-58-28](https://user-images.githubusercontent.com/3050060/137757282-534a0e1b-3016-49ba-b3ac-e45bdb9035cb.png)

r? ``@jsha``
2021-10-20 04:35:15 +09:00
Yuki Okushi
f7024998c7
Rollup merge of #88860 - nbdd0121:panic, r=m-ou-se
Deduplicate panic_fmt

std's begin_panic_fmt and core's panic_fmt are duplicates. Merge them to declutter code and remove a lang item.
2021-10-20 04:35:14 +09:00
Tomasz Miąsko
c97cf7fed7 Reject closures in patterns 2021-10-19 20:45:43 +02:00
Wesley Wiser
5929cf0d67
Update src/test/codegen/debug-vtable.rs
Co-authored-by: r00ster <r00ster91@protonmail.com>
2021-10-19 11:36:21 -04:00
Gary Guo
7bd93dfeef Remove begin_panic_fmt from clippy 2021-10-19 15:15:59 +01:00
Michael Woerister
456283c95d Make new symbol mangling scheme default for compiler itself. 2021-10-19 14:58:21 +02:00
Michael Woerister
bf39d86e0f Erase late-bound regions before computing vtable debuginfo name. 2021-10-19 13:57:35 +02:00
bors
c2452de120 Auto merge of #90039 - ehuss:update-cargo, r=ehuss
Update cargo

6 commits in c7957a74bdcf3b11e7154c1a9401735f23ebd484..7fbbf4e8f23e3c24b8afff541dcb17e53eb5ff88
2021-10-11 20:17:07 +0000 to 2021-10-19 02:16:48 +0000
- Make future-incompat-report output more user-friendly (rust-lang/cargo#9953)
- Fix fetching git repos after a force push. (rust-lang/cargo#9979)
- Add rustc-link-args to doctest build (rust-lang/cargo#9916)
- Add the start of a basic benchmarking suite. (rust-lang/cargo#9955)
- Use forms for issue templates. (rust-lang/cargo#9970)
- Add rust_metadata to SerializedPackage (rust-lang/cargo#9967)
2021-10-19 11:19:54 +00:00
Guillaume Gomez
e8b5af1c0a Upgrade browser-ui-test version to 0.4.5 (it allows to have multi-line commands) 2021-10-19 11:25:39 +02:00
bors
d45ed7502a Auto merge of #90040 - nbdd0121:issue-90038, r=oli-obk
Fix wrong niche calculation when 2+ niches are placed at the start

When the niche is at the start, existing code incorrectly uses 1 instead of count for subtraction.

Fix #90038

`@rustbot` label: T-compiler
2021-10-19 08:13:35 +00:00
Gary Guo
7dbd5bb0bd Fix issue 90038 2021-10-19 06:43:33 +01:00