]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #88408 - spastorino:inference-cycle-tait-test, r=oli-obk
Mara Bos [Tue, 31 Aug 2021 08:41:19 +0000 (10:41 +0200)]
Rollup merge of #88408 - spastorino:inference-cycle-tait-test, r=oli-obk

Add inference cycle TAIT test

r? `@oli-obk`

Related to #86727

2 years agoRollup merge of #88406 - spastorino:tait-nest-infer-test, r=oli-obk
Mara Bos [Tue, 31 Aug 2021 08:41:18 +0000 (10:41 +0200)]
Rollup merge of #88406 - spastorino:tait-nest-infer-test, r=oli-obk

Tait nest infer test

r? `@oli-obk`

Related to #86727

2 years agoRollup merge of #88394 - ChrisDenton:patch-1, r=joshtriplett
Mara Bos [Tue, 31 Aug 2021 08:41:17 +0000 (10:41 +0200)]
Rollup merge of #88394 - ChrisDenton:patch-1, r=joshtriplett

Document `std::env::current_exe` possible rename behaviour

It might not be obvious that the "path of the current running executable" may (or may not) imply "at the time it was loaded".

This came up recently in chat so I thought it might be worth documenting.

2 years agoAuto merge of #88467 - sexxi-goose:issue-88431, r=nikomatsakis
bors [Tue, 31 Aug 2021 06:01:52 +0000 (06:01 +0000)]
Auto merge of #88467 - sexxi-goose:issue-88431, r=nikomatsakis

2229: Drop any deref in move closure

Fixes: #88431
r? `@nikomatsakis`

2 years agoAuto merge of #88414 - Aaron1011:guess-foreign-head-span, r=estebank
bors [Tue, 31 Aug 2021 03:34:22 +0000 (03:34 +0000)]
Auto merge of #88414 - Aaron1011:guess-foreign-head-span, r=estebank

Don't use `guess_head_span` in `predicates_of` for foreign span

Previously, the result of `predicates_of` for a foreign trait
would depend on the *current* state of the corresponding source
file in the foreign crate. This could lead to ICEs during incremental
compilation, since the on-disk contents of the upstream source file
could potentially change without the upstream crate being recompiled.

Additionally, this ensure that that the metadata we produce for a crate
only depends on its *compiled* upstream dependencies (e.g an rlib or
rmeta file), *not* the current on-disk state of the upstream crate
source files.

2 years agoAuto merge of #88100 - HTG-YT:edition2021-compopt-stabilization, r=m-ou-se
bors [Tue, 31 Aug 2021 01:03:55 +0000 (01:03 +0000)]
Auto merge of #88100 - HTG-YT:edition2021-compopt-stabilization, r=m-ou-se

Make Edition 2021 Stable

An item of #87959.

This is an "on-demand" pull request, which means it will be merged when it is the right time to.

2 years agoAuto merge of #88369 - lcnr:cec-rename, r=oli-obk
bors [Mon, 30 Aug 2021 22:21:01 +0000 (22:21 +0000)]
Auto merge of #88369 - lcnr:cec-rename, r=oli-obk

update const generics feature gates

**tl;dr: split const generics into three features: `adt_const_params`, `const_generics_defaults` and `generic_const_exprs`**

continuing the work of `@BoxyUwU` in #88324, this PR
- renames `feature(const_evaluatable_checked)` to `feature(generic_const_exprs)` which now doesn't need any other feature gate to work. Previously `feature(const_evaluatable_checked)` was only useful in combination with `feature(const_generics)`.
- completely removes `feature(lazy_normalization_consts)`. This feature only supplied the parents generics to anonymous constants, which is pretty useless as generic anon consts are only allowed with `feature(generic_const_exprs)` anyways.
- moves the ability to use additional const param types from `feature(const_generics)` into `feature(adt_const_params)`. As `feature(const_generics)` is now mostly useless without `feature(generic_const_exprs)` we also remove that feature flag.
- updates tests, removing duplicates and unnecessary revisions in some cases and also deletes all unused `*.stderr` files.

I not also remove the ordering restriction for const and type parameters if any of the three const generics features is active.
This ordering restriction feels like the only "real" use of the current `feature(const_generics)` right now so this change isn't a perfect solution, but as I intend to stabilize the ordering - and `feature(const_generics_defaults)` -  in the very near future, I think this is acceptable for now.

---

cc `@rust-lang/project-const-generics` about the new feature names and this change in general.

I don't think we need any external approval for this change but I do intend to publish an update to the const generics tracking issue the day this PR lands, so I don't want this merged yet.

Apologies to whoever ends up reviewing this PR :sweat_smile: :heart:

r? rust-lang/project-const-generics

2 years agoNo longer pass -Z unstable-options for edition 2021 in test.
Mara Bos [Mon, 30 Aug 2021 13:42:45 +0000 (15:42 +0200)]
No longer pass -Z unstable-options for edition 2021 in test.

2 years agoUpdate test output for stable Rust 2021.
Mara Bos [Mon, 30 Aug 2021 13:41:26 +0000 (15:41 +0200)]
Update test output for stable Rust 2021.

2 years agoAuto merge of #88466 - sexxi-goose:issue-88372, r=nikomatsakis
bors [Mon, 30 Aug 2021 18:27:54 +0000 (18:27 +0000)]
Auto merge of #88466 - sexxi-goose:issue-88372, r=nikomatsakis

2229: Handle update to capture kind properly

Fixes: #88372
r? `@nikomatsakis`

2 years agoUpdate LATEST_STABLE_EDITION to 2021.
Mara Bos [Mon, 30 Aug 2021 13:33:09 +0000 (15:33 +0200)]
Update LATEST_STABLE_EDITION to 2021.

2 years agoupdate rustc cmdargs markdown section
HTG-YT [Wed, 18 Aug 2021 01:05:48 +0000 (09:05 +0800)]
update rustc cmdargs markdown section

2 years agomake edition 2021 stable
HTG-YT [Tue, 17 Aug 2021 01:42:23 +0000 (09:42 +0800)]
make edition 2021 stable

2 years agoAuto merge of #87680 - mati865:stacker-psm-update, r=Mark-Simulacrum,nagisa
bors [Mon, 30 Aug 2021 10:42:53 +0000 (10:42 +0000)]
Auto merge of #87680 - mati865:stacker-psm-update, r=Mark-Simulacrum,nagisa

Update stacker and psm crates

Primarily to include https://github.com/rust-lang/stacker/pull/54

2 years ago`feature(const_param_types)` -> `feature(adt_const_params)`
lcnr [Mon, 30 Aug 2021 08:59:53 +0000 (10:59 +0200)]
`feature(const_param_types)` -> `feature(adt_const_params)`

2 years agoallow unordered const/ty params if any cg feature is active
lcnr [Thu, 26 Aug 2021 19:12:02 +0000 (21:12 +0200)]
allow unordered const/ty params if any cg feature is active

2 years ago`feature(const_generics)` -> `feature(const_param_types)`
lcnr [Fri, 27 Aug 2021 16:04:57 +0000 (18:04 +0200)]
`feature(const_generics)` -> `feature(const_param_types)`

2 years agoremove lazy_normalization_consts
Ellen [Wed, 25 Aug 2021 12:31:18 +0000 (13:31 +0100)]
remove lazy_normalization_consts

2 years agorename const_evaluatable_checked to generic_const_exprs
Ellen [Wed, 25 Aug 2021 09:21:39 +0000 (10:21 +0100)]
rename const_evaluatable_checked to generic_const_exprs

:sparkles:

2 years agoAuto merge of #88281 - asquared31415:asm-docs, r=Amanieu
bors [Mon, 30 Aug 2021 07:54:11 +0000 (07:54 +0000)]
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`

2 years agoAuto merge of #88456 - inquisitivecrystal:private-macro, r=jyn514
bors [Mon, 30 Aug 2021 05:23:54 +0000 (05:23 +0000)]
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.

2 years agoAuto merge of #88337 - eddyb:field-failure-is-not-an-option, r=nagisa
bors [Sun, 29 Aug 2021 22:54:26 +0000 (22:54 +0000)]
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`

2 years agorustc_target: remove `LayoutOf` bound from `TyAbiInterface`.
Eduard-Mihai Burtescu [Wed, 25 Aug 2021 15:15:09 +0000 (18:15 +0300)]
rustc_target: remove `LayoutOf` bound from `TyAbiInterface`.

2 years agorustc_target: `TyAndLayout::field` should never error.
Eduard-Mihai Burtescu [Wed, 25 Aug 2021 15:05:10 +0000 (18:05 +0300)]
rustc_target: `TyAndLayout::field` should never error.

2 years ago2229: Drop any deref in move closure
Aman Arora [Sun, 29 Aug 2021 20:28:58 +0000 (16:28 -0400)]
2229: Drop any deref in move closure

2 years agoAuto merge of #88280 - sexxi-goose:non-exhaustive, r=nikomatsakis
bors [Sun, 29 Aug 2021 20:27:14 +0000 (20:27 +0000)]
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`

2 years ago2229: Handle update to capture kind properly
Aman Arora [Sun, 29 Aug 2021 19:37:03 +0000 (15:37 -0400)]
2229: Handle update to capture kind properly

2 years agoAuto merge of #88262 - klensy:pprust-cow, r=nagisa
bors [Sun, 29 Aug 2021 17:46:29 +0000 (17:46 +0000)]
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.

2 years agoAuto merge of #88461 - GuillaumeGomez:rollup-khgu0eb, r=GuillaumeGomez
bors [Sun, 29 Aug 2021 15:18:58 +0000 (15:18 +0000)]
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 52a988344bce11)
 - #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

2 years agoRollup merge of #88419 - GuillaumeGomez:code-blocks-colors, r=camelid,notriddle
Guillaume Gomez [Sun, 29 Aug 2021 14:25:37 +0000 (16:25 +0200)]
Rollup merge of #88419 - GuillaumeGomez:code-blocks-colors, r=camelid,notriddle

Fix code blocks color in Ayu theme

Fixes #88415.

cc `@camelid`
r? `@notriddle`

2 years agoRollup merge of #88417 - xu-cheng:rel-fix-link, r=jyn514
Guillaume Gomez [Sun, 29 Aug 2021 14:25:36 +0000 (16:25 +0200)]
Rollup merge of #88417 - xu-cheng:rel-fix-link, r=jyn514

RELEASES.md: fix broken link

2 years agoRollup merge of #88411 - Aaron1011:remove-session-if-let, r=estebank
Guillaume Gomez [Sun, 29 Aug 2021 14:25:35 +0000 (16:25 +0200)]
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.

2 years agoRollup merge of #88407 - nebkor:release-note-1.55x2, r=Mark-Simulacrum
Guillaume Gomez [Sun, 29 Aug 2021 14:25:34 +0000 (16:25 +0200)]
Rollup merge of #88407 - nebkor:release-note-1.55x2, r=Mark-Simulacrum

Fix formatting in release notes from 52a988344bce11

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.

2 years agoRollup merge of #88396 - klensy:bump-deps-vuln, r=Mark-Simulacrum
Guillaume Gomez [Sun, 29 Aug 2021 14:25:33 +0000 (16:25 +0200)]
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

2 years agoRollup merge of #88387 - ehuss:remove-rustfix-tests, r=Mark-Simulacrum
Guillaume Gomez [Sun, 29 Aug 2021 14:25:32 +0000 (16:25 +0200)]
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 6f2d023028bbd666be2c211b923b32faf10a41da they were moved to `src/test/ui`, but the tests in the original directory weren't deleted.

2 years agoRollup merge of #88381 - rtzoeller:dfly_stack_t_ss_sp_void, r=dtolnay
Guillaume Gomez [Sun, 29 Aug 2021 14:25:31 +0000 (16:25 +0200)]
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 https://github.com/rust-lang/libc/commit/02922ef7504906589d02c2e4d97d1172fa247cc3.

2 years agoRollup merge of #88357 - lcnr:stabilize-relaxed_struct_unsize, r=Mark-Simulacrum
Guillaume Gomez [Sun, 29 Aug 2021 14:25:30 +0000 (16:25 +0200)]
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

2 years agoRollup merge of #88349 - spastorino:const-static-types-tait-test, r=oli-obk
Guillaume Gomez [Sun, 29 Aug 2021 14:25:29 +0000 (16:25 +0200)]
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

2 years agoRollup merge of #88173 - camelid:refactor-markdown-length-limit, r=GuillaumeGomez
Guillaume Gomez [Sun, 29 Aug 2021 14:25:28 +0000 (16:25 +0200)]
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`

2 years agoRollup merge of #85534 - csmoe:demagnle-assert, r=michaelwoerister
Guillaume Gomez [Sun, 29 Aug 2021 14:25:28 +0000 (16:25 +0200)]
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`

2 years agoRollup merge of #83251 - estebank:issue-83241, r=oli-obk
Guillaume Gomez [Sun, 29 Aug 2021 14:25:26 +0000 (16:25 +0200)]
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.

2 years agoRollup merge of #80543 - LeSeulArtichaut:notify-close, r=spastorino
Guillaume Gomez [Sun, 29 Aug 2021 14:25:26 +0000 (16:25 +0200)]
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``

2 years agoAuto merge of #88208 - petrochenkov:lowspan, r=Aaron1011
bors [Sun, 29 Aug 2021 12:38:05 +0000 (12:38 +0000)]
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`

2 years agoAuto merge of #88312 - jackh726:issue-87748, r=nikomatsakis
bors [Sun, 29 Aug 2021 10:12:54 +0000 (10:12 +0000)]
Auto merge of #88312 - jackh726:issue-87748, r=nikomatsakis

Treat types in unnormalized function signatures as well-formed

Fixes #87748

r? `@nikomatsakis`

2 years agorebase: fix test output
Esteban Kuber [Sun, 29 Aug 2021 08:48:36 +0000 (08:48 +0000)]
rebase: fix test output

2 years agoProvide structured suggestion for removal of `&mut`
Esteban Kuber [Mon, 9 Aug 2021 11:05:50 +0000 (11:05 +0000)]
Provide structured suggestion for removal of `&mut`

2 years agoSuggestion for call on immutable binding of mutable type
Esteban Küber [Thu, 18 Mar 2021 01:45:49 +0000 (18:45 -0700)]
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.

2 years agoAdd regression test
inquisitivecrystal [Sun, 29 Aug 2021 07:51:18 +0000 (00:51 -0700)]
Add regression test

2 years agoast_lowering: Introduce `lower_span` for catching all spans entering HIR
Vadim Petrochenkov [Fri, 20 Aug 2021 21:29:08 +0000 (00:29 +0300)]
ast_lowering: Introduce `lower_span` for catching all spans entering HIR

2 years agoAuto merge of #88295 - alexcrichton:update-stdarch, r=kennytm
bors [Sun, 29 Aug 2021 07:32:04 +0000 (07:32 +0000)]
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

2 years agoFix: don't document private macros by default
inquisitivecrystal [Sun, 29 Aug 2021 07:07:42 +0000 (00:07 -0700)]
Fix: don't document private macros by default

2 years agoAuto merge of #88250 - rusticstuff:macos-lld, r=nagisa
bors [Sun, 29 Aug 2021 04:51:14 +0000 (04:51 +0000)]
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.

2 years agoAuto merge of #88088 - nbdd0121:const2, r=nagisa
bors [Sun, 29 Aug 2021 02:21:07 +0000 (02:21 +0000)]
Auto merge of #88088 - nbdd0121:const2, r=nagisa

Forbid inline const block referencing params from being used in patterns

Fix #82518

2 years agoMove match tests in match folder
Roxane [Sat, 28 Aug 2021 23:54:12 +0000 (19:54 -0400)]
Move match tests in match folder

2 years agoAuto merge of #87921 - kellerkindt:master, r=kennytm
bors [Sat, 28 Aug 2021 23:39:02 +0000 (23:39 +0000)]
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](3f7d2ce28f8cf4dec56bf65fa2e6da0cf329ec55)
 - [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`

2 years agoCreate a specific match folder for match tests
Roxane [Tue, 24 Aug 2021 02:57:05 +0000 (22:57 -0400)]
Create a specific match folder for match tests

2 years agoAdd additional match test case
Roxane [Tue, 24 Aug 2021 02:41:19 +0000 (22:41 -0400)]
Add additional match test case

2 years agoHandle match with non axhaustive variants in closures
Roxane [Tue, 24 Aug 2021 02:41:03 +0000 (22:41 -0400)]
Handle match with non axhaustive variants in closures

2 years agoAuto merge of #85690 - bstrie:m2_arena, r=jackh726,nagisa
bors [Sat, 28 Aug 2021 20:58:12 +0000 (20:58 +0000)]
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.)

2 years agoAuto merge of #85600 - 12101111:rustbuild-libunwind, r=petrochenkov
bors [Sat, 28 Aug 2021 18:17:29 +0000 (18:17 +0000)]
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.

2 years agoAuto merge of #88390 - sexxi-goose:missing-case, r=nikomatsakis
bors [Sat, 28 Aug 2021 15:36:38 +0000 (15:36 +0000)]
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`

2 years agoAuto merge of #88388 - ldm0:outliner, r=nikic
bors [Sat, 28 Aug 2021 13:10:26 +0000 (13:10 +0000)]
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

2 years agoUnimpl Shl{Assign} for signed Saturating types until the correct impl is clear
Michael Watzko [Sat, 28 Aug 2021 11:39:09 +0000 (13:39 +0200)]
Unimpl Shl{Assign} for signed Saturating types until the correct impl is clear

2 years agoFix mentions of wrapping operations
Michael Watzko [Sat, 28 Aug 2021 11:29:19 +0000 (13:29 +0200)]
Fix mentions of wrapping operations

2 years agoUse wrapping shift for unsigned types
Michael Watzko [Sat, 28 Aug 2021 11:28:35 +0000 (13:28 +0200)]
Use wrapping shift for unsigned types

2 years agoAuto merge of #88019 - inquisitivecrystal:macro-def, r=cjgillot
bors [Sat, 28 Aug 2021 10:45:28 +0000 (10:45 +0000)]
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.

2 years agoAdd test for code blocks color
Guillaume Gomez [Sat, 28 Aug 2021 09:43:55 +0000 (11:43 +0200)]
Add test for code blocks color

2 years agoFix code blocks color in ayu theme
Guillaume Gomez [Sat, 28 Aug 2021 09:43:21 +0000 (11:43 +0200)]
Fix code blocks color in ayu theme

2 years agoAuto merge of #88245 - Sl1mb0:s390-asm, r=Amanieu
bors [Sat, 28 Aug 2021 08:04:41 +0000 (08:04 +0000)]
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.

2 years agoUpdate tests
inquisitivecrystal [Fri, 6 Aug 2021 05:09:25 +0000 (22:09 -0700)]
Update tests

2 years agoTeach tools that macros are now HIR items
inquisitivecrystal [Thu, 5 Aug 2021 23:58:46 +0000 (16:58 -0700)]
Teach tools that macros are now HIR items

2 years agoRemove obsolete `MacroDef` variant of `OwnerNode`
inquisitivecrystal [Sat, 31 Jul 2021 06:10:32 +0000 (23:10 -0700)]
Remove obsolete `MacroDef` variant of `OwnerNode`

2 years agoTreat macros as HIR items
inquisitivecrystal [Sat, 31 Jul 2021 06:50:57 +0000 (23:50 -0700)]
Treat macros as HIR items

2 years agoRevert machine outliner disabling on LLVM 13
liudingming [Sat, 28 Aug 2021 06:45:24 +0000 (14:45 +0800)]
Revert machine outliner disabling on LLVM 13

2 years agofix evaluation of target_feature = "crt-static"
12101111 [Sat, 28 Aug 2021 06:40:17 +0000 (14:40 +0800)]
fix evaluation of target_feature = "crt-static"

2 years agoRELEASES.md: fix broken link
Cheng XU [Sat, 28 Aug 2021 06:21:50 +0000 (23:21 -0700)]
RELEASES.md: fix broken link

2 years agobuild llvm libunwind.a in rustbuild
12101111 [Mon, 26 Jul 2021 14:47:07 +0000 (22:47 +0800)]
build llvm libunwind.a in rustbuild

2 years agoDon't use `guess_head_span` in `predicates_of` for foreign span
Aaron Hill [Sat, 28 Aug 2021 02:13:08 +0000 (21:13 -0500)]
Don't use `guess_head_span` in `predicates_of` for foreign span

Previously, the result of `predicates_of` for a foreign trait
would depend on the *current* state of the corresponding source
file in the foreign crate. This could lead to ICEs during incremental
compilation, since the on-disk contents of the upstream source file
could potentially change without the upstream crate being recompiled.

Additionally, this ensure that that the metadata we produce for a crate
only depends on its *compiled* upstream dependencies (e.g an rlib or
rmeta file), *not* the current on-disk state of the upstream crate
source files.

2 years agoRemove `Session.if_let_suggestions`
Aaron Hill [Fri, 27 Aug 2021 23:28:22 +0000 (18:28 -0500)]
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.

2 years agoUpdate stacker and psm crates
Mateusz Mikuła [Wed, 18 Aug 2021 20:36:35 +0000 (22:36 +0200)]
Update stacker and psm crates

2 years agoHandle stack_t.ss_sp type change for DragonFlyBSD
Ryan Zoeller [Fri, 27 Aug 2021 04:37:36 +0000 (23:37 -0500)]
Handle stack_t.ss_sp type change for DragonFlyBSD

stack_t.ss_sp is now c_void on DragonFlyBSD, so the specialization is no longer needed.

Changed in https://github.com/rust-lang/libc/commit/02922ef7504906589d02c2e4d97d1172fa247cc3.

2 years agoAdd inference cycle TAIT test
Santiago Pastorino [Fri, 27 Aug 2021 21:34:07 +0000 (18:34 -0300)]
Add inference cycle TAIT test

2 years agoAuto merge of #88328 - fee1-dead:not-quite-const, r=oli-obk
bors [Fri, 27 Aug 2021 21:35:08 +0000 (21:35 +0000)]
Auto merge of #88328 - fee1-dead:not-quite-const, r=oli-obk

Introduce `~const`

 - [x] Removed `?const` and change uses of `?const`
 - [x] Added `~const` to the AST. It is gated behind const_trait_impl.
 - [x] Validate `~const` in ast_validation.
 - [x] Update UI Tests
 - [x] Add enum `BoundConstness` (With variants `NotConst` and
 `ConstIfConst` allowing future extensions)
 - [x] Adjust trait selection and pre-existing code to use `BoundConstness`.
 - [ ] Optional steps for this PR
      - [x] Fix #88155
      - [x] ~~Do something with constness bounds in chalk~~ Must be done to rust-lang/chalk (just tried to refactor, there are a lot of errors to resolve :( )
      - [ ] Adjust Error messages for `~const` bounds that can't be satisfied.

r? `@oli-obk`

2 years agoFix formatting in release notes from 52a988344bce118347d6a6567e67e20b7e99dc25
Joe Ardent [Fri, 27 Aug 2021 21:03:04 +0000 (14:03 -0700)]
Fix formatting in release notes from 52a988344bce118347d6a6567e67e20b7e99dc25

2 years agouse `|=`
Niko Matsakis [Fri, 27 Aug 2021 21:13:41 +0000 (17:13 -0400)]
use `|=`

2 years agoAdd nested TAIT inference test that fails
Santiago Pastorino [Fri, 27 Aug 2021 20:51:46 +0000 (17:51 -0300)]
Add nested TAIT inference test that fails

2 years agoAdd nested TAIT inference test
Santiago Pastorino [Fri, 27 Aug 2021 20:48:51 +0000 (17:48 -0300)]
Add nested TAIT inference test

2 years agosimplify the logic and document
Niko Matsakis [Fri, 27 Aug 2021 20:30:45 +0000 (16:30 -0400)]
simplify the logic and document

2 years agoAuto merge of #88397 - nagisa:nagisa/unsupported-calling-conventions, r=Mark-Simulacrum
bors [Fri, 27 Aug 2021 18:45:53 +0000 (18:45 +0000)]
Auto merge of #88397 - nagisa:nagisa/unsupported-calling-conventions, r=Mark-Simulacrum

Tracking issue for `UNSUPPORTED_CALLING_CONVENTIONS`

This was previously forgotten. Nominating for 1.55 as this lint will make it into stable in that release.

r? `@Mark-Simulacrum`

2 years agoTracking issue for UNSUPPORTED_CALLING_CONVENTIONS
Simonas Kazlauskas [Fri, 27 Aug 2021 16:27:45 +0000 (19:27 +0300)]
Tracking issue for UNSUPPORTED_CALLING_CONVENTIONS

2 years agocrossbeam-deque v0.7.3 -> v0.7.4:
klensy [Fri, 27 Aug 2021 14:38:53 +0000 (17:38 +0300)]
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

2 years agoDocument `std::env::current_exe` rename behaviour
Chris Denton [Fri, 27 Aug 2021 13:25:29 +0000 (14:25 +0100)]
Document `std::env::current_exe` rename behaviour

It might not be obvious that the "path of the current running executable" may (or may not) mean "at the time it was loaded".

2 years agoadd rustc-demangle assertion on mangled symbol
csmoe [Fri, 21 May 2021 02:11:40 +0000 (10:11 +0800)]
add rustc-demangle assertion on mangled symbol

2 years agoAdd comment and fix fmt issue
Roxane [Fri, 27 Aug 2021 13:00:50 +0000 (09:00 -0400)]
Add comment and fix fmt issue

2 years agoAdd missing const edge case
Roxane [Fri, 27 Aug 2021 00:56:45 +0000 (20:56 -0400)]
Add missing const edge case

2 years agoFix rustfmt test
Deadbeef [Fri, 27 Aug 2021 11:53:03 +0000 (11:53 +0000)]
Fix rustfmt test

2 years agoRemove vestigial rustfix tests.
Eric Huss [Fri, 27 Aug 2021 11:52:51 +0000 (04:52 -0700)]
Remove vestigial rustfix tests.

2 years agoRevive tests
Deadbeef [Fri, 27 Aug 2021 08:26:35 +0000 (08:26 +0000)]
Revive tests

2 years agorustc_target: require `TyAbiInterface` in `LayoutOf`.
Eduard-Mihai Burtescu [Wed, 25 Aug 2021 13:40:39 +0000 (16:40 +0300)]
rustc_target: require `TyAbiInterface` in `LayoutOf`.

2 years agorustc_target: rename `TyAndLayoutMethods` to `TyAbiInterface`.
Eduard-Mihai Burtescu [Wed, 25 Aug 2021 13:45:24 +0000 (16:45 +0300)]
rustc_target: rename `TyAndLayoutMethods` to `TyAbiInterface`.