Commit graph

150304 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Dylan DPC
bd04f4caff
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)
2021-06-23 00:20:24 +02:00
Dylan DPC
68485b4797
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.
2021-06-23 00:20:23 +02:00
Dylan DPC
f19aad85a8
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`
2021-06-23 00:20:22 +02:00
Dylan DPC
f9ebf1edb5
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`
2021-06-23 00:20:21 +02:00
Dylan DPC
6023ac2c8d
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`
2021-06-23 00:20:20 +02:00
Dylan DPC
af9e5d1a14
Rollup merge of #86223 - fee1-dead:better-E0121, r=petrochenkov
Specify the kind of the item for E0121

Fixes #86005
2021-06-23 00:20:18 +02:00
Eric Huss
ac604ac945 Update books 2021-06-22 14:50:15 -07:00
bors
6a758ea7e4 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.)
2021-06-22 21:17:12 +00:00
bors
b8be3162d7 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.
2021-06-22 17:34:55 +00:00
The8472
e0d70153cd 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.
2021-06-22 19:06:55 +02:00
LeSeulArtichaut
30793c1e81 Add documentation for various THIR structs 2021-06-22 17:58:30 +02:00
bors
80926fc409 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
2021-06-22 14:53:58 +00:00
mbartlett21
9db5c483ab
Add destructuring example of E0508
This adds an example that destructures the array to move the value, instead of taking a reference or cloning.
2021-06-22 22:24:46 +10:00
bors
3487be11d5 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
2021-06-22 12:11:02 +00:00
Yuki Okushi
00a7d5c08c
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.
2021-06-22 20:01:06 +09:00
Yuki Okushi
8ec4e7dfdd
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.
2021-06-22 20:01:05 +09:00
Yuki Okushi
8af9339e49
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
2021-06-22 20:01:04 +09:00
Yuki Okushi
555fbd7a43
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)
2021-06-22 20:01:02 +09:00