]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #86637 - ehuss:spellings, r=dtolnay
bors [Sat, 26 Jun 2021 05:09:27 +0000 (05:09 +0000)]
Auto merge of #86637 - ehuss:spellings, r=dtolnay

Fix a few misspellings.

3 years agoAuto merge of #86622 - FabianWolff:issue-83475, r=jonas-schievink
bors [Sat, 26 Jun 2021 02:28:45 +0000 (02:28 +0000)]
Auto merge of #86622 - FabianWolff:issue-83475, r=jonas-schievink

Check that `#[cmse_nonsecure_entry]` is applied to a function definition

This PR fixes #83475. The compiler currently neglects to check whether `#[cmse_nonsecure_entry]` is applied to a function (and not, say, a struct) definition, leading to an ICE later on when the type checker attempts to retrieve the function signature. I have fixed this problem by adding an appropriate check to the `check_attr` pass, so that an error is reported instead of an ICE.

3 years agoAuto merge of #86015 - jyn514:revert-revert, r=Mark-Simulacrum
bors [Fri, 25 Jun 2021 23:47:56 +0000 (23:47 +0000)]
Auto merge of #86015 - jyn514:revert-revert, r=Mark-Simulacrum

Move LLVM submodule updates back to native.rs

Time to find more bugs!

The first commit is a straight revert of https://github.com/rust-lang/rust/pull/85647, the second is a fix for https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/x.2Epy.20always.20updates.20LLVM.20submodule/near/240113320 and https://github.com/rust-lang/rust/pull/82653#issuecomment-846755631. I haven't been able to replicate https://github.com/rust-lang/rust/pull/82653#issuecomment-849013698.

3 years agoAuto merge of #86599 - Amanieu:asm_raw, r=nagisa
bors [Fri, 25 Jun 2021 20:44:28 +0000 (20:44 +0000)]
Auto merge of #86599 - Amanieu:asm_raw, r=nagisa

Add a "raw" option for asm! which ignores format string specifiers

This is useful when including raw assembly snippets using `include_str!`.

3 years agoFix a few misspellings.
Eric Huss [Fri, 25 Jun 2021 20:18:56 +0000 (13:18 -0700)]
Fix a few misspellings.

3 years agoAuto merge of #86627 - JohnTitor:rollup-ey29pc1, r=JohnTitor
bors [Fri, 25 Jun 2021 18:16:37 +0000 (18:16 +0000)]
Auto merge of #86627 - JohnTitor:rollup-ey29pc1, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #86330 (Change how edition based future compatibility warnings are handled)
 - #86513 (Rustdoc: Do not list impl when trait has doc(hidden))
 - #86592 (Use `#[non_exhaustive]` where appropriate)
 - #86608 (chore(rustdoc): remove unused members of RenderType)
 - #86624 (Update compiler-builtins)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoCheck that `#[cmse_nonsecure_entry]` is applied to a function definition
Fabian Wolff [Fri, 25 Jun 2021 13:36:38 +0000 (15:36 +0200)]
Check that `#[cmse_nonsecure_entry]` is applied to a function definition

3 years agoRollup merge of #86624 - jethrogb:update-compiler_builtins, r=Amanieu
Yuki Okushi [Fri, 25 Jun 2021 15:42:14 +0000 (00:42 +0900)]
Rollup merge of #86624 - jethrogb:update-compiler_builtins, r=Amanieu

Update compiler-builtins

r? ``@Amanieu``

3 years agoRollup merge of #86608 - notriddle:notriddle/cleanup-rustdoc, r=jyn514
Yuki Okushi [Fri, 25 Jun 2021 15:42:13 +0000 (00:42 +0900)]
Rollup merge of #86608 - notriddle:notriddle/cleanup-rustdoc, r=jyn514

chore(rustdoc): remove unused members of RenderType

PR #86561 removes the only place the `generics` member is read. This PR does even more cleanup.

3 years agoRollup merge of #86592 - jhpratt:non_exhaustive, r=JohnTitor
Yuki Okushi [Fri, 25 Jun 2021 15:42:12 +0000 (00:42 +0900)]
Rollup merge of #86592 - jhpratt:non_exhaustive, r=JohnTitor

Use `#[non_exhaustive]` where appropriate

Due to the std/alloc split, it is not possible to make `alloc::collections::TryReserveError::AllocError` non-exhaustive without having an unstable, doc-hidden method to construct (which negates the benefits from `#[non_exhaustive]`).

`@rustbot` label +C-cleanup +T-libs +S-waiting-on-review

3 years agoRollup merge of #86513 - fee1-dead:cross-crate-doc-hidden, r=danielhenrymantilla
Yuki Okushi [Fri, 25 Jun 2021 15:42:10 +0000 (00:42 +0900)]
Rollup merge of #86513 - fee1-dead:cross-crate-doc-hidden, r=danielhenrymantilla

Rustdoc: Do not list impl when trait has doc(hidden)

Fixes #86448.

3 years agoRollup merge of #86330 - rylev:update-fcw-handling, r=nikomatsakis
Yuki Okushi [Fri, 25 Jun 2021 15:42:06 +0000 (00:42 +0900)]
Rollup merge of #86330 - rylev:update-fcw-handling, r=nikomatsakis

Change how edition based future compatibility warnings are handled

This fixes https://github.com/rust-lang/rust/issues/85894 by updating how future compatibility lints work. This makes it more apparent that future compatibility warnings can happen for several different reasons.

For now `FutureCompatibilityReasons` are limited to three reasons, but we can easily add more.

This also updates the generated warning for FCW's that signal code that will error in a future edition. This makes the diagnostics between FCWs at edition boundaries more distinct from those not happening at an edition boundary.

r? ``@m-ou-se``

3 years agoAuto merge of #85603 - ogoffart:fix-uninhabited-enum-branching-pass, r=wesleywiser
bors [Fri, 25 Jun 2021 15:35:47 +0000 (15:35 +0000)]
Auto merge of #85603 - ogoffart:fix-uninhabited-enum-branching-pass, r=wesleywiser

Fix uninhabited enum branching pass

when the discriminant is taken with some projection.

3 years agoUpdate compiler-builtins
Jethro Beekman [Fri, 25 Jun 2021 14:00:57 +0000 (16:00 +0200)]
Update compiler-builtins

3 years agoFix clippy test
Ryan Levick [Fri, 25 Jun 2021 13:29:14 +0000 (15:29 +0200)]
Fix clippy test

3 years agoFix new broken tests
Ryan Levick [Thu, 24 Jun 2021 14:45:19 +0000 (16:45 +0200)]
Fix new broken tests

3 years agoFix new lints
Ryan Levick [Wed, 23 Jun 2021 13:52:28 +0000 (15:52 +0200)]
Fix new lints

3 years agoAdd back missing doc
Ryan Levick [Thu, 17 Jun 2021 17:36:49 +0000 (19:36 +0200)]
Add back missing doc

3 years agoAddress PR feedback
Ryan Levick [Wed, 16 Jun 2021 12:27:44 +0000 (14:27 +0200)]
Address PR feedback

3 years agoChange how edition based future compatibility warnings are handled
Ryan Levick [Tue, 15 Jun 2021 15:16:21 +0000 (17:16 +0200)]
Change how edition based future compatibility warnings are handled

3 years agoAuto merge of #86583 - dns2utf8:use_https, r=pietroalbini
bors [Fri, 25 Jun 2021 12:20:17 +0000 (12:20 +0000)]
Auto merge of #86583 - dns2utf8:use_https, r=pietroalbini

Use https for sourceforge during CI

I saw that we use http during CI opening up the CI process to on the wire tampering.

based on #86573

r? `@pietroalbini`

3 years agoAuto merge of #86505 - JohnTitor:fix-86483, r=jackh726
bors [Fri, 25 Jun 2021 09:28:17 +0000 (09:28 +0000)]
Auto merge of #86505 - JohnTitor:fix-86483, r=jackh726

Do not panic in `return_type_impl_trait`

Fixes #86483

3 years agoFetch expat from github because the project switched
Stefan Schindler [Wed, 23 Jun 2021 20:01:18 +0000 (22:01 +0200)]
Fetch expat from github because the project switched

3 years agoUse https for sourceforge during CI
Stefan Schindler [Wed, 23 Jun 2021 19:20:19 +0000 (21:20 +0200)]
Use https for sourceforge during CI

3 years agoAuto merge of #86151 - scottmcm:simple-hash-of, r=joshtriplett
bors [Fri, 25 Jun 2021 06:47:30 +0000 (06:47 +0000)]
Auto merge of #86151 - scottmcm:simple-hash-of, r=joshtriplett

Add `BuildHasher::hash_one` as unstable

Inspired by https://github.com/rust-lang/rust/pull/86140/files#diff-246941135168fbc44fce120385ee9c3156e08a1c3e2697985b56dcb8d728eedeR2416, where I wanted to write a quick test for a `Hash` implementation and it took more of a dance than I'd hoped.

It looks like this would be handy in hashtable implementations, too -- a quick look at hashbrown found two places where it needs to do the same dance:
https://github.com/rust-lang/hashbrown/blob/6302512a8a514fe5bd442464ebcd78139c82e1e2/src/map.rs#L247-L270

I wanted to get a "seems plausible" from a libs member before making a tracking issue, so random-sampling the intersection of highfive and governance gave me...
r? `@joshtriplett`

(As always, bikeshed away!  And let me know if I missed something obvious again that I should have used instead.)

3 years agoRenamed test and added test for same crate
Deadbeef [Fri, 25 Jun 2021 06:08:06 +0000 (14:08 +0800)]
Renamed test and added test for same crate

3 years agoAuto merge of #85640 - bjorn3:custom_ice_hook, r=jackh726
bors [Fri, 25 Jun 2021 04:06:32 +0000 (04:06 +0000)]
Auto merge of #85640 - bjorn3:custom_ice_hook, r=jackh726

Allow changing the bug report url for the ice hook

cc https://github.com/bjorn3/rustc_codegen_cranelift/issues/1174

3 years agoAuto merge of #86574 - m-ou-se:or-pattern-lint-fix, r=petrochenkov
bors [Fri, 25 Jun 2021 01:23:16 +0000 (01:23 +0000)]
Auto merge of #86574 - m-ou-se:or-pattern-lint-fix, r=petrochenkov

Don't lint :pat when re-parsing a macro from another crate.

`compile_macro` is used both when compiling the original definition in the crate that defines it, and to compile the macro when loading it when compiling a crate that uses it. We should only emit lints in the first case.

This adds a `is_definition: bool` to pass this information in, so we don't warn about things that only concern the definition site.

Fixes #86567

3 years agochore(rustdoc): remove unused members of RenderType
Michael Howell [Thu, 24 Jun 2021 19:53:35 +0000 (12:53 -0700)]
chore(rustdoc): remove unused members of RenderType

Commit e629381653bb3579f0cea0b256e391edef5e8dbb removes the only place
these members variables are actually read.

3 years agoAuto merge of #86272 - nagisa:nagisa/tidy-llvm-components, r=Mark-Simulacrum
bors [Thu, 24 Jun 2021 22:42:26 +0000 (22:42 +0000)]
Auto merge of #86272 - nagisa:nagisa/tidy-llvm-components, r=Mark-Simulacrum

tidy: verify that test revisions with --target have associated needs-llvm-components directives

This ensures that people who tend to write `--target` `#[no_core]` tests don't miss specifying the `needs-llvm-components` directive. This is necessary for the test suite to pass when LLVM is compiled with a subset of components enabled.

While here I also took the opportunity to implement a more fine-grained handling of the ignore directives, so that they are evaluated for each revision, rather than for the entire test. With this even if people have `arm` component disabled, only the revision that depends on the arm component will not run.

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

3 years agoAdd a "raw" option for asm! which ignores format string specifiers
Amanieu d'Antras [Thu, 24 Jun 2021 15:25:44 +0000 (16:25 +0100)]
Add a "raw" option for asm! which ignores format string specifiers

3 years agoDon't lint :pat when re-parsing a macro from another crate.
Mara Bos [Wed, 23 Jun 2021 14:07:32 +0000 (14:07 +0000)]
Don't lint :pat when re-parsing a macro from another crate.

3 years agocompiletest: ignore tests on a per-revision basis
Simonas Kazlauskas [Sun, 13 Jun 2021 19:06:11 +0000 (22:06 +0300)]
compiletest: ignore tests on a per-revision basis

Otherwise something that ought to seemingly work like `//[x86]
needs-llvm-components: x86` or `//[nll_beyond]should-fail` do not get
evaluated properly.

3 years agoRe-Annotate the tests with needs-llvm-components
Simonas Kazlauskas [Sun, 13 Jun 2021 18:19:39 +0000 (21:19 +0300)]
Re-Annotate the tests with needs-llvm-components

Doesn't work though, because compiletest doesn't process ignores on a
per-revision manner.

3 years agotidy: tests with --target need llvm components
Simonas Kazlauskas [Sun, 13 Jun 2021 15:56:13 +0000 (18:56 +0300)]
tidy: tests with --target need llvm components

Herein we verify that all of the tests that specify a `--target`
compile-flag, are also annotated with the minimal set of required llvm
components necessary to run that test.

3 years agoAuto merge of #85651 - dns2utf8:rustdoc_flexbox, r=GuillaumeGomez
bors [Thu, 24 Jun 2021 20:01:39 +0000 (20:01 +0000)]
Auto merge of #85651 - dns2utf8:rustdoc_flexbox, r=GuillaumeGomez

rustdoc: staggered layout for module contents on mobile

This PR adds the container `<item-table>` with its two children `<item-left>` and `<item-right>`.
It uses grid-layout on desktop and flexbox on mobile to make better use of the available space.

Additionally it allows to share parts of the CSS with the search function.

* Demo: https://data.estada.ch/rustdoc-nightly_126561cb3_2021-05-25/generic_array/index.html
* Related: #85540

## Desktop
![grafik](https://user-images.githubusercontent.com/739070/119416896-2be62300-bce4-11eb-9555-792b859ab611.png)

## Mobile
![grafik](https://user-images.githubusercontent.com/739070/119416934-44563d80-bce4-11eb-9e77-70a72edcc487.png)

r? `@GuillaumeGomez` `@jsha`

3 years agoAuto merge of #86467 - ChrisDenton:win-env-clear, r=JohnTitor
bors [Thu, 24 Jun 2021 17:37:29 +0000 (17:37 +0000)]
Auto merge of #86467 - ChrisDenton:win-env-clear, r=JohnTitor

Windows: Fix `Command::env_clear` so it works if no variables are set

Previously, it would error unless at least one new environment variable was added. The missing null presumably meant that Windows was reading random memory in that case.

See: [CreateProcessW](https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw) (scroll down to `lpEnvironment`). Essentially the environment block is a null terminated list of null terminated strings and an empty list is `\0\0` and not `\0`.

EDIT: Oh, [CreateEnvironmentBlock](https://docs.microsoft.com/en-gb/windows/win32/api/userenv/nf-userenv-createenvironmentblock) states this much more explicitly.

Fixes #31259

3 years agoAuto merge of #85427 - ehuss:fix-use-placement, r=jackh726
bors [Thu, 24 Jun 2021 14:56:28 +0000 (14:56 +0000)]
Auto merge of #85427 - ehuss:fix-use-placement, r=jackh726

Fix use placement for suggestions near main.

This fixes an edge case for the suggestion to add a `use`. When running with `--test`, the `main` function will be annotated with an `#[allow(dead_code)]` attribute. The `UsePlacementFinder` would end up using the dummy span of that synthetic attribute. If there are top-level inner attributes, this would place the `use` in the wrong position. The solution here is to ignore attributes with dummy spans.

In the process of working on this, I discovered that the `use_suggestion_placement` test was broken. `UsePlacementFinder` is unaware of active attributes. Attributes like `#[derive]` don't exist in the AST since they are removed. Fixing that is difficult, since the AST does not retain enough information. I considered trying to place the `use` towards the top of the module after any `extern crate` items, but I couldn't find a way to get a span for the start of a module block (the `mod` span starts at the `mod` keyword, and it seems tricky to find the spot just after the opening bracket and past inner attributes). For now, I just put some comments about the issue. This appears to have been a known issue in #44215 where the test for it was introduced, and the fix seemed to be deferred to later.

3 years agoMigrate from custom elements to divs with classes to be compatible with safari
Stefan Schindler [Thu, 17 Jun 2021 22:33:42 +0000 (00:33 +0200)]
Migrate from custom elements to divs with classes to be compatible with safari

3 years agoHide Crate Version on narrow Screens
Stefan Schindler [Wed, 16 Jun 2021 20:24:02 +0000 (22:24 +0200)]
Hide Crate Version on narrow Screens

3 years agoFixing the test rustdoc by ignoring `*[@id="module-item"]//following-sibling::item...
Stefan Schindler [Wed, 16 Jun 2021 14:16:11 +0000 (16:16 +0200)]
Fixing the test rustdoc by ignoring `*[@id="module-item"]//following-sibling::item-right` relationship and rustdoc-gui

3 years agoImplement Desktop and Mobile version with gridlayout
Stefan Schindler [Mon, 24 May 2021 22:36:36 +0000 (00:36 +0200)]
Implement Desktop and Mobile version with gridlayout

* implement sans-serif #85621

3 years agoTest that `env_clear` works on Windows
Chris Denton [Thu, 24 Jun 2021 08:32:24 +0000 (09:32 +0100)]
Test that `env_clear` works on Windows

3 years agoUse `hash_one` to simplify some other doctests
Scott McMurray [Thu, 24 Jun 2021 08:30:08 +0000 (01:30 -0700)]
Use `hash_one` to simplify some other doctests

3 years agoAdd tracking issue and rename to hash_one
Scott McMurray [Wed, 9 Jun 2021 05:07:14 +0000 (22:07 -0700)]
Add tracking issue and rename to hash_one

3 years agoAdd `BuildHasher::hash_of` as unstable
Scott McMurray [Tue, 8 Jun 2021 20:52:57 +0000 (13:52 -0700)]
Add `BuildHasher::hash_of` as unstable

3 years agoUse `#[non_exhaustive]` where appropriate
Jacob Pratt [Thu, 24 Jun 2021 08:16:11 +0000 (04:16 -0400)]
Use `#[non_exhaustive]` where appropriate

Due to the std/alloc split, it is not possible to make
`alloc::collections::TryReserveError::AllocError` non-exhaustive without
having an unstable, doc-hidden method to construct (which negates the
benefits from `#[non_exhaustive]`.

3 years agoAuto merge of #86279 - JohnTitor:transparent-zero-size-fields, r=nikomatsakis
bors [Thu, 24 Jun 2021 07:29:59 +0000 (07:29 +0000)]
Auto merge of #86279 - JohnTitor:transparent-zero-size-fields, r=nikomatsakis

Permit zero non-zero-field on transparent types

Fixes #77841

This makes the transparent fields meet the below:
> * A `repr(transparent)` type `T` must meet the following rules:
>   * It may have any number of 1-ZST fields
>   * In addition, it may have at most one other field of type U

r? `@nikomatsakis`

3 years agoPrefer "allow list" structure to check a type
Yuki Okushi [Thu, 24 Jun 2021 05:59:43 +0000 (14:59 +0900)]
Prefer "allow list" structure to check a type

3 years agoRename function name in comments
Yuki Okushi [Thu, 24 Jun 2021 05:21:50 +0000 (14:21 +0900)]
Rename function name in comments

3 years agoDo not panic in `return_type_impl_trait`
Yuki Okushi [Mon, 21 Jun 2021 05:53:50 +0000 (14:53 +0900)]
Do not panic in `return_type_impl_trait`

3 years agoAuto merge of #86588 - JohnTitor:rollup-ibgjbkf, r=JohnTitor
bors [Thu, 24 Jun 2021 04:48:46 +0000 (04:48 +0000)]
Auto merge of #86588 - JohnTitor:rollup-ibgjbkf, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #86137 (Error code cleanup and enforce checks)
 - #86296 (Add documentation for various THIR structs)
 - #86415 (Document associativity of iterator folds.)
 - #86533 (Support lowercase error codes in `--explain`)
 - #86536 (Edition 2021 enables disjoint capture)
 - #86560 (Update cargo)
 - #86561 (chore(rustdoc): Remove unused impl block)
 - #86566 (Use `use_verbose` for `mir::Constant`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #86566 - fee1-dead:mir-pretty-print, r=oli-obk
Yuki Okushi [Thu, 24 Jun 2021 04:47:39 +0000 (13:47 +0900)]
Rollup merge of #86566 - fee1-dead:mir-pretty-print, r=oli-obk

Use `use_verbose` for `mir::Constant`

Fixes #79799.

3 years agoRollup merge of #86561 - notriddle:notriddle/cleanup-rustdoc, r=jyn514
Yuki Okushi [Thu, 24 Jun 2021 04:47:38 +0000 (13:47 +0900)]
Rollup merge of #86561 - notriddle:notriddle/cleanup-rustdoc, r=jyn514

chore(rustdoc): Remove unused impl block

3 years agoRollup merge of #86560 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Thu, 24 Jun 2021 04:47:37 +0000 (13:47 +0900)]
Rollup merge of #86560 - ehuss:update-cargo, r=ehuss

Update cargo

This also updates `opener` used in bootstrap (to try to keep dependencies unified).

18 commits in 44456677b5d1d82fe981c955dc5c67734b31f340..9233aa06c801801cff75df65df718d70905a235e
2021-06-12 18:00:01 +0000 to 2021-06-22 21:32:55 +0000
- Detect incorrectly named cargo.toml (rust-lang/cargo#9607)
- Unify weak and namespaced features. (rust-lang/cargo#9574)
- Change `rustc-cdylib-link-arg` error to a warning. (rust-lang/cargo#9563)
- Updates to future-incompatible reporting. (rust-lang/cargo#9606)
- Add a compatibility notice for diesel and the new resolver. (rust-lang/cargo#9602)
- Don't allow config env to modify vars set by cargo (rust-lang/cargo#9579)
- Disambiguate is_symlink. (rust-lang/cargo#9604)
- Update opener requirement from 0.4 to 0.5 (rust-lang/cargo#9583)
- Avoid quadratic complexity when splitting output into lines (rust-lang/cargo#9586)
- Bump to 0.56.0, update changelog (rust-lang/cargo#9597)
- Fix dep-info files including non-local build script paths. (rust-lang/cargo#9596)
- Relax doc collision error. (rust-lang/cargo#9595)
- Handle "jobs = 0" case in cargo config files (rust-lang/cargo#9584)
- Enhancements to testsuite error output. (rust-lang/cargo#9589)
- Fix typo (rust-lang/cargo#9590)
- Enable support for fix --edition for 2021. (rust-lang/cargo#9588)
- Add more details for installing git repository errors (rust-lang/cargo#9582)
- More information for links conflicting (rust-lang/cargo#9568)

3 years agoRollup merge of #86536 - sexxi-goose:edition, r=nikomatsakis
Yuki Okushi [Thu, 24 Jun 2021 04:47:36 +0000 (13:47 +0900)]
Rollup merge of #86536 - sexxi-goose:edition, r=nikomatsakis

Edition 2021 enables disjoint capture

First part for https://github.com/rust-lang/project-rfc-2229/issues/43

3 years agoRollup merge of #86533 - inquisitivecrystal:lower-case-error-explain, r=petrochenkov
Yuki Okushi [Thu, 24 Jun 2021 04:47:35 +0000 (13:47 +0900)]
Rollup merge of #86533 - inquisitivecrystal:lower-case-error-explain, r=petrochenkov

Support lowercase error codes in `--explain`

This enables `rustc --explain` to accept a lowercase error code. Thus, for instance, `rustc --explain e0573` would be valid after this change, where before a user would have needed to do `rustc --explain E0573`. Although the upper case form of an error code is canonical, the user may prefer the easier-to-type lowercase form, and there's nothing to be gained by forcing them to type the upper case version.

Resolves #86518.

3 years agoRollup merge of #86415 - Kmeakin:iterator-associativity-docs, r=dtolnay
Yuki Okushi [Thu, 24 Jun 2021 04:47:34 +0000 (13:47 +0900)]
Rollup merge of #86415 - Kmeakin:iterator-associativity-docs, r=dtolnay

Document associativity of iterator folds.

Document the associativity of `Iterator::fold` and
`DoubleEndedIterator::rfold` and add examples demonstrating this.
Add links to direct users to the fold of the opposite associativity.

3 years agoRollup merge of #86296 - LeSeulArtichaut:thir-doc, r=nikomatsakis
Yuki Okushi [Thu, 24 Jun 2021 04:47:33 +0000 (13:47 +0900)]
Rollup merge of #86296 - LeSeulArtichaut:thir-doc, r=nikomatsakis

Add documentation for various THIR structs

Helps with rust-lang/project-thir-unsafeck#6.
r? `@nikomatsakis`

3 years agoRollup merge of #86137 - GuillaumeGomez:error-code-cleanup, r=Mark-Simulacrum
Yuki Okushi [Thu, 24 Jun 2021 04:47:26 +0000 (13:47 +0900)]
Rollup merge of #86137 - GuillaumeGomez:error-code-cleanup, r=Mark-Simulacrum

Error code cleanup and enforce checks

Fixes #86097.

It now checks if an error code is unused, and if so, will report an error if the error code wasn't commented out in the `error_codes.rs` file. It also checks that the constant used in the tidy check is up-to-date.

r? `@Mark-Simulacrum`

3 years agoHandle windows paths as well
Guillaume Gomez [Wed, 23 Jun 2021 21:56:16 +0000 (23:56 +0200)]
Handle windows paths as well

3 years agoAuto merge of #86138 - FabianWolff:issue-85871, r=nikomatsakis
bors [Wed, 23 Jun 2021 21:35:46 +0000 (21:35 +0000)]
Auto merge of #86138 - FabianWolff:issue-85871, r=nikomatsakis

Check whether the closure's owner is an ADT in thir-unsafeck

This pull request fixes #85871. The code in `rustc_mir_build/src/check_unsafety.rs` incorrectly assumes that a closure's owner always has a body, but only functions, closures, and constants have bodies, whereas a closure can also appear inside a struct or enum:
```rust
struct S {
    arr: [(); match || 1 { _ => 42 }]
}

enum E {
    A([(); { || 1; 42 }])
}
```
This pull request fixes the resulting ICE by checking whether the closure's owner is an ADT and only deferring to `thir_check_unsafety(owner)` if it isn't.

3 years agoGreatly improve code
Guillaume Gomez [Wed, 23 Jun 2021 14:42:35 +0000 (16:42 +0200)]
Greatly improve code

3 years agoRemove unused error codes from error_codes.rs and from EXEMPTED_FROM_TEST constant
Guillaume Gomez [Tue, 8 Jun 2021 14:37:59 +0000 (16:37 +0200)]
Remove unused error codes from error_codes.rs and from EXEMPTED_FROM_TEST constant

3 years agoAdd check on constant to ensure it's up to date
Guillaume Gomez [Tue, 8 Jun 2021 14:49:41 +0000 (16:49 +0200)]
Add check on constant to ensure it's up to date

3 years agoCheck if error code is used
Guillaume Gomez [Tue, 8 Jun 2021 14:06:33 +0000 (16:06 +0200)]
Check if error code is used

3 years agoAuto merge of #86573 - Mark-Simulacrum:expat-bump, r=pietroalbini
bors [Wed, 23 Jun 2021 18:35:37 +0000 (18:35 +0000)]
Auto merge of #86573 - Mark-Simulacrum:expat-bump, r=pietroalbini

Bump expat to 2.4.1

Temporary fix as expat 2.3.0 is now renamed, presumably due to https://github.com/libexpat/libexpat/blob/R_2_4_1/expat/Changes#L19.

r? `@pietroalbini`

3 years agoAdd bstr to rustc-workspace-hack for rustfmt/cargo.
Eric Huss [Wed, 23 Jun 2021 14:41:34 +0000 (07:41 -0700)]
Add bstr to rustc-workspace-hack for rustfmt/cargo.

3 years agoBump expat to 2.4.1
Mark Rousskov [Wed, 23 Jun 2021 14:37:52 +0000 (10:37 -0400)]
Bump expat to 2.4.1

3 years agoAuto merge of #86548 - GuillaumeGomez:fix-crate-filter-search-reset, r=jsha
bors [Wed, 23 Jun 2021 08:45:17 +0000 (08:45 +0000)]
Auto merge of #86548 - GuillaumeGomez:fix-crate-filter-search-reset, r=jsha

Fix crate filter search reset

I found a fun bug when using rustdoc recently: I made a search, cut the search input content, changed the crate filter, pasted back the input content. To my surprise, the crate filter wasn't applied. It's because that our search input was empty when receiving the `<select>` "onchange" event. To fix this issue, I reset the `currentResults` variable to `null`.

It's using the first commit from #86542 so it needs to wait for it before getting merged.

r? `@jsha`

3 years agoFix search filter update
Guillaume Gomez [Tue, 22 Jun 2021 10:06:09 +0000 (12:06 +0200)]
Fix search filter update

3 years agoAuto merge of #86564 - jsha:revert-83826, r=jyn514
bors [Wed, 23 Jun 2021 06:19:21 +0000 (06:19 +0000)]
Auto merge of #86564 - jsha:revert-83826, r=jyn514

Revert "List trait impls before methods from deref in the sidebar ..."

This reverts commit 8a058926ecd6d0988714f8f7a5a31293c533f8c6.

Fixes #85618

r? `@jyn514`

3 years agoTeach rustc to accept lowercase error codes
Aris Merchant [Tue, 22 Jun 2021 01:11:53 +0000 (18:11 -0700)]
Teach rustc to accept lowercase error codes

3 years agoAuto merge of #86386 - inquisitivecrystal:better-errors-for-display-traits-v3, r...
bors [Wed, 23 Jun 2021 03:16:04 +0000 (03:16 +0000)]
Auto merge of #86386 - inquisitivecrystal:better-errors-for-display-traits-v3, r=estebank

Better errors for Debug and Display traits

Currently, if someone tries to pass value that does not implement `Debug` or `Display` to a formatting macro, they get a very verbose and confusing error message. This PR changes the error messages for missing `Debug` and `Display` impls to be less overwhelming in this case, as suggested by #85844. I was a little less aggressive in changing the error message than that issue proposed. Still, this implementation would be enough to reduce the number of messages to be much more manageable.

After this PR, information on the cause of an error involving a `Debug` or `Display` implementation would suppressed if the requirement originated within a standard library macro. My reasoning was that errors originating from within a macro are confusing when they mention details that the programmer can't see, and this is particularly problematic for `Debug` and `Display`, which are most often used via macros. It is possible that either a broader or a narrower criterion would be better. I'm quite open to any feedback.

Fixes #85844.

3 years agoUpdated mir pretty print output
Deadbeef [Wed, 23 Jun 2021 02:39:53 +0000 (10:39 +0800)]
Updated mir pretty print output

3 years agoUse `use_verbose` for mir::Constant
Deadbeef [Wed, 23 Jun 2021 02:39:23 +0000 (10:39 +0800)]
Use `use_verbose` for mir::Constant

3 years agoRevert "List trait impls before methods from deref in the sidebar of Rustdoc's output"
Jacob Hoffman-Andrews [Wed, 23 Jun 2021 01:18:54 +0000 (18:18 -0700)]
Revert "List trait impls before methods from deref in the sidebar of Rustdoc's output"

This reverts commit 8a058926ecd6d0988714f8f7a5a31293c533f8c6.

3 years agoAuto merge of #86559 - Dylan-DPC:rollup-aixg3q5, r=Dylan-DPC
bors [Tue, 22 Jun 2021 23:58:03 +0000 (23:58 +0000)]
Auto merge of #86559 - Dylan-DPC:rollup-aixg3q5, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #86223 (Specify the kind of the item for E0121)
 - #86521 (Add comments around code where ordering is important due for panic-safety)
 - #86523 (Improvements to intra-doc link macro disambiguators)
 - #86542 (Line numbers aligned with content)
 - #86549 (Add destructuring example of E0508)
 - #86557 (Update books)

Failed merges:

 - #86548 (Fix crate filter search reset)

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agochore(rustdoc): Remove unused impl block
Michael Howell [Tue, 22 Jun 2021 23:41:34 +0000 (16:41 -0700)]
chore(rustdoc): Remove unused impl block

3 years agoUpdate cargo
Eric Huss [Tue, 22 Jun 2021 23:19:24 +0000 (16:19 -0700)]
Update cargo

3 years agoRollup merge of #86557 - ehuss:update-books, r=ehuss
Dylan DPC [Tue, 22 Jun 2021 22:20:24 +0000 (00:20 +0200)]
Rollup merge of #86557 - ehuss:update-books, r=ehuss

Update books

## nomicon

10 commits in 55de6fa3c1f331774da19472c9ee57d2ae9eb039..b9ca313e687c991223e23e5520529815dc281205
2021-05-12 00:31:01 +0900 to 2021-06-22 12:02:20 -0400
- The #[repr(C)] attribute on the callback example is not necessary, since the type is not used in C.
- Reorganize some chapters (rust-lang-nursery/nomicon#282)
- Mention "extern types" on the opaque structs section (rust-lang-nursery/nomicon#273)
- Clarify the conditions on the aliasing section (rust-lang-nursery/nomicon#272)
- Upgrade to edition 2018 (rust-lang-nursery/nomicon#280)
- Update some wording making reference to issues/RFCs (rust-lang-nursery/nomicon#271)
- Some improvements on the "subtyping" chapter (rust-lang-nursery/nomicon#278)
- Clarify casting between the same size fixed ints (rust-lang-nursery/nomicon#277)
- Add a link to show why unused lifetimes on structs are forbidden (rust-lang-nursery/nomicon#276)
- Fix small typo in the Drop Check chapter (rust-lang-nursery/nomicon#275)

## reference

8 commits in 8f598e2af6c25b4a7ee88ef6a8196d9b8ea50ca8..d9699fa8f3186440fdaadd703d63d8d42322c176
2021-06-01 19:00:46 +0100 to 2021-06-21 12:23:10 -0700
- Make explicit reference to scrutinee expression in grammar snippet (rust-lang-nursery/reference#1044)
- Document sub-namespaces. (rust-lang-nursery/reference#1043)
- Default all examples to 2018 edition. (rust-lang-nursery/reference#1041)
- Minor update to macros. (rust-lang-nursery/reference#1048)
-  (rust-lang-nursery/reference#1049)
- Add a note why the same size int casting is a no-op (rust-lang-nursery/reference#1046)
- Add notes on `#[target_feature]` for wasm (rust-lang-nursery/reference#1047)
- Make statement about variable visibility more precise (rust-lang-nursery/reference#1045)

## rustc-dev-guide

8 commits in c8da5bfd1c7c71d90ef1646f5e0a9f6609d5c78a..fe34beddb41dea5cb891032512a8d5b842b99696
2021-06-04 09:08:56 +0200 to 2021-06-21 21:50:12 +0200
- Update "Inference variables" section (rust-lang/rustc-dev-guide#1145)
- Document how to run unit tests (rust-lang/rustc-dev-guide#1141)
- We stopped using allow_internal_unstable a while ago (rust-lang/rustc-dev-guide#1142)
- Change the feature used as an example of stabilizing lib features (rust-lang/rustc-dev-guide#1143)
- We use HIR to do type inference, trait solving and type checking (rust-lang/rustc-dev-guide#1139)
- Add suggested settings note for coc (rust-lang/rustc-dev-guide#1144)
- move 7/8 to prose
- Add a section on keeping things up to date in the git section

## edition-guide

2 commits in 302a115e8f71876dfc884aebb0ca5ccb02b8a962..c74b2a0d6bf55774cf15d69f05dfe05408b8f81a
2021-05-21 10:46:11 -0400 to 2021-06-14 10:48:27 -0700
- Fix lies. (rust-lang/edition-guide#244)
- Add short summaries to all 2021 edition changes. (rust-lang/edition-guide#243)

## embedded-book

1 commits in 7349d173fa28a0bb834cf0264a05286620ef0923..cbec77fbd8eea0c13e390dd9eded1ae200e811d1
2021-05-25 13:59:05 +0000 to 2021-06-10 06:26:32 +0000
- Fix punctuation in c-with-rust.md  (rust-embedded/book#294)

3 years agoRollup merge of #86549 - mbartlett21:patch-1, r=GuillaumeGomez
Dylan DPC [Tue, 22 Jun 2021 22:20:23 +0000 (00:20 +0200)]
Rollup merge of #86549 - mbartlett21:patch-1, r=GuillaumeGomez

Add destructuring example of E0508

This adds an example that destructures the array to move the value, instead of taking a reference or cloning.

3 years agoRollup merge of #86542 - GuillaumeGomez:line-numbers-aligned-with-content, r=jyn514
Dylan DPC [Tue, 22 Jun 2021 22:20:22 +0000 (00:20 +0200)]
Rollup merge of #86542 - GuillaumeGomez:line-numbers-aligned-with-content, r=jyn514

Line numbers aligned with content

We had the issue a few times in the past where the source code pages' content wasn't aligned with the line numbers but completely below. This test will prevent this change to go unnoticed.

The first commit comes from https://github.com/rust-lang/rust/pull/86541 so it needs it to be merged first.

r? `@jsha`

3 years agoRollup merge of #86523 - LeSeulArtichaut:macros-disambiguators, r=jyn514
Dylan DPC [Tue, 22 Jun 2021 22:20:21 +0000 (00:20 +0200)]
Rollup merge of #86523 - LeSeulArtichaut:macros-disambiguators, r=jyn514

Improvements to intra-doc link macro disambiguators

A few small improvements around macro disambiguators:
- display the link text as it was entered: previously `[macro!()]` would be displayed without the parantheses (fixes #86309)
- support `!{}` and `![]` as macro disambiguators (fixes #86310)

r? `@jyn514` cc `@Manishearth` `@camelid`

3 years agoRollup merge of #86521 - the8472:add-footgun-comments, r=RalfJung
Dylan DPC [Tue, 22 Jun 2021 22:20:20 +0000 (00:20 +0200)]
Rollup merge of #86521 - the8472:add-footgun-comments, r=RalfJung

Add comments around code where ordering is important due for panic-safety

Iterators contain arbitrary code which may panic. Unsafe code has to be
careful to do its state updates at the right point between calls that may panic.

As requested in https://github.com/rust-lang/rust/pull/86452#discussion_r655153948

r? `@RalfJung`

3 years agoRollup merge of #86223 - fee1-dead:better-E0121, r=petrochenkov
Dylan DPC [Tue, 22 Jun 2021 22:20:18 +0000 (00:20 +0200)]
Rollup merge of #86223 - fee1-dead:better-E0121, r=petrochenkov

Specify the kind of the item for E0121

Fixes #86005

3 years agoUpdate books
Eric Huss [Tue, 22 Jun 2021 21:50:15 +0000 (14:50 -0700)]
Update books

3 years agoAuto merge of #85193 - pnkfelix:readd-support-for-inner-attrs-within-match, r=nikomat...
bors [Tue, 22 Jun 2021 21:17:12 +0000 (21:17 +0000)]
Auto merge of #85193 - pnkfelix:readd-support-for-inner-attrs-within-match, r=nikomatsakis

Re-add support for parsing (and pretty-printing) inner-attributes in match body

Re-add support for parsing (and pretty-printing) inner-attributes within body of a `match`.

In other words, we can do `match EXPR { #![inner_attr] ARM_1 ARM_2 ... }` again.

I believe this unbreaks the only four crates that crater flagged as broken by PR #83312.

(I am putting this up so that the lang-team can check it out and decide whether it changes their mind about what to do regarding PR #83312.)

3 years agoAuto merge of #86045 - jsgf:fix-emit-path-hashing, r=bjorn3
bors [Tue, 22 Jun 2021 17:34:55 +0000 (17:34 +0000)]
Auto merge of #86045 - jsgf:fix-emit-path-hashing, r=bjorn3

Fix emit path hashing

With `--emit KIND=PATH`, the PATH should not affect hashes used for dependency tracking. It does not with other ways of specifying output paths (`-o` or `--out-dir`).

Also updates `rustc -Zls` to print more info about crates, which is used here to implement a `run-make` test.

It seems there was already a test explicitly checking that `OutputTypes` hash *is* affected by the path. I think this behaviour is wrong, so I updated the test.

3 years agoAdd comments around code where ordering is important due for panic-safety
The8472 [Mon, 21 Jun 2021 19:29:43 +0000 (21:29 +0200)]
Add comments around code where ordering is important due for panic-safety

Iterators contain arbitrary code which may panic. Unsafe code has to be
careful to do its state updates at the right point between calls
that may panic.

3 years agoAdd documentation for various THIR structs
LeSeulArtichaut [Mon, 14 Jun 2021 15:39:25 +0000 (17:39 +0200)]
Add documentation for various THIR structs

3 years agoAuto merge of #86368 - michaelwoerister:lexing-ice, r=davidtwco
bors [Tue, 22 Jun 2021 14:53:58 +0000 (14:53 +0000)]
Auto merge of #86368 - michaelwoerister:lexing-ice, r=davidtwco

Disambiguate between SourceFiles from different crates even if they have the same path

This PR fixes an ICE that can occur when the compiler encounters a source file that is part of both the local crate and an upstream crate:

1. While importing source files from an upstream crate the compiler creates a `SourceFile` entry for `foo.rs` in the `SourceMap`. Since this is an imported source file its `src` field is `None`.
2. At a later point the parser encounters `foo.rs` again. It tells the `SourceMap` to load the file but because we already have an entry for `foo.rs` the `SourceMap` will return the existing version with `src == None`.
3. The parser proceeds under the assumption that `src.is_some()` and panics when actually trying to use the file's contents.

This PR fixes the issue by adding the source file's associated `CrateNum` to the `SourceMap`'s interning key. As a consequence the two instances of the file will each have a separate entry in the `SourceMap`. They just happen to share the same file path. This approach seemed less problematic to me than trying to mutate the `SourceFile` after it had already been created.

Another, more involved, approach might be to merge the `src` and the `external_src` field.

Fixes #85955

3 years agoAdd destructuring example of E0508
mbartlett21 [Tue, 22 Jun 2021 12:24:46 +0000 (22:24 +1000)]
Add destructuring example of E0508

This adds an example that destructures the array to move the value, instead of taking a reference or cloning.

3 years agoAuto merge of #86545 - JohnTitor:rollup-7sqdhpa, r=JohnTitor
bors [Tue, 22 Jun 2021 12:11:02 +0000 (12:11 +0000)]
Auto merge of #86545 - JohnTitor:rollup-7sqdhpa, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #86393 (Add regression test for issue #52025)
 - #86402 (rustdoc: add optional woff2 versions of Source Serif and Source Code)
 - #86451 (Resolve intra-doc links in summary desc)
 - #86501 (Cleanup handling of `crate_name` for doctests)
 - #86517 (Fix `unused_unsafe` around `await`)
 - #86537 (Mark some edition tests as check-pass)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #86537 - inquisitivecrystal:mark-edition-tests-check-pass, r=JohnTitor
Yuki Okushi [Tue, 22 Jun 2021 11:01:06 +0000 (20:01 +0900)]
Rollup merge of #86537 - inquisitivecrystal:mark-edition-tests-check-pass, r=JohnTitor

Mark some edition tests as check-pass

## Overview
This helps with #62277. In short, there are some tests that were marked as `build-pass` when it was unclear whether `check-pass` might be more appropriate. This PR marks some of those tests as `compile-pass`, in addition to making some incidental formatting improvements.

## A brief explanation of why this is correct
These tests fall into a few buckets.

`src/test/ui/dyn-keyword/dyn-2015-edition-keyword-ident-lint.rs`
`src/test/ui/dyn-keyword/dyn-2015-idents-in-decl-macros-unlinted.rs`
`src/test/ui/dyn-keyword/dyn-2015-idents-in-macros-unlinted.rs`
`src/test/ui/dyn-keyword/dyn-2015-no-warnings-without-lints.rs`
`src/test/ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs`

These test a lint for a keyword added in a new edition and the corresponding changes in keyword rules.

`src/test/ui/editions/edition-feature-ok.rs`
This checks that a feature related to an edition transition is valid.

`src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs`
This checks that imports between editions work correctly.

`src/test/ui/editions/edition-keywords-2015-2015-expansion.rs`
`src/test/ui/editions/edition-keywords-2018-2015-expansion.rs`
This checks the interaction between a change in keyword status over editions and macros.

All of the things being tested come before linking and codegen, so it is safe to use `check-pass` for them.

3 years agoRollup merge of #86517 - camsteffen:unused-unsafe-async, r=LeSeulArtichaut
Yuki Okushi [Tue, 22 Jun 2021 11:01:05 +0000 (20:01 +0900)]
Rollup merge of #86517 - camsteffen:unused-unsafe-async, r=LeSeulArtichaut

Fix `unused_unsafe` around `await`

Enables `unused_unsafe` lint for `unsafe { future.await }`.

The existing test for this is `unsafe { println!() }`, so I assume that `println!` used to contain compiler-generated unsafe but this is no longer true, and so the existing test is broken. I replaced the test with `unsafe { ...await }`. I believe `await` is currently the only instance of compiler-generated unsafe.

Reverts some parts of #85421, but the issue predates that PR.

3 years agoRollup merge of #86501 - jyn514:doctest-cleanup, r=CraftSpider
Yuki Okushi [Tue, 22 Jun 2021 11:01:04 +0000 (20:01 +0900)]
Rollup merge of #86501 - jyn514:doctest-cleanup, r=CraftSpider

Cleanup handling of `crate_name` for doctests

- Remove unnecessary reallocation
- Remove unnecessary messing around with `queries` for the crate name; it's simpler and faster to go through the TyCtxt instead
- Rename `cratename` -> `crate_name` for consistency with the rest of the compiler

3 years agoRollup merge of #86451 - notriddle:notriddle/rustdoc-intra-doc-link-summary, r=CraftS...
Yuki Okushi [Tue, 22 Jun 2021 11:01:02 +0000 (20:01 +0900)]
Rollup merge of #86451 - notriddle:notriddle/rustdoc-intra-doc-link-summary, r=CraftSpider

Resolve intra-doc links in summary desc

Before:

![rustdoc-intra-doc-link-summary-before](https://user-images.githubusercontent.com/1593513/122623069-9d995e80-d04f-11eb-8d46-ec2ec126bb5e.png)

After:

![rustdoc-intra-doc-link-summary](https://user-images.githubusercontent.com/1593513/122623076-a4c06c80-d04f-11eb-967a-f5916871c34b.png)

3 years agoRollup merge of #86402 - tspiteri:source-woff2, r=jsha
Yuki Okushi [Tue, 22 Jun 2021 11:01:01 +0000 (20:01 +0900)]
Rollup merge of #86402 - tspiteri:source-woff2, r=jsha

rustdoc: add optional woff2 versions of Source Serif and Source Code

This provides woff2 versions of Source Serif and Source Code similar to how #82545 provides woff2 versions of Fira Sans. The total byte count for the six files (three for each font family) is reduced by 25% from 476 KiB to 358 KiB.

3 years agoRollup merge of #86393 - yerke:add-test-for-issue-52025, r=JohnTitor
Yuki Okushi [Tue, 22 Jun 2021 11:01:00 +0000 (20:01 +0900)]
Rollup merge of #86393 - yerke:add-test-for-issue-52025, r=JohnTitor

Add regression test for issue #52025

Closes #52025

Took the test from #52025