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

3 years agoAdd test for macro disambiguators
LeSeulArtichaut [Mon, 21 Jun 2021 20:42:31 +0000 (22:42 +0200)]
Add test for macro disambiguators

3 years agoEdition 2021 enables disjoint capture
Aman Arora [Mon, 21 Jun 2021 06:48:18 +0000 (02:48 -0400)]
Edition 2021 enables disjoint capture

3 years agoAccept `!{}` and `![]` as macro disambiguators
LeSeulArtichaut [Mon, 21 Jun 2021 20:41:27 +0000 (22:41 +0200)]
Accept `!{}` and `![]` as macro disambiguators

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 check to ensure that the line numbers are aligned with the source code
Guillaume Gomez [Tue, 22 Jun 2021 09:17:53 +0000 (11:17 +0200)]
Add check to ensure that the line numbers are aligned with the source code

3 years agoUpdate browser-ui-test version
Guillaume Gomez [Tue, 22 Jun 2021 09:11:45 +0000 (11:11 +0200)]
Update browser-ui-test version

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 agoChange Debug unimplemented message per request
Aris Merchant [Tue, 22 Jun 2021 07:38:31 +0000 (00:38 -0700)]
Change Debug unimplemented message per request

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