]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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

3 years agoAuto merge of #84910 - eopb:stabilize_int_error_matching, r=yaahc
bors [Tue, 22 Jun 2021 09:30:15 +0000 (09:30 +0000)]
Auto merge of #84910 - eopb:stabilize_int_error_matching, r=yaahc

stabilize `int_error_matching`

closes #22639

> It has been over half a year since https://github.com/rust-lang/rust/pull/77640#pullrequestreview-511263516, and the indexing question is rejected in https://github.com/rust-lang/rust/pull/79728#pullrequestreview-633030341, so I guess we can submit another stabilization attempt? ðŸ˜‰

_Originally posted by `@kennytm` in https://github.com/rust-lang/rust/issues/22639#issuecomment-831738266_

3 years agopostpone stabilizaton by one release
Ethan Brierley [Tue, 22 Jun 2021 09:20:56 +0000 (10:20 +0100)]
postpone stabilizaton by one release

3 years agoadd regression test for issue #52025
Yerkebulan Tulibergenov [Tue, 22 Jun 2021 09:03:52 +0000 (02:03 -0700)]
add regression test for issue #52025

3 years agoAuto merge of #85707 - jam1garner:future_prelude_collision_lint, r=nikomatsakis
bors [Tue, 22 Jun 2021 07:01:54 +0000 (07:01 +0000)]
Auto merge of #85707 - jam1garner:future_prelude_collision_lint, r=nikomatsakis

Add `future_prelude_collision` lint

Implements #84594. (RFC rust-lang/rfcs#3114 ([rendered](https://github.com/rust-lang/rfcs/blob/master/text/3114-prelude-2021.md))) Not entirely complete but wanted to have my progress decently available while I finish off the last little bits.

Things left to implement:

* [x] UI tests for lints
* [x] Only emit lint for 2015 and 2018 editions
* [ ] Lint name/message bikeshedding
* [x] Implement for `FromIterator` (from best I can tell, the current approach as mentioned from [this comment](https://github.com/rust-lang/rust/issues/84594#issuecomment-847288288) won't work due to `FromIterator` instances not using dot-call syntax, but if I'm correct about this then that would also need to be fixed for `TryFrom`/`TryInto`)*
* [x] Add to `rust-2021-migration` group? (See #85512) (added to `rust-2021-compatibility` group)
* [ ] Link to edition guide in lint docs

*edit: looked into it, `lookup_method` will also not be hit for `TryFrom`/`TryInto` for non-dotcall syntax. If anyone who is more familiar with typecheck knows the equivalent for looking up associated functions, feel free to chime in.

3 years agoMark some edition tests as check-pass
Aris Merchant [Tue, 22 Jun 2021 05:03:50 +0000 (22:03 -0700)]
Mark some edition tests as check-pass

3 years agoAuto merge of #86352 - yerke:add-test-for-issue-37508, r=Mark-Simulacrum
bors [Tue, 22 Jun 2021 04:15:15 +0000 (04:15 +0000)]
Auto merge of #86352 - yerke:add-test-for-issue-37508, r=Mark-Simulacrum

Add regression test for issue #37508

Add regression test for issue #37508

Closes #37508

Took this test from #37508 and updated the panic handler to the modern standard.

r? `@Mark-Simulacrum`

Mark, I hope you don't me tagging you here. You were involved in the original issue and I hope you might be more comfortable reviewing this.

3 years agoAuto merge of #86527 - JohnTitor:rollup-cbu78g4, r=JohnTitor
bors [Tue, 22 Jun 2021 01:14:31 +0000 (01:14 +0000)]
Auto merge of #86527 - JohnTitor:rollup-cbu78g4, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #85054 (Revert SGX inline asm syntax)
 - #85182 (Move `available_concurrency` implementation to `sys`)
 - #86037 (Add `io::Cursor::{remaining, remaining_slice, is_empty}`)
 - #86114 (Reopen #79692 (Format symbols under shared frames))
 - #86297 (Allow to pass arguments to rustdoc-gui tool)
 - #86334 (Resolve type aliases to the type they point to in intra-doc links)
 - #86367 (Fix comment about rustc_inherit_overflow_checks in abs().)
 - #86381 (Add regression test for issue #39161)
 - #86387 (Remove `#[allow(unused_lifetimes)]` which is now unnecessary)
 - #86398 (Add regression test for issue #54685)
 - #86493 (Say "this enum variant takes"/"this struct takes" instead of "this function takes")

Failed merges:

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

3 years agoAdd test showing different KIND parameters change hash
Jeremy Fitzhardinge [Tue, 22 Jun 2021 00:10:46 +0000 (17:10 -0700)]
Add test showing different KIND parameters change hash

3 years agoOnly hash OutputTypes keys in non-crate-hash mode
Aaron Hill [Sun, 20 Jun 2021 00:22:14 +0000 (19:22 -0500)]
Only hash OutputTypes keys in non-crate-hash mode

This effectively turns OutputTypes into a hybrid where keys (OutputType)
are TRACKED and the values (optional paths) are TRACKED_NO_CRATE_HASH.

3 years agomake -Zno-codegen TRACKED_NO_CRATE_HASH
Jeremy Fitzhardinge [Wed, 9 Jun 2021 23:51:58 +0000 (16:51 -0700)]
make -Zno-codegen TRACKED_NO_CRATE_HASH

3 years agoImplement assert_non_crate_hash_different for tests
Jeremy Fitzhardinge [Thu, 10 Jun 2021 21:01:21 +0000 (14:01 -0700)]
Implement assert_non_crate_hash_different for tests

3 years agoIn --emit KIND=PATH options, only hash KIND
Jeremy Fitzhardinge [Sat, 5 Jun 2021 22:43:12 +0000 (15:43 -0700)]
In --emit KIND=PATH options, only hash KIND

The PATH has no material effect on the emitted artifact, and setting
the patch via `-o` or `--out-dir` does not affect the hash.

Closes https://github.com/rust-lang/rust/issues/86044

3 years agoPrint more crate details in -Zls
Jeremy Fitzhardinge [Sat, 5 Jun 2021 22:42:04 +0000 (15:42 -0700)]
Print more crate details in -Zls

Useful for debugging crate hash and resolution issues.

3 years agoDon't reallocate the crate name when running doctests
Joshua Nelson [Mon, 21 Jun 2021 00:34:38 +0000 (20:34 -0400)]
Don't reallocate the crate name when running doctests

3 years agoRename cratename -> crate_name
Joshua Nelson [Mon, 21 Jun 2021 00:24:59 +0000 (20:24 -0400)]
Rename cratename -> crate_name

This makes it consistent with rustc_session::Options.

3 years agoRemove unnecessary call to queries.crate_name()
Joshua Nelson [Mon, 21 Jun 2021 00:22:25 +0000 (20:22 -0400)]
Remove unnecessary call to queries.crate_name()

It's much more complicated than just going through the TyCtxt.

3 years agoRollup merge of #86493 - Smittyvb:ctor-typeck-error, r=davidtwco
Yuki Okushi [Mon, 21 Jun 2021 22:37:56 +0000 (07:37 +0900)]
Rollup merge of #86493 - Smittyvb:ctor-typeck-error, r=davidtwco

Say "this enum variant takes"/"this struct takes" instead of "this function takes"

This makes error messages for functions with incorrect argument counts adapt if they refer to a struct or enum variant:
```
error[E0061]: this enum variant takes 1 argument but 0 arguments were supplied
  --> $DIR/struct-enum-wrong-args.rs:7:13
   |
LL |     let _ = Ok();
   |             ^^-- supplied 0 arguments
   |             |
   |             expected 1 argument

error[E0061]: this struct takes 1 argument but 0 arguments were supplied
  --> $DIR/struct-enum-wrong-args.rs:8:13
   |
LL |     let _ = Wrapper();
   |             ^^^^^^^-- supplied 0 arguments
   |             |
   |             expected 1 argument
```

Fixes #86481.

3 years agoRollup merge of #86398 - yerke:add-test-for-issue-54685, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 22:37:54 +0000 (07:37 +0900)]
Rollup merge of #86398 - yerke:add-test-for-issue-54685, r=Mark-Simulacrum

Add regression test for issue #54685

Closes #54685

Took the test from #54685 and modified it a bit to use assertion. Made sure that the updated test catches the original issue on 1.50 by running on Compiler Explorer (https://godbolt.org/z/E64onYeT5).

3 years agoRollup merge of #86387 - JohnTitor:now-no-unused-lifetimes, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 22:37:53 +0000 (07:37 +0900)]
Rollup merge of #86387 - JohnTitor:now-no-unused-lifetimes, r=Mark-Simulacrum

Remove `#[allow(unused_lifetimes)]` which is now unnecessary

Seems FP has been fixed, it doesn't need `#[allow(unused_lifetimes)]` anymore.

3 years agoRollup merge of #86381 - yerke:add-test-for-issue-39161, r=JohnTitor
Yuki Okushi [Mon, 21 Jun 2021 22:37:52 +0000 (07:37 +0900)]
Rollup merge of #86381 - yerke:add-test-for-issue-39161, r=JohnTitor

Add regression test for issue #39161

Closes #39161

Based on feedback from ``@JohnTitor`` in https://github.com/rust-lang/rust/pull/71333

r? ``@JohnTitor``

3 years agoRollup merge of #86367 - m-ou-se:fix-abs-comment, r=scottmcm
Yuki Okushi [Mon, 21 Jun 2021 22:37:51 +0000 (07:37 +0900)]
Rollup merge of #86367 - m-ou-se:fix-abs-comment, r=scottmcm

Fix comment about rustc_inherit_overflow_checks in abs().

3 years agoRollup merge of #86334 - LeSeulArtichaut:86120-links-type-aliases, r=jyn514
Yuki Okushi [Mon, 21 Jun 2021 22:37:49 +0000 (07:37 +0900)]
Rollup merge of #86334 - LeSeulArtichaut:86120-links-type-aliases, r=jyn514

Resolve type aliases to the type they point to in intra-doc links

This feels a bit sketchy, but I think it's better than just rejecting the link.
Helps with #86120, r? ``@jyn514``

3 years agoRollup merge of #86297 - GuillaumeGomez:rustdoc-gui-args, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 22:37:48 +0000 (07:37 +0900)]
Rollup merge of #86297 - GuillaumeGomez:rustdoc-gui-args, r=Mark-Simulacrum

Allow to pass arguments to rustdoc-gui tool

Very convenient for testing. This is another part of https://github.com/rust-lang/rust/pull/86293

cc ``@jsha``
r? ``@Mark-Simulacrum``

3 years agoRollup merge of #86114 - JDuchniewicz:feat/panic-frame-fmt, r=yaahc
Yuki Okushi [Mon, 21 Jun 2021 22:37:47 +0000 (07:37 +0900)]
Rollup merge of #86114 - JDuchniewicz:feat/panic-frame-fmt, r=yaahc

Reopen #79692 (Format symbols under shared frames)

Reopening #79692.

3 years agoRollup merge of #86037 - soerenmeier:cursor_remaining, r=yaahc
Yuki Okushi [Mon, 21 Jun 2021 22:37:46 +0000 (07:37 +0900)]
Rollup merge of #86037 - soerenmeier:cursor_remaining, r=yaahc

Add `io::Cursor::{remaining, remaining_slice, is_empty}`

Tracking issue: #86369

I came across an inconvenience when answering the following [Stack Overflow](https://stackoverflow.com/questions/67831170) question.
To get the remaining slice you have to call `buff.fill_buf().unwrap()`. Which in my opinion doesn't really tell you what is returned (in the context of Cursor). To improve readability and convenience when using Cursor i propose adding the method `remaining`.

The next thing i found inconvenient (unnecessary long) was detecting if the cursor reached the end. There are a few ways this can be achieved right now:
- `buff.fill_buf().unwrap().is_empty()`
- `buff.position() >= buff.get_ref().len()`
- `buff.bytes().next().is_none()`

Which all seem a bit unintuitive, hidden in trait documentations or just a bit long for such a simple task.
Therefor i propose another method called `is_empty`, maybe with another name, since this one may leave room for interpretation on what really is empty (the underlying slice, the remaining slice or maybe the position).

Since it seemed easier to create this PR instead of an RFC i did that, if an RFC is wanted, i can close this PR and write an RFC first.

3 years agoRollup merge of #85182 - CDirkx:available_concurrency, r=JohnTitor
Yuki Okushi [Mon, 21 Jun 2021 22:37:46 +0000 (07:37 +0900)]
Rollup merge of #85182 - CDirkx:available_concurrency, r=JohnTitor

Move `available_concurrency` implementation to `sys`

This splits out the platform-specific implementation of `available_concurrency` to the corresponding platforms under `sys`. No changes are made to the implementation.

Tidy didn't lint against this code being originally added outside of `sys` because of a bug (see #84677), this PR also reverts the exclusion that was introduced in that bugfix.

Tracking issue of `available_concurrency`: #74479

3 years agoRollup merge of #85054 - jethrogb:jb/sgx-inline-asm, r=Amanieu
Yuki Okushi [Mon, 21 Jun 2021 22:37:42 +0000 (07:37 +0900)]
Rollup merge of #85054 - jethrogb:jb/sgx-inline-asm, r=Amanieu

Revert SGX inline asm syntax

This was erroneously changed in #83387

3 years agoFix unused_unsafe with compiler-generated unsafe
Cameron Steffen [Fri, 30 Apr 2021 01:54:22 +0000 (20:54 -0500)]
Fix unused_unsafe with compiler-generated unsafe

3 years agoAuto merge of #86383 - shamatar:slice_len_lowering, r=bjorn3
bors [Mon, 21 Jun 2021 22:24:13 +0000 (22:24 +0000)]
Auto merge of #86383 - shamatar:slice_len_lowering, r=bjorn3

Add MIR pass to lower call to `core::slice::len` into `Len` operand

During some larger experiment with range analysis I've found that code like `let l = slice.len()` produces different MIR then one found in bound checks. This optimization pass replaces terminators that are calls to `core::slice::len` with just a MIR operand and Goto terminator.

It uses some heuristics to remove the outer borrow that is made to call `core::slice::len`, but I assume it can be eliminated, just didn't find how.

Would like to express my gratitude to `@oli-obk` who helped me a lot on Zullip

3 years agoAuto merge of #86515 - JohnTitor:rollup-axzb4xh, r=JohnTitor
bors [Mon, 21 Jun 2021 19:36:04 +0000 (19:36 +0000)]
Auto merge of #86515 - JohnTitor:rollup-axzb4xh, r=JohnTitor

Rollup of 9 pull requests

Successful merges:

 - #86192 (Make OR_PATTERNS_BACK_COMPAT be a 2021 future-incompatible lint)
 - #86248 (Add a regression test for issue-85113)
 - #86274 (Spaces)
 - #86349 (Add regression test for issue #78632)
 - #86424 (rustfmt: load nested out-of-line mods correctly)
 - #86472 (Fix CI to fetch master on beta channel)
 - #86473 (Rustdoc: Account for const-unstable functions)
 - #86495 (Improve `proc_macro::{Punct, Spacing}` documentation)
 - #86503 (Fix rust.css fonts.)

Failed merges:

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

3 years agointroduce helper function
Niko Matsakis [Mon, 21 Jun 2021 18:36:25 +0000 (14:36 -0400)]
introduce helper function

3 years agoadd test for `dyn` collisions
Niko Matsakis [Mon, 21 Jun 2021 15:55:07 +0000 (11:55 -0400)]
add test for `dyn` collisions

3 years agodo not run rustfix for future-prelude-collision-shadow
Niko Matsakis [Mon, 21 Jun 2021 14:58:10 +0000 (10:58 -0400)]
do not run rustfix for future-prelude-collision-shadow

3 years agoReference issue test originated from
Smitty [Mon, 21 Jun 2021 15:17:30 +0000 (11:17 -0400)]
Reference issue test originated from

3 years agoRollup merge of #86503 - ehuss:rustc.css-fonts, r=jyn514,GuillaumeGomez
Yuki Okushi [Mon, 21 Jun 2021 15:00:45 +0000 (00:00 +0900)]
Rollup merge of #86503 - ehuss:rustc.css-fonts, r=jyn514,GuillaumeGomez

Fix rust.css fonts.

The `rust.css` file (used for all non-rustdoc and non-mdbook pages) has gotten out of sync with rustdoc's css. The two share the same fonts, so this updates them to match what rustdoc uses.

It would be ideal not to need this at all, but that's for another time.

3 years agoRollup merge of #86495 - r00ster91:patch-11, r=petrochenkov
Yuki Okushi [Mon, 21 Jun 2021 15:00:44 +0000 (00:00 +0900)]
Rollup merge of #86495 - r00ster91:patch-11, r=petrochenkov

Improve `proc_macro::{Punct, Spacing}` documentation

I noticed some misspellings and then thought I could improve it a bit overall.

3 years agoRollup merge of #86473 - fee1-dead:rustdoc-const-unstable, r=jyn514
Yuki Okushi [Mon, 21 Jun 2021 15:00:43 +0000 (00:00 +0900)]
Rollup merge of #86473 - fee1-dead:rustdoc-const-unstable, r=jyn514

Rustdoc: Account for const-unstable functions

Fixes #86464

3 years agoRollup merge of #86472 - Mark-Simulacrum:fix-ci-beta, r=pietroalbini
Yuki Okushi [Mon, 21 Jun 2021 15:00:42 +0000 (00:00 +0900)]
Rollup merge of #86472 - Mark-Simulacrum:fix-ci-beta, r=pietroalbini

Fix CI to fetch master on beta channel

This forward-ports a fix from the beta channel (landing in #86413, hopefully) to master so that we don't need to apply it on each round of backports.

This bug also demonstrates that our channel-checking is a bit insufficient -- stable is checked, but beta has some of its own peculiarities currently and isn't checked. But this does not attempt to adjust for that; we likely can't afford to run both beta and stable channels by CI and the current state here seems OK for now.

r? `@pietroalbini`

3 years agoRollup merge of #86424 - calebcartwright:rustfmt-mod-resolution, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 15:00:41 +0000 (00:00 +0900)]
Rollup merge of #86424 - calebcartwright:rustfmt-mod-resolution, r=Mark-Simulacrum

rustfmt: load nested out-of-line mods correctly

This should address https://github.com/rust-lang/rustfmt/issues/4874

r? `@Mark-Simulacrum`

Decided to make the change directly in tree here for expediency/to minimize any potential backporting issues, and because there's some subtree sync items I need to get resolved before pulling from r-l/rustfmt

3 years agoRollup merge of #86349 - yerke:add-test-for-issue-78632, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 15:00:40 +0000 (00:00 +0900)]
Rollup merge of #86349 - yerke:add-test-for-issue-78632, r=Mark-Simulacrum

Add regression test for issue #78632

Add regression test for issue #78632

Closes #78632

Took this test from #78632 (what was committed to glacier in https://github.com/rust-lang/rust/issues/78632#issuecomment-731843345).

Tested that the we get ICE on 1.52.1 on the playground (https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=b86d51fee4cded9d24b50d8ecbc48c6a).

3 years agoRollup merge of #86274 - alexander-melentyev:spaces, r=bjorn3
Yuki Okushi [Mon, 21 Jun 2021 15:00:38 +0000 (00:00 +0900)]
Rollup merge of #86274 - alexander-melentyev:spaces, r=bjorn3

Spaces

3 years agoRollup merge of #86248 - JohnTitor:issue-85113, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 15:00:37 +0000 (00:00 +0900)]
Rollup merge of #86248 - JohnTitor:issue-85113, r=Mark-Simulacrum

Add a regression test for issue-85113

Fixed by #86118, closes #85113

3 years agoRollup merge of #86192 - hi-rustin:rustin-patch-lint, r=nikomatsakis
Yuki Okushi [Mon, 21 Jun 2021 15:00:36 +0000 (00:00 +0900)]
Rollup merge of #86192 - hi-rustin:rustin-patch-lint, r=nikomatsakis

Make OR_PATTERNS_BACK_COMPAT be a 2021 future-incompatible lint

close https://github.com/rust-lang/rust/issues/84869

r? `@nikomatsakis`

3 years agoEncode SourceFile source crate as StableCrateId in incr. comp. OnDiskCache.
Michael Woerister [Mon, 21 Jun 2021 13:30:16 +0000 (15:30 +0200)]
Encode SourceFile source crate as StableCrateId in incr. comp. OnDiskCache.

3 years agoReadd `unsafe` keyword in tests
Deadbeef [Mon, 21 Jun 2021 12:42:57 +0000 (20:42 +0800)]
Readd `unsafe` keyword in tests

3 years agoUpdate comment regarding staged_api
Deadbeef [Mon, 21 Jun 2021 12:21:37 +0000 (20:21 +0800)]
Update comment regarding staged_api

3 years agoAuto merge of #86210 - ehuss:rustfix-update, r=Mark-Simulacrum
bors [Mon, 21 Jun 2021 12:21:19 +0000 (12:21 +0000)]
Auto merge of #86210 - ehuss:rustfix-update, r=Mark-Simulacrum

Rustfix update

This updates to rustfix 0.6.0. One of the key changes here is https://github.com/rust-lang/rustfix/pull/195 which changes rustfix to apply multi-part suggestions. One of the tests needs to updated because there are some overlapping suggestions which rustfix cannot handle. The solution is to only apply the machine-applicable suggestions to avoid the overlapping issue.

This also includes a minor change to compiletest to provide better error messages with rustfix.

3 years agoRemoved/Updated some cases and simplified `match`
Deadbeef [Mon, 21 Jun 2021 12:15:27 +0000 (20:15 +0800)]
Removed/Updated some cases and simplified `match`

3 years agoDisambiguate between SourceFiles from different crates even if they have the same...
Michael Woerister [Wed, 16 Jun 2021 14:48:06 +0000 (16:48 +0200)]
Disambiguate between SourceFiles from different crates even if they have the same path.

3 years agoAdd regression test for #85955.
Michael Woerister [Wed, 16 Jun 2021 14:32:42 +0000 (16:32 +0200)]
Add regression test  for #85955.

3 years agoAdded some tests for `unsafe` in const-dispay.rs
Deadbeef [Mon, 21 Jun 2021 11:17:07 +0000 (19:17 +0800)]
Added some tests for `unsafe` in const-dispay.rs

3 years agoCheck for const_unstable before printing `const`
Deadbeef [Sun, 20 Jun 2021 00:39:54 +0000 (08:39 +0800)]
Check for const_unstable before printing `const`

3 years agoAuto merge of #86157 - jsha:tera, r=jyn514,GuillaumeGomez
bors [Mon, 21 Jun 2021 09:40:34 +0000 (09:40 +0000)]
Auto merge of #86157 - jsha:tera, r=jyn514,GuillaumeGomez

Use Tera templates for rustdoc.

Replaces a format!() call in layout::render with a template
expansion. Introduces a `templates` field in SharedContext so parts
of rustdoc can share pre-rendered templates.

This currently builds in a copy of the single template available, like
with static files. However, future work can make this live-loadable with
a perma-unstable flag, to make rustdoc developers' work easier.

Part of #84419.

Demo at https://hoffman-andrews.com/rust/tera/std/string/struct.String.html.

3 years agoUse `Unsupported` on platforms where `available_concurrency` is not implemented.
Christiaan Dirkx [Mon, 21 Jun 2021 09:31:07 +0000 (11:31 +0200)]
Use `Unsupported` on platforms where `available_concurrency` is not implemented.

3 years agoRemove tidy exception for `available_concurrency`
Christiaan Dirkx [Tue, 11 May 2021 12:58:18 +0000 (14:58 +0200)]
Remove tidy exception for `available_concurrency`

3 years agoResolve type aliases to the type they point to in intra-doc links
LeSeulArtichaut [Tue, 15 Jun 2021 17:53:50 +0000 (19:53 +0200)]
Resolve type aliases to the type they point to in intra-doc links

3 years agoDelete spaces
Alexander Melentyev [Mon, 21 Jun 2021 09:11:37 +0000 (12:11 +0300)]
Delete spaces

3 years agoMove `available_concurrency` implementation to `sys`
Christiaan Dirkx [Thu, 29 Apr 2021 09:40:14 +0000 (11:40 +0200)]
Move `available_concurrency` implementation to `sys`

3 years agoAuto merge of #85775 - adamrk:warn-unused-target-fields, r=nagisa
bors [Mon, 21 Jun 2021 06:56:51 +0000 (06:56 +0000)]
Auto merge of #85775 - adamrk:warn-unused-target-fields, r=nagisa

Emit warnings for unused fields in custom targets.

Add a warning which lists any fields in a custom target `json` file that aren't used. Currently unrecognized fields are ignored so, for example, a typo in the `json` will silently produce a target which isn't the one intended.

3 years agoUse Tera templates for rustdoc.
Jacob Hoffman-Andrews [Wed, 9 Jun 2021 00:19:03 +0000 (17:19 -0700)]
Use Tera templates for rustdoc.

Replaces a format!() call in layout::render with a template
expansion. Introduces a `templates` field in SharedContext so parts
of rustdoc can share pre-rendered templates.

This currently builds in a copy of the single template available, like
with static files. However, future work can make this live-loadable with
a perma-unstable flag, to make rustdoc developers' work easier.

3 years agoAuto merge of #86166 - tmiasko:no-alloca-for-zsts, r=nagisa
bors [Mon, 21 Jun 2021 04:03:51 +0000 (04:03 +0000)]
Auto merge of #86166 - tmiasko:no-alloca-for-zsts, r=nagisa

Do not emit alloca for ZST locals with multiple assignments

This extends 35566bfd7dd2e316d190078703de54a4dadda062 to additionally stop emitting unnecessary allocas for zero sized locals that are assigned multiple times.

When rebuilding the standard library with `-Zbuild-std` this reduces the number of locals that require an allocation from 62315 to 61767.

3 years agoAuto merge of #86502 - JohnTitor:rollup-wge0f3x, r=JohnTitor
bors [Mon, 21 Jun 2021 01:16:15 +0000 (01:16 +0000)]
Auto merge of #86502 - JohnTitor:rollup-wge0f3x, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #83739 (Account for bad placeholder errors on consts/statics with trait objects)
 - #85637 (document PartialEq, PartialOrd, Ord requirements more explicitly)
 - #86152 (Lazify is_really_default condition in the RustdocGUI bootstrap step)
 - #86156 (Fix a bug in the linkchecker)
 - #86427 (Updated release note)
 - #86452 (fix panic-safety in specialized Zip::next_back)
 - #86484 (Do not set depth to 0 in fully_expand_fragment)
 - #86491 (expand: Move some more derive logic to rustc_builtin_macros)

Failed merges:

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

3 years agoFix rust.css fonts.
Eric Huss [Mon, 21 Jun 2021 01:15:54 +0000 (18:15 -0700)]
Fix rust.css fonts.

3 years agoRollup merge of #86491 - petrochenkov:derefact, r=Aaron1011
Yuki Okushi [Mon, 21 Jun 2021 00:42:19 +0000 (09:42 +0900)]
Rollup merge of #86491 - petrochenkov:derefact, r=Aaron1011

expand: Move some more derive logic to rustc_builtin_macros

And cleanup some `unwrap`s in `cfg_eval`.

Refactorings extracted from https://github.com/rust-lang/rust/pull/83354 and https://github.com/rust-lang/rust/pull/86057.
r? ``@Aaron1011``

3 years agoRollup merge of #86484 - fee1-dead:builtin-macro-recursion, r=petrochenkov
Yuki Okushi [Mon, 21 Jun 2021 00:42:18 +0000 (09:42 +0900)]
Rollup merge of #86484 - fee1-dead:builtin-macro-recursion, r=petrochenkov

Do not set depth to 0 in fully_expand_fragment

Fixes #84632.

3 years agoRollup merge of #86452 - the8472:fix-zip-drop-safety, r=m-ou-se
Yuki Okushi [Mon, 21 Jun 2021 00:42:17 +0000 (09:42 +0900)]
Rollup merge of #86452 - the8472:fix-zip-drop-safety, r=m-ou-se

fix panic-safety in specialized Zip::next_back

This was unsound since a panic in a.next_back() would result in the
length not being updated which would then lead to the same element
being revisited in the side-effect preserving code.

fixes #86443

3 years agoRollup merge of #86427 - hi-rustin:rustin-patch-release-note, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 00:42:16 +0000 (09:42 +0900)]
Rollup merge of #86427 - hi-rustin:rustin-patch-release-note, r=Mark-Simulacrum

Updated release note

close https://github.com/rust-lang/rust/issues/77098

base on https://github.com/rust-lang/rust/pull/78690

3 years agoRollup merge of #86156 - ehuss:linkchecker-fixes, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 00:42:15 +0000 (09:42 +0900)]
Rollup merge of #86156 - ehuss:linkchecker-fixes, r=Mark-Simulacrum

Fix a bug in the linkchecker

There was a small typo in the linkchecker (in #85652) that caused it to report a `#` fragment link error pointing to the wrong file (it was displaying the path to the source file, not the target of the link).

This also includes a few other changes:
- Fixes the tests due to some changes in the redirect handling in #84703.
- Adds the tests to rustbuild to run whenever the linkchecker itself is run.
- Updates the tests to validate more of the output (so that a mistake like this would have been caught).

Closes #86144

3 years agoRollup merge of #86152 - the8472:lazify-npm-queries, r=Mark-Simulacrum
Yuki Okushi [Mon, 21 Jun 2021 00:42:15 +0000 (09:42 +0900)]
Rollup merge of #86152 - the8472:lazify-npm-queries, r=Mark-Simulacrum

Lazify is_really_default condition in the RustdocGUI bootstrap step

The `RustdocGUI::should_run` condition spawns `npm list` several times which adds up to seconds of wall-time.
Evaluate the condition lazily to to keep `./x.py test tidy` and similar short-running tasks fast.

Fixes #86147

3 years agoRollup merge of #85637 - RalfJung:partial-ord, r=m-ou-se
Yuki Okushi [Mon, 21 Jun 2021 00:42:13 +0000 (09:42 +0900)]
Rollup merge of #85637 - RalfJung:partial-ord, r=m-ou-se

document PartialEq, PartialOrd, Ord requirements more explicitly

This is the result of discussion in https://github.com/rust-lang/rust/issues/50230, in particular [this summary comment](https://github.com/rust-lang/rust/issues/50230#issuecomment-392819364).

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

3 years agoRollup merge of #83739 - JohnTitor:issue-75889, r=estebank
Yuki Okushi [Mon, 21 Jun 2021 00:42:12 +0000 (09:42 +0900)]
Rollup merge of #83739 - JohnTitor:issue-75889, r=estebank

Account for bad placeholder errors on consts/statics with trait objects

Fixes #75889
r? ``@estebank``

3 years agotidy: Check that cargo and compiletest share the same rustfix.
Eric Huss [Sun, 20 Jun 2021 23:36:26 +0000 (16:36 -0700)]
tidy: Check that cargo and compiletest share the same rustfix.

3 years agocompiletest: display the error if rustfix fails
Eric Huss [Fri, 11 Jun 2021 03:40:52 +0000 (20:40 -0700)]
compiletest: display the error if rustfix fails

3 years agoUpdate rustfix for compiletest.
Eric Huss [Fri, 11 Jun 2021 03:39:05 +0000 (20:39 -0700)]
Update rustfix for compiletest.

3 years agoAuto merge of #85980 - ssomers:btree_cleanup_LeafRange, r=Mark-Simulacrum
bors [Sun, 20 Jun 2021 22:52:49 +0000 (22:52 +0000)]
Auto merge of #85980 - ssomers:btree_cleanup_LeafRange, r=Mark-Simulacrum

BTree: encapsulate LeafRange better & some debug asserts

Looking at iterators again, I think #81937 didn't house enough code in `LeafRange`. Moving the API boundary a little makes things more local in navigate.rs and less complicated in map.rs.

r? `@Mark-Simulacrum`

3 years agoFix CI to fetch master on beta channel
Mark Rousskov [Sat, 19 Jun 2021 14:08:13 +0000 (10:08 -0400)]
Fix CI to fetch master on beta channel

3 years agoImprove documentation
r00ster91 [Sun, 20 Jun 2021 20:19:47 +0000 (22:19 +0200)]
Improve  documentation

3 years agoAuto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum
bors [Sun, 20 Jun 2021 20:07:13 +0000 (20:07 +0000)]
Auto merge of #85538 - r00ster91:iterrepeat, r=Mark-Simulacrum

Replace some `std::iter::repeat` with `str::repeat`

I noticed that there were some instances where `std::iter::repeat` would be used to repeat a string or a char to take a specific count of it and then collect it into a `String` when `str::repeat` is actually much faster and better for that.

See also: https://github.com/rust-lang/rust-clippy/issues/7260.

3 years agoDo not set depth to 0 in fully_expand_fragment
Deadbeef [Sun, 20 Jun 2021 18:05:37 +0000 (02:05 +0800)]
Do not set depth to 0 in fully_expand_fragment

3 years agoSpecify if struct/enum in arg mismatch error
Smitty [Sun, 20 Jun 2021 17:48:37 +0000 (13:48 -0400)]
Specify if struct/enum in arg mismatch error

3 years agoAuto merge of #84967 - CDirkx:os_str_ext, r=m-ou-se
bors [Sun, 20 Jun 2021 16:42:13 +0000 (16:42 +0000)]
Auto merge of #84967 - CDirkx:os_str_ext, r=m-ou-se

Move `OsStringExt` and `OsStrExt` to `std::os`

Moves the `OsStringExt` and `OsStrExt` traits and implementations from `sys_common` to `os`. `sys_common` is for abstractions over `sys` and shouldn't really contain publicly exported items.

This does introduce some duplication: the traits and implementations are now duplicated in `unix`, `wasi`, `hermit`, and `sgx`. However, I would argue that this duplication is no different to how something like `MetadataExt` is duplicated in `linux`, `vxworkx`, `redox`, `solaris` etc. The duplication also matches the fact that the traits on different platforms are technically distinct types: any platform is free to add it's own extra methods to the extension trait.

3 years agocfg_eval: Replace multiple `unwrap`s with a single `unwrap`
Vadim Petrochenkov [Sun, 20 Jun 2021 15:52:10 +0000 (18:52 +0300)]
cfg_eval: Replace multiple `unwrap`s with a single `unwrap`

3 years agoexpand: Move some more derive logic to `rustc_builtin_macros`
Vadim Petrochenkov [Sun, 20 Jun 2021 15:10:02 +0000 (18:10 +0300)]
expand: Move some more derive logic to `rustc_builtin_macros`

3 years agoSquashed implementation of the pass
Alex Vlasov [Sun, 20 Jun 2021 14:09:42 +0000 (16:09 +0200)]
Squashed implementation of the pass

3 years agoAuto merge of #86250 - RalfJung:intrinsic_operation_unsafety, r=oli-obk
bors [Sun, 20 Jun 2021 14:01:26 +0000 (14:01 +0000)]
Auto merge of #86250 - RalfJung:intrinsic_operation_unsafety, r=oli-obk

fix intrinsic_operation_unsafety comment

3 years agoAuto merge of #86486 - RalfJung:miri, r=RalfJung
bors [Sun, 20 Jun 2021 11:20:39 +0000 (11:20 +0000)]
Auto merge of #86486 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agoupdate Miri
Ralf Jung [Sun, 20 Jun 2021 10:58:04 +0000 (12:58 +0200)]
update Miri

3 years agodisable test on platforms that don't support unwinding
The8472 [Sun, 20 Jun 2021 10:20:05 +0000 (12:20 +0200)]
disable test on platforms that don't support unwinding

3 years agoAdd comment to `std::os::unix::ffi::os_str` explaining that the module is reused...
Christiaan Dirkx [Sun, 20 Jun 2021 10:06:19 +0000 (12:06 +0200)]
Add comment to `std::os::unix::ffi::os_str` explaining that the module is reused on other platforms.

3 years agoMake `os_str_bytes::{Buf, Slice}` `pub` and `repr(transparent)`
Christiaan Dirkx [Sun, 20 Jun 2021 09:55:26 +0000 (11:55 +0200)]
Make `os_str_bytes::{Buf, Slice}` `pub` and `repr(transparent)`