Commit graph

150496 commits

Author SHA1 Message Date
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
Eric Huss
601d24810e Don't dist miri on stable or beta. 2021-06-22 22:10:25 -07:00
bors
8cb207ae69 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.
2021-06-23 03:16:04 +00:00
Deadbeef
6370567664
Updated mir pretty print output 2021-06-23 10:39:53 +08:00
Deadbeef
4d1b3a584e
Use use_verbose for mir::Constant 2021-06-23 10:39:23 +08:00
Manuel Drehwald
f454aab3d6 Add missing use 2021-06-23 04:26:14 +02:00
Jacob Hoffman-Andrews
093e246445 Revert "List trait impls before methods from deref in the sidebar of Rustdoc's output"
This reverts commit 8a058926ec.
2021-06-22 18:18:54 -07:00
bors
574c9dd6f2 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
2021-06-22 23:58:03 +00:00
Michael Howell
e629381653 chore(rustdoc): Remove unused impl block 2021-06-22 16:41:34 -07:00
Eric Huss
faa6461d55 Update cargo 2021-06-22 16:19:24 -07:00