Commit graph

153750 commits

Author SHA1 Message Date
Mara Bos
e2abf06890 Fix lifetime generics in <T<..> as Trait>::try_from suggestion. 2021-08-30 19:02:06 +02:00
Mara Bos
a4f6d3e5c2 Fix lifetime generics in <T as Trait<..>>::try_from suggestion. 2021-08-30 19:01:34 +02:00
bors
13edc17f65 Auto merge of #88281 - asquared31415:asm-docs, r=Amanieu
Update unstable docs for `asm!` macro

This adds documentation that SPIR-V is supported, expands on the restrictions for labels, and has some minor cleanups or clarifications.

r? `@joshtriplett`
2021-08-30 07:54:11 +00:00
bors
dbb0fe9d80 Auto merge of #88456 - inquisitivecrystal:private-macro, r=jyn514
Fix: don't document private macros by default

As part of #88019, I made it so private macros are documented in `--document-private-items` mode. Unfortunately, it appears that I also accidentally made them be documented when *not* in `--document-private-items` mode. This PR fixes that and adds a regression test.

r? `@jyn514` (I hope you don't mind that I keep sending PRs your way)

Fixes #88453.
2021-08-30 05:23:54 +00:00
bors
9556d7a09a Auto merge of #88337 - eddyb:field-failure-is-not-an-option, r=nagisa
rustc_target: `TyAndLayout::field` should never error.

This refactor (making `TyAndLayout::field` return `TyAndLayout` without any `Result` around it) is based on a simple observation, regarding `TyAndLayout::field`:

If `cx.layout_of(ty)` succeeds (for some `cx` and `ty`), then `.field(cx, i)` on the resulting `TyAndLayout` should *always* succeed in computing `cx.layout_of(field_ty)` (where `field_ty` is the type of the `i`th field of `ty`).

The reason for this is that no matter which field is chosen, `cx.layout_of(field_ty)` *will have already been computed*, as part of computing `cx.layout_of(ty)`, as we cannot determine the layout of *any* type without considering the layouts of *all* of its fields.

And so it should be fine to turn any errors into ICEs, since they likely indicate a `cx` mismatch, or some other edge case that is due to a compiler bug (as opposed to ever being an user-facing error).

<hr/>

Each commit should probably be reviewed separately, though note that there's some `where` clauses (in `rustc_target::abi::call::*`) that change in most commits.

cc `@nagisa` `@oli-obk`
2021-08-29 22:54:26 +00:00
Eduard-Mihai Burtescu
78778fc6aa rustc_target: remove LayoutOf bound from TyAbiInterface. 2021-08-30 00:44:12 +03:00
Eduard-Mihai Burtescu
8e6d126b7d rustc_target: TyAndLayout::field should never error. 2021-08-30 00:44:09 +03:00
bors
2f662b1403 Auto merge of #88280 - sexxi-goose:non-exhaustive, r=nikomatsakis
Handle match statements with non exhaustive variants in closures

This PR ensures that the behavior for match statements with non exhaustive variants is the same inside and outside closures.

If we have a non-exhaustive SingleVariant which is defined in a different crate, then we should handle the case the same way we would handle a MultiVariant: borrow the match discriminant.

Closes https://github.com/rust-lang/project-rfc-2229/issues/59
r? `@nikomatsakis`
2021-08-29 20:27:14 +00:00
bors
ae0b03bc6b Auto merge of #88262 - klensy:pprust-cow, r=nagisa
Cow'ify some pprust methods

Reduce number of potential needless de/allocations by using `Cow<'static, str>` instead of explicit `String` type.
2021-08-29 17:46:29 +00:00
bors
daa4dc997c Auto merge of #88461 - GuillaumeGomez:rollup-khgu0eb, r=GuillaumeGomez
Rollup of 13 pull requests

Successful merges:

 - #80543 (Notify when an `I-prioritize` issue is closed or reopened)
 - #83251 (Suggestion for call on immutable binding of mutable type)
 - #85534 (add rustc-demangle assertion on mangled symbol)
 - #88173 (Refactor Markdown length-limited summary implementation)
 - #88349 (Add const and static TAIT tests)
 - #88357 (add unsized coercion test)
 - #88381 (Handle stack_t.ss_sp type change for DragonFlyBSD)
 - #88387 (Remove vestigial rustfix tests.)
 - #88396 (Bump vulnerable crates)
 - #88407 (Fix formatting in release notes from 52a988344b)
 - #88411 (Remove `Session.if_let_suggestions`)
 - #88417 (RELEASES.md: fix broken link)
 - #88419 (Fix code blocks color in Ayu theme)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-08-29 15:18:58 +00:00
Guillaume Gomez
26feefddc7
Rollup merge of #88419 - GuillaumeGomez:code-blocks-colors, r=camelid,notriddle
Fix code blocks color in Ayu theme

Fixes #88415.

cc `@camelid`
r? `@notriddle`
2021-08-29 16:25:37 +02:00
Guillaume Gomez
7248ff2760
Rollup merge of #88417 - xu-cheng:rel-fix-link, r=jyn514
RELEASES.md: fix broken link
2021-08-29 16:25:36 +02:00
Guillaume Gomez
b7388024eb
Rollup merge of #88411 - Aaron1011:remove-session-if-let, r=estebank
Remove `Session.if_let_suggestions`

We can instead if either the LHS or RHS types contain
`TyKind::Error`. In addition to covering the case where
we would have previously updated `if_let_suggestions`, this might
also prevent redundant errors in other cases as well.
2021-08-29 16:25:35 +02:00
Guillaume Gomez
9ffbd50294
Rollup merge of #88407 - nebkor:release-note-1.55x2, r=Mark-Simulacrum
Fix formatting in release notes from 52a988344b

I neglected to add a line that allowed the `[cargo/9663]` short-hand to resolve to an actual link in the rendered markdown on github.
2021-08-29 16:25:34 +02:00
Guillaume Gomez
efed604c26
Rollup merge of #88396 - klensy:bump-deps-vuln, r=Mark-Simulacrum
Bump vulnerable crates

crossbeam-deque v0.7.3 -> v0.7.4:
    https://rustsec.org/advisories/RUSTSEC-2021-0093
    https://github.com/crossbeam-rs/crossbeam/pull/728/files

openssl-src v111.15.0+1.1.1k -> v111.16.0+1.1.1l:
    https://rustsec.org/advisories/RUSTSEC-2021-0097
    https://rustsec.org/advisories/RUSTSEC-2021-0098
    https://www.openssl.org/news/vulnerabilities-1.1.1.html

tar v0.4.35 -> v0.4.37:
    https://rustsec.org/advisories/RUSTSEC-2021-0080
    updated to 0.4.37 as there breaking change in 0.4.36: https://github.com/alexcrichton/tar-rs/pull/260
2021-08-29 16:25:33 +02:00
Guillaume Gomez
1a6e8d769a
Rollup merge of #88387 - ehuss:remove-rustfix-tests, r=Mark-Simulacrum
Remove vestigial rustfix tests.

The directory `src/test/rustfix` is not actually tested. It looks like a mistake was made when rustfix tests were originally introduced in #50084.  In commit 6f2d023028 they were moved to `src/test/ui`, but the tests in the original directory weren't deleted.
2021-08-29 16:25:32 +02:00
Guillaume Gomez
281dfac12f
Rollup merge of #88381 - rtzoeller:dfly_stack_t_ss_sp_void, r=dtolnay
Handle stack_t.ss_sp type change for DragonFlyBSD

stack_t.ss_sp is now c_void on DragonFlyBSD, like the rest of the BSDs.

Changed in 02922ef750.
2021-08-29 16:25:31 +02:00
Guillaume Gomez
fdb4b7c462
Rollup merge of #88357 - lcnr:stabilize-relaxed_struct_unsize, r=Mark-Simulacrum
add unsized coercion test

we had no tests in our test suite for this case
2021-08-29 16:25:30 +02:00
Guillaume Gomez
3e1a15bb12
Rollup merge of #88349 - spastorino:const-static-types-tait-test, r=oli-obk
Add const and static TAIT tests

r? ``@oli-obk``

Related to #86727
2021-08-29 16:25:29 +02:00
Guillaume Gomez
aa61575499
Rollup merge of #88173 - camelid:refactor-markdown-length-limit, r=GuillaumeGomez
Refactor Markdown length-limited summary implementation

This PR is a new approach to #79749.

This PR refactors the implementation of `markdown_summary_with_limit()`,
separating the logic of determining when the limit has been reached from
the actual rendering process.

The main advantage of the new approach is that it guarantees that all
HTML tags are closed, whereas the previous implementation could generate
tags that were never closed. It also ensures that no empty tags are
generated (e.g., `<em></em>`).

The new implementation consists of a general-purpose struct
`HtmlWithLimit` that manages the length-limiting logic and a function
`markdown_summary_with_limit()` that renders Markdown to HTML using the
struct.

r? `@GuillaumeGomez`
2021-08-29 16:25:28 +02:00
Guillaume Gomez
63cfbf5d9f
Rollup merge of #85534 - csmoe:demagnle-assert, r=michaelwoerister
add rustc-demangle assertion on mangled symbol

cc https://github.com/rust-lang/rust/issues/60705#issuecomment-844880365
r? `@michaelwoerister`
2021-08-29 16:25:28 +02:00
Guillaume Gomez
22973a8844
Rollup merge of #83251 - estebank:issue-83241, r=oli-obk
Suggestion for call on immutable binding of mutable type

When calling a method requiring a mutable self borrow on an inmutable
to a mutable borrow of the type, suggest making the binding mutable.

Fix #83241.
2021-08-29 16:25:26 +02:00
Guillaume Gomez
8eb50ce1f4
Rollup merge of #80543 - LeSeulArtichaut:notify-close, r=spastorino
Notify when an `I-prioritize` issue is closed or reopened

Companion PR to rust-lang/triagebot#1078, blocked on that PR.
r? ``@spastorino`` cc ``@rust-lang/wg-prioritization``
2021-08-29 16:25:26 +02:00
bors
ef52471066 Auto merge of #88208 - petrochenkov:lowspan, r=Aaron1011
ast_lowering: Introduce `lower_span` for catching all spans entering HIR

This PR cherry-picks the `fn lower_span` change from https://github.com/rust-lang/rust/pull/84373.
I also introduced `fn lower_ident` for lowering spans in identifiers, and audited places where HIR structures with spans or identifiers are constructed and added a few missing `lower_span`s/`lower_ident`s.

Having a hook for spans entering HIR can be useful for things other than https://github.com/rust-lang/rust/pull/84373, e.g. https://github.com/rust-lang/rust/issues/35148.
I also want to check whether this change causes perf regressions due to some accidental inlining issues.

r? `@cjgillot`
2021-08-29 12:38:05 +00:00
bors
59ce765484 Auto merge of #88312 - jackh726:issue-87748, r=nikomatsakis
Treat types in unnormalized function signatures as well-formed

Fixes #87748

r? `@nikomatsakis`
2021-08-29 10:12:54 +00:00
Esteban Kuber
5b6f4b94c5 rebase: fix test output 2021-08-29 08:48:36 +00:00
Esteban Kuber
a6af6d6506 Provide structured suggestion for removal of &mut 2021-08-29 08:34:53 +00:00
Esteban Küber
e4368de7b1 Suggestion for call on immutable binding of mutable type
When calling a method requiring a mutable self borrow on an inmutable
to a mutable borrow of the type, suggest making the binding mutable.

Fix #83241.
2021-08-29 08:34:53 +00:00
inquisitivecrystal
6aacbd87f4 Add regression test 2021-08-29 00:55:58 -07:00
Vadim Petrochenkov
59013cdebe ast_lowering: Introduce lower_span for catching all spans entering HIR 2021-08-29 10:49:40 +03:00
bors
66acdee9f7 Auto merge of #88295 - alexcrichton:update-stdarch, r=kennytm
Update the stdarch submodule

This notably brings in a number of codegen updates to ensure that wasm
simd intrinsics generate the expected instruction with LLVM 13
2021-08-29 07:32:04 +00:00
inquisitivecrystal
3ee6d0b6b6 Fix: don't document private macros by default 2021-08-29 00:31:15 -07:00
bors
757a65bfdf Auto merge of #88250 - rusticstuff:macos-lld, r=nagisa
Make `-Z gcc-ld=lld` work for Apple targets

`-Z gcc-ld=lld` was introduced in #85961. It does not work on Macos because lld needs be either named `ld64` or passed `-flavor darwin` as the first two arguments in order to select the Mach-O flavor. Rust invokes cc (=clang) on Macos for linking which calls `ld` as linker binary and not `ld64`, so just creating an `ld64` binary and modifying the search path with `-B` does not work.

In order to solve this patch does:
* Set the `lld_flavor` for all Apple-derived targets to `LldFlavor::Ld64`. As far as I can see this actually works towards fixing `-Xlinker=rust-lld` as all those targets use the Mach-O object format.
* Copy/hardlink rust-lld to the gcc-ld subdirectory as ld64 next to ld.
* If `-Z gcc-ld=lld` is used and the target lld flavor is Ld64 add `-fuse-ld=/path/to/ld64` to the linker invocation.

Fixes #86945.
2021-08-29 04:51:14 +00:00
bors
3a21a5b324 Auto merge of #88088 - nbdd0121:const2, r=nagisa
Forbid inline const block referencing params from being used in patterns

Fix #82518
2021-08-29 02:21:07 +00:00
Roxane
33817d2881 Move match tests in match folder 2021-08-28 19:54:12 -04:00
bors
677b517e66 Auto merge of #87921 - kellerkindt:master, r=kennytm
Add Saturating type (based on Wrapping type)

Tracking #87920

### Unresolved Questions
<!--
Include any open questions that need to be answered before the feature can be
stabilised.
-->

 - [x] ~`impl Div for Saturating<T>` falls back on inner integer division - which seems alright?~
    - [x] add `saturating_div`? (to respect division by `-1`)
 - [x] There is no `::saturating_shl` and `::saturating_shr`. (How to) implement `Shl`, `ShlAssign`, `Shr` and `ShrAssign`?
   - [naively](3f7d2ce28f)
 - [x] ~`saturating_neg` is only implemented on [signed integer types](https://doc.rust-lang.org/std/?search=saturating_n)~
 - [x] Is the implementation copied over from the `Wrapping`-type correct for `Saturating`?
   - [x] `Saturating::rotate_left`
   - [x] `Saturating::rotate_right`
   - [x] `Not`
   - [x] `BitXorOr` and `BitXorOrAssign`
   - [x] `BitOr` and `BitOrAssign`
   - [x] `BitAnd` and `BitAndAssign`
   - [x] `Saturating::swap_bytes`
   - [x] `Saturating::reverse_bits`
2021-08-28 23:39:02 +00:00
Roxane
f7b0e3b441 Create a specific match folder for match tests 2021-08-28 19:29:47 -04:00
Roxane
cd35e251ea Add additional match test case 2021-08-28 19:29:46 -04:00
Roxane
20de556a26 Handle match with non axhaustive variants in closures 2021-08-28 19:27:32 -04:00
bors
5eacec9ec7 Auto merge of #85690 - bstrie:m2_arena, r=jackh726,nagisa
Macros 2.0-ify rustc_arena

For the purpose of battle-testing macros 2.0 I'm looking to dogfood it in rustc, one crate at a time.

(Note that there are only 12 changed lines if you ignore whitespace.)
2021-08-28 20:58:12 +00:00
bors
926f069950 Auto merge of #85600 - 12101111:rustbuild-libunwind, r=petrochenkov
build llvm libunwind.a in rustbuild

This PR move the building of llvm-libunwind from build script of libunwind to rustbuild, so user don't need a C compiler and recompile this C/C++ library when using build-std, and user can use codegen flags `link-self-contained` and cargo flag `build-std-features` to control the behavior of libunwind linking.
2021-08-28 18:17:29 +00:00
bors
42a2a53ec1 Auto merge of #88390 - sexxi-goose:missing-case, r=nikomatsakis
Add missing const edge case

We don't "process" const so we need to check for additional cases when the PatKind is a Path. We need to make sure that if there is only one variant that there is no field. If there is one or more field, we will want to borrow the match scrutinee

Closes https://github.com/rust-lang/rust/issues/88331
r? `@nikomatsakis`
2021-08-28 15:36:38 +00:00
bors
84b0183412 Auto merge of #88388 - ldm0:outliner, r=nikic
Revert "Disable the machine outliner by default"

The fix commit is already in the fork: https://github.com/rust-lang/llvm-project/commit/6c78dbd4ca1f
Linked:
- https://github.com/rust-lang/rust/issues/85351
- https://github.com/rust-lang/rust/pull/86020
2021-08-28 13:10:26 +00:00
Michael Watzko
ce636f25e5 Unimpl Shl{Assign} for signed Saturating types until the correct impl is clear 2021-08-28 13:39:09 +02:00
Michael Watzko
977ae5ac2c Fix mentions of wrapping operations 2021-08-28 13:29:19 +02:00
Michael Watzko
acf0a0c394 Use wrapping shift for unsigned types 2021-08-28 13:28:35 +02:00
bors
05cccdc9b3 Auto merge of #88019 - inquisitivecrystal:macro-def, r=cjgillot
Treat macros as HIR items

Macros have historically been treated differently from other items at the HIR level. This PR makes them just like normal items. There are a few special cases left over, which I've attempted to lay out below. By normalizing the treatment of macro items, this PR simplifies a fair bit of code and fixes some bugs at the same time. For more information, see #87406.

r? `@cjgillot`

## Backwards incompatibility

This is backwards incompatible in one small way. Due to a mistake, it was previously possible to apply stability attributes to an exported macro, even without enabling the `staged_api` feature. This never should have worked. After this PR, it will error, as it should. We could make it a warning instead, but that would require a special case for a feature that shouldn't ever have worked and is likely used by no or very few crates, so I'm not thrilled about the idea.

## Notes for reviewers
### Commit seperation

I'd recommend reviewing this PR commit by commit. The commit chunking wasn't perfect, but it's better than looking at the combined diff, which is quite overwhelming. The compiler and standard library build after each commit, although tests do not necessarily pass and tools do not necessarily build till the end of the series.

### Special cases
There are a few special cases that remain after this change. Here are the notable ones I remember:

1. Visibility works a bit differently for `macro_rules!` macros than other items, since they aren't generally marked with `pub` but instead with `#[macro_export]`.
2. Since `#[macro_export]` macros always have paths at the top level of the crate, some additional handling needs to be done on the reexport to top level.
### Performance impact

I don't know for sure, but theses changes may slightly hurt performance. They create more work for the compiler in a few places. For instance, some operations that were previously run only for exported macros are now run for all macros. A perf run is probably advisable. For all I know we'll see performance improvements instead. :)

## Issues resolved

This resolves #87406 (the tracking issue for this change). It also fixes several bugs:

Fixes #59306.
Fixes #73754.
Fixes #87257.
2021-08-28 10:45:28 +00:00
Guillaume Gomez
261ee26ac5 Add test for code blocks color 2021-08-28 11:44:02 +02:00
Guillaume Gomez
1c3aedd23a Fix code blocks color in ayu theme 2021-08-28 11:44:02 +02:00
bors
2031fd6e46 Auto merge of #88245 - Sl1mb0:s390-asm, r=Amanieu
S390x inline asm

This adds register definitions and constraint codes for the s390x general and floating point registers necessary for fixing #85931; as well as a few tests.

Further testing is needed, but I am a little unsure of what specific tests should be added to `src/test/assembly/asm/s390x.rs` to address this.
2021-08-28 08:04:41 +00:00