Commit Graph

150505 Commits

Author SHA1 Message Date
Aman Arora
de2052af9c 2229: Capture box completely in move closures
Even if the content from box is used in a sharef-ref context,
we capture the box entirerly.

This is motivated by:
1) We only capture data that is on the stack.
2) Capturing data from within the box might end up moving more data than
the user anticipated.
2021-06-24 19:39:51 -04:00
Michael Howell
14ca89446c chore(rustdoc): remove unused members of RenderType
Commit e629381653 removes the only place
these members variables are actually read.
2021-06-24 16:37:03 -07:00
bors
d4e7cb3254 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
2021-06-24 22:42:26 +00:00
Amanieu d'Antras
d0443bb7c2 Add a "raw" option for asm! which ignores format string specifiers 2021-06-24 23:42:15 +01:00
Mara Bos
06db210459 Don't lint :pat when re-parsing a macro from another crate. 2021-06-24 22:04:55 +00:00
Simonas Kazlauskas
cfcb2b664d 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.
2021-06-24 23:13:08 +03:00
Simonas Kazlauskas
493fe8008b Re-Annotate the tests with needs-llvm-components
Doesn't work though, because compiletest doesn't process ignores on a
per-revision manner.
2021-06-24 23:13:08 +03:00
Simonas Kazlauskas
a8e6a2cd9e 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.
2021-06-24 23:13:08 +03:00
bors
7c3872e6bf 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`
2021-06-24 20:01:39 +00:00
bors
cbeda5cbeb 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
2021-06-24 17:37:29 +00:00
bors
d95745e5fa 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.
2021-06-24 14:56:28 +00:00
Stefan Schindler
94c84bd72a Migrate from custom elements to divs with classes to be compatible with safari 2021-06-24 16:46:15 +02:00
Stefan Schindler
cc9ef7d8a8 Hide Crate Version on narrow Screens 2021-06-24 16:46:15 +02:00
Stefan Schindler
e2efcf10de Fixing the test rustdoc by ignoring *[@id="module-item"]//following-sibling::item-right relationship and rustdoc-gui 2021-06-24 16:46:15 +02:00
Stefan Schindler
6020c79dde Implement Desktop and Mobile version with gridlayout
* implement sans-serif #85621
2021-06-24 16:46:14 +02:00
Chris Denton
16145a9952
Test that env_clear works on Windows 2021-06-24 09:32:24 +01:00
Scott McMurray
579d19bc6a Use hash_one to simplify some other doctests 2021-06-24 01:30:48 -07:00
Scott McMurray
63d28192da Add tracking issue and rename to hash_one 2021-06-24 01:30:48 -07:00
Scott McMurray
a3eb9e3db2 Add BuildHasher::hash_of as unstable 2021-06-24 01:30:48 -07:00
Jacob Pratt
3f14f4b3ce
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]`.
2021-06-24 04:16:11 -04:00
bors
456a03227e 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`
2021-06-24 07:29:59 +00:00
Yuki Okushi
9323a2824b
Prefer "allow list" structure to check a type 2021-06-24 15:02:50 +09:00
Yuki Okushi
462c74007e
Rename function name in comments 2021-06-24 14:21:50 +09:00
Yuki Okushi
a141d29612
Do not panic in return_type_impl_trait 2021-06-24 14:06:28 +09:00
bors
964a81eb37 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
2021-06-24 04:48:46 +00:00
Yuki Okushi
64c9712cf3
Rollup merge of #86566 - fee1-dead:mir-pretty-print, r=oli-obk
Use `use_verbose` for `mir::Constant`

Fixes #79799.
2021-06-24 13:47:39 +09:00
Yuki Okushi
2322097ef4
Rollup merge of #86561 - notriddle:notriddle/cleanup-rustdoc, r=jyn514
chore(rustdoc): Remove unused impl block
2021-06-24 13:47:38 +09:00
Yuki Okushi
60dae7aabd
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)
2021-06-24 13:47:37 +09:00
Yuki Okushi
3998c03a65
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
2021-06-24 13:47:36 +09:00
Yuki Okushi
6b618c82ba
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.
2021-06-24 13:47:35 +09:00
Yuki Okushi
0fa4f0ba62
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.
2021-06-24 13:47:34 +09:00
Yuki Okushi
469329d4f8
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`
2021-06-24 13:47:33 +09:00
Yuki Okushi
55fd13bff4
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`
2021-06-24 13:47:26 +09:00
Smitty
157898e7d5 Point to the updated version of some dead links 2021-06-23 19:36:51 -04:00
Guillaume Gomez
0ab9d01dbd Handle windows paths as well 2021-06-23 23:56:16 +02:00
bors
f1e691da2e 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.
2021-06-23 21:35:46 +00:00
Smitty
bdfcb88e8b Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
Guillaume Gomez
20f1b1cc0a Greatly improve code 2021-06-23 21:32:37 +02:00
Guillaume Gomez
12b6d32387 Remove unused error codes from error_codes.rs and from EXEMPTED_FROM_TEST constant 2021-06-23 21:32:37 +02:00
Guillaume Gomez
22a702d016 Add check on constant to ensure it's up to date 2021-06-23 21:32:37 +02:00
Guillaume Gomez
23e5ed1288 Check if error code is used 2021-06-23 21:32:37 +02:00
bors
5a7834050f 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`
2021-06-23 18:35:37 +00:00
Eric Huss
d296ea09d3 Add bstr to rustc-workspace-hack for rustfmt/cargo. 2021-06-23 07:41:34 -07:00
Mark Rousskov
9fc77e2dab Bump expat to 2.4.1 2021-06-23 10:38:18 -04:00
Eric Huss
6aa79a34d8 Comment and include rust-analyzer. 2021-06-23 07:05:28 -07:00
klensy
ac72773215 fix pretty print for loop in mir and hir 2021-06-23 11:49:08 +03:00
bors
b6f3cb9502 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`
2021-06-23 08:45:17 +00:00
Guillaume Gomez
c4023c6ca3 Fix search filter update 2021-06-23 10:09:26 +02:00
bors
2ce052bb8d Auto merge of #86564 - jsha:revert-83826, r=jyn514
Revert "List trait impls before methods from deref in the sidebar ..."

This reverts commit 8a058926ec.

Fixes #85618

r? `@jyn514`
2021-06-23 06:19:21 +00:00
Aris Merchant
0bb6bc40ce Teach rustc to accept lowercase error codes 2021-06-22 22:56:38 -07:00