]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoswitch to the latest version of hermit-abi
Stefan Lankes [Fri, 13 Aug 2021 05:45:30 +0000 (07:45 +0200)]
switch to the latest version of hermit-abi

2 years agoDon't put hermit mutexes in a box.
Martin Kröning [Sun, 13 Jun 2021 15:22:02 +0000 (17:22 +0200)]
Don't put hermit mutexes in a box.

Hermit mutexes are movable.

2 years agoDon't put hermit condvars in a box.
Martin Kröning [Sun, 13 Jun 2021 15:22:17 +0000 (17:22 +0200)]
Don't put hermit condvars in a box.

Hermit condvars are movable.

2 years agoDon't put hermit rwlocks in a box.
Martin Kröning [Fri, 18 Jun 2021 11:52:13 +0000 (13:52 +0200)]
Don't put hermit rwlocks in a box.

Hermit rwlocks are movable.

2 years agoAuto merge of #87927 - spastorino:use-def-id-typeckresults, r=oli-obk
bors [Fri, 13 Aug 2021 02:49:45 +0000 (02:49 +0000)]
Auto merge of #87927 - spastorino:use-def-id-typeckresults, r=oli-obk

Make concrete_opaque_types be FxHashSet<DefId>

r? `@oli-obk`

`@bors` rollup=always

2 years agoAuto merge of #87980 - Manishearth:rollup-vkuix3y, r=Manishearth
bors [Thu, 12 Aug 2021 23:48:16 +0000 (23:48 +0000)]
Auto merge of #87980 - Manishearth:rollup-vkuix3y, r=Manishearth

Rollup of 4 pull requests

Successful merges:

 - #87916 (Implement `black_box` using intrinsic)
 - #87922 (Add c_enum_min_bits target spec field, use for arm-none and thumb-none targets)
 - #87953 (Improve formatting of closure capture migration suggestion for multi-line closures.)
 - #87965 (Silence non_fmt_panic from external macros.)

Failed merges:

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

2 years agoAuto merge of #87916 - nbdd0121:black_box, r=nagisa
bors [Thu, 12 Aug 2021 21:04:07 +0000 (21:04 +0000)]
Auto merge of #87916 - nbdd0121:black_box, r=nagisa

Implement `black_box` using intrinsic

Introduce `black_box` intrinsic, as suggested in https://github.com/rust-lang/rust/pull/87590#discussion_r680468700.

This is still codegenned as empty inline assembly for LLVM. For MIR interpretation and cranelift it's treated as identity.

cc `@Amanieu` as this is related to inline assembly
cc `@bjorn3` for rustc_codegen_cranelift changes
cc `@RalfJung` as this affects MIRI

r? `@nagisa` I suppose

2 years agoRollup merge of #87965 - m-ou-se:non-fmt-panic-external, r=estebank
Manish Goregaokar [Thu, 12 Aug 2021 17:04:16 +0000 (10:04 -0700)]
Rollup merge of #87965 - m-ou-se:non-fmt-panic-external, r=estebank

Silence non_fmt_panic from external macros.

This stops the non_fmt_panic lint from triggering if a macro from another crate is entirely responsible. In those cases there's nothing that the current crate can/should do.

See also https://github.com/rust-lang/rust/issues/87621#issuecomment-890311054

2 years agoRollup merge of #87953 - m-ou-se:closure-migration-multiline-formatting, r=petrochenkov
Manish Goregaokar [Thu, 12 Aug 2021 17:04:15 +0000 (10:04 -0700)]
Rollup merge of #87953 - m-ou-se:closure-migration-multiline-formatting, r=petrochenkov

Improve formatting of closure capture migration suggestion for multi-line closures.

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

Before:
```
help: add a dummy let to cause `a` to be fully captured
  |
5 ~     let _ = || { let _ = &a;
6 +         dbg!(a.0);
7 ~     };
  |
```

After:
```
help: add a dummy let to cause `a` to be fully captured
  |
5 ~     let _ = || {
6 +         let _ = &a;
7 +         dbg!(a.0);
8 ~     };
  |
```

2 years agoRollup merge of #87922 - Manishearth:c-enum-target-spec, r=nagisa,eddyb
Manish Goregaokar [Thu, 12 Aug 2021 17:04:14 +0000 (10:04 -0700)]
Rollup merge of #87922 - Manishearth:c-enum-target-spec, r=nagisa,eddyb

Add c_enum_min_bits target spec field, use for arm-none and thumb-none targets

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

<s>Haven't tested this yet, still playing around.</s>

This seems to fix the issue.

2 years agoRollup merge of #87916 - nbdd0121:black_box, r=nagisa
Manish Goregaokar [Thu, 12 Aug 2021 17:04:07 +0000 (10:04 -0700)]
Rollup merge of #87916 - nbdd0121:black_box, r=nagisa

Implement `black_box` using intrinsic

Introduce `black_box` intrinsic, as suggested in https://github.com/rust-lang/rust/pull/87590#discussion_r680468700.

This is still codegenned as empty inline assembly for LLVM. For MIR interpretation and cranelift it's treated as identity.

cc `@Amanieu` as this is related to inline assembly
cc `@bjorn3` for rustc_codegen_cranelift changes
cc `@RalfJung` as this affects MIRI

r? `@nagisa` I suppose

2 years agoApply c_enum_min_bits = 8 to (arm|thumb)-none- platforms
Manish Goregaokar [Tue, 10 Aug 2021 19:06:59 +0000 (12:06 -0700)]
Apply c_enum_min_bits = 8 to (arm|thumb)-none- platforms

2 years agoAdd c_enum_min_bits to target spec
Manish Goregaokar [Tue, 10 Aug 2021 18:34:13 +0000 (18:34 +0000)]
Add c_enum_min_bits to target spec

2 years agoImplement `black_box` using intrinsic
Gary Guo [Tue, 10 Aug 2021 10:50:33 +0000 (11:50 +0100)]
Implement `black_box` using intrinsic

The new implementation allows some `memcpy`s to be optimized away,
so the uninit value in ui/sanitize/memory.rs is constructed directly
onto the return place. Therefore the sanitizer now says that the
value is allocated by `main` rather than `random`.

2 years agoAuto merge of #87963 - GuillaumeGomez:rollup-e54sbez, r=GuillaumeGomez
bors [Thu, 12 Aug 2021 13:24:29 +0000 (13:24 +0000)]
Auto merge of #87963 - GuillaumeGomez:rollup-e54sbez, r=GuillaumeGomez

Rollup of 4 pull requests

Successful merges:

 - #87819 (Use a more accurate span on assoc types WF checks)
 - #87863 (Fix Windows Command::env("PATH"))
 - #87885 (Link to edition guide instead of issues for 2021 lints.)
 - #87941 (Fix/improve rustdoc-js tool)

Failed merges:

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

2 years agoSilence non_fmt_panic from external macros.
Mara Bos [Thu, 12 Aug 2021 12:33:30 +0000 (14:33 +0200)]
Silence non_fmt_panic from external macros.

2 years agoRollup merge of #87941 - GuillaumeGomez:fix-rustdoc-js-tool, r=notriddle
Guillaume Gomez [Thu, 12 Aug 2021 11:25:08 +0000 (13:25 +0200)]
Rollup merge of #87941 - GuillaumeGomez:fix-rustdoc-js-tool, r=notriddle

Fix/improve rustdoc-js tool

This tool is run when testing `src/test/rustdoc-js*`.

r? `@notriddle`

2 years agoRollup merge of #87885 - m-ou-se:edition-guide-links, r=rylev
Guillaume Gomez [Thu, 12 Aug 2021 11:25:07 +0000 (13:25 +0200)]
Rollup merge of #87885 - m-ou-se:edition-guide-links, r=rylev

Link to edition guide instead of issues for 2021 lints.

This changes the 2021 lints to not link to github issues, but to the edition guide instead.

Fixes  #86996

2 years agoRollup merge of #87863 - ChrisDenton:command-env-path-fix, r=dtolnay
Guillaume Gomez [Thu, 12 Aug 2021 11:25:06 +0000 (13:25 +0200)]
Rollup merge of #87863 - ChrisDenton:command-env-path-fix, r=dtolnay

Fix Windows Command::env("PATH")

Fixes #87859

2 years agoRollup merge of #87819 - estebank:assoc-type-span, r=jackh726
Guillaume Gomez [Thu, 12 Aug 2021 11:25:05 +0000 (13:25 +0200)]
Rollup merge of #87819 - estebank:assoc-type-span, r=jackh726

Use a more accurate span on assoc types WF checks

Before
```
error[E0275]: overflow evaluating the requirement `<FooStruct as Foo>::A == _`
  --> $DIR/issue-21946.rs:8:5
   |
LL |     type A = <FooStruct as Foo>::A;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```
after
```
error[E0275]: overflow evaluating the requirement `<FooStruct as Foo>::A == _`
  --> $DIR/issue-21946.rs:8:14
   |
LL |     type A = <FooStruct as Foo>::A;
   |              ^^^^^^^^^^^^^^^^^^^^^
```

2 years agoAuto merge of #87666 - ivmarkov:master, r=Amanieu
bors [Thu, 12 Aug 2021 10:33:14 +0000 (10:33 +0000)]
Auto merge of #87666 - ivmarkov:master, r=Amanieu

STD support for the ESP-IDF framework

Dear all,

This PR is implementing libStd support for the [ESP-IDF](https://github.com/espressif/esp-idf) newlib-based framework, which is the open source SDK provided by Espressif for their MCU family (esp32, esp32s2, esp32c3 and all other forthcoming ones).

Note that this PR has a [sibling PR](https://github.com/rust-lang/libc/pull/2310) against the libc crate, which implements proper declarations for all ESP-IDF APIs which are necessary for libStd support.

# Implementation approach

The ESP-IDF framework - despite being bare metal - offers a relatively complete POSIX API based on newlib. `pthread`, BSD sockets, file descriptors, and even a small file-system VFS layer. Perhaps the only significant exception is the lack of support for processes, which is to be expected of course on bare metal.

Therefore, the libStd support is implemented as a set of (hopefully small) changes to the `sys/unix` family of modules, in the form of conditional-compilation branches based either on `target_os = "espidf"` or in a couple of cases - based on `target_env = "newlib"` (the latter was already there actually and is not part of this patch).

The PR also contains two new targets:
- `riscv32imc-esp-espidf`
- `riscv32imac-esp-espidf`

... which are essentially copies of `riscv32imc-unknown-none-elf` and `riscv32imac-unknown-none-elf`, but enriched with proper `linker`, `linker_flavor`, `families`, `os`, `env` etc. specifications so that (a) the proper conditional compilation branches in libStd are selected when compiling with these targets and (b) the correct linker is used.

Since support for atomics is a precondition for libStd, the `riscv32imc-esp-espidf` target additionally is configured in such a way, so as to emit libcalls to the `__sync*` & `__atomic*` GCC functions, which are already implemented in the ESP-IDF framework. If this modification is not acceptable, we can also live with only the `riscv32imac-esp-espidf` target as well.  While the RiscV chips of Espressif lack native atomics support, the relevant instructions are transparently emulated in the ESP-IDF framework using invalid instruction trap. This modification was implemented specifically with Rust support in mind.

# Target maintainers

In case this PR eventually gets merged, you can list myself as a Target Maintainer.

More importantly, Espressif (the chip vendor) is now actively involved and [embracing](https://github.com/espressif/rust-esp32-example/blob/main/docs/rust-on-xtensa.md) all [Rust-related efforts](https://github.com/esp-rs) which were originally a community effort. In light of that, I suppose `@MabezDev` - who initiated the Rust-on-Espressif efforts back in time and who now works for Espressif won't object to being listed as a maintainer as well.

**EDIT:** I was hinted (thanks, `@Urgau)` that answering the Tier 3 policy explicitly might be helpful. Answers below.

# Tier 3 Target Policy - answers

> A proposed target or target-specific patch that substantially changes code shared with other targets (not just target-specific code) must be reviewed and approved by the appropriate team for that shared code before acceptance.

Hopefully, the changes introduced by the ESP-IDF libStd support are rather on the small side. They are completely contained within the `sys/unix` set of modules (that is, aside from the obviously necessary one-liners in the `unwind` crate and in `build.rs`).

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

`@ivmarkov`
`@MabezDev`

> Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

The two introduced targets follow as much as possible the naming conventions of the other targets. I.e. taking the bare-metal `riscv32imac_unknown_none_elf` as a base:
* The name of the new target was derived by replacing `none` with `espidf` to designate the `target_os`.
* `_elf` was removed, as the non-bare metal targets seem not to have it
* `-newlib` was deliberately NOT added at the end, as I believe the chance of having two simultaneously active separate targets for the ESP-IDF framework with different C libraries (say, newlib vs musl) is way too small
* Finally, we replaced the middle `unknown` with `esp` which is kind of the name of the whole chipset MCU family (and abbreviation from Espressif which is too long). It will stay `esp` for all RiscV32-based MCUs of the company, as they all use the riscv32imc instruction set. By necessity however (disambiguation), it will be `esp32` or `esp32s2` or `esp32s3` for the Xtensa-based MCUs as all of these have their own variation of the Xtensa architecture. (The Xtensa targets are not part of this PR, even though they would use 1:1 the same LibStd implementation provided here, as they depend on the upstreaming of the Xtensa architecture support in LLVM; this upstreaming this is currently in progress.)

There was also a preceding discussion on the topic [here](https://github.com/espressif/rust-esp32-example/issues/14).

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

We are explicitly putting an `-espidf` suffix to designate that the target is *specifically* for Rust + ESP-IDF

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

Agreed.

> The target must not introduce license incompatibilities.

To the best of our knowledge, it doesn't.

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

MIT + Apache 2.0

> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

Requirements are not changed for any other target.

> If the target supports building host tools (such as rustc or cargo), those host tools must not depend on proprietary (non-FOSS) libraries, other than ordinary runtime libraries supplied by the platform and commonly used by other binaries built for the target. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.

The targets are for bare-metal environment which is not hosting build tools or a compiler.

> Targets should not require proprietary (non-FOSS) components to link a functional binary or library.

The linker used by the targets is the GCC linker from the GCC toolchain cross-compiled for riscv. GNU GPL.

> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.
> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.
> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

Agreed.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

The targets implement libStd almost in its entirety, except for the missing support for process, as this is a bare metal platform. The process `sys\unix` module is currently stubbed to return "not implemented" errors.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running tests (even if they do not pass), the documentation must explain how to run tests for the target, using emulation if possible or dedicated hardware if necessary.

Target does not (yet) support running tests. We would gladly provide all documentation how to build for the target (where?). It is currently hosted in this [README.md](https://github.com/ivmarkov/rust-esp32-std-hello) file, but will likely be moved to the [esp-rs](https://github.com/esp-rs) organization. Since the build for the target is driven by cargo and [all other tooling is downloaded automatically during the build](https://github.com/esp-rs/esp-idf-sys/blob/master/build.rs), there is no need for extensive documentation.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

Agreed.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

Agreed.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

To the best of our knowledge, we believe we are not breaking any other target (be it tier 1, 2 or 3).

> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

To the best of our knowledge, we have not introduced any unconditional use of a feature that affects any other target.

> If a tier 3 target stops meeting these requirements, or the target maintainers no longer have interest or time, or the target shows no signs of activity and has not built for some time, or removing the target would improve the quality of the Rust codebase, we may post a PR to remove it; any such PR will be CCed to the target maintainers (and potentially other people who have previously worked on the target), to check potential interest in improving the situation.

Agreed.

2 years agoUse a more accurate span on assoc types WF checks
Esteban Kuber [Fri, 6 Aug 2021 15:46:20 +0000 (15:46 +0000)]
Use a more accurate span on assoc types WF checks

2 years agoUpdate test output.
Mara Bos [Thu, 12 Aug 2021 09:23:48 +0000 (11:23 +0200)]
Update test output.

2 years agoImprove formatting of closure capture migration suggestion.
Mara Bos [Thu, 12 Aug 2021 09:23:18 +0000 (11:23 +0200)]
Improve formatting of closure capture migration suggestion.

2 years agoBless clippy tests.
Mara Bos [Thu, 12 Aug 2021 08:48:16 +0000 (10:48 +0200)]
Bless clippy tests.

2 years agoAuto merge of #87948 - JohnTitor:rollup-efmgyl8, r=JohnTitor
bors [Thu, 12 Aug 2021 07:28:15 +0000 (07:28 +0000)]
Auto merge of #87948 - JohnTitor:rollup-efmgyl8, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #85835 (Implement Extend<(A, B)> for (Extend<A>, Extend<B>))
 - #87671 (Warn when an escaped newline skips multiple lines)
 - #87878 (:arrow_up: rust-analyzer)
 - #87903 (Reduce verbosity of tracing output of  RUSTC_LOG)
 - #87925 (Update books)
 - #87928 (Update cargo)
 - #87942 (set the executable bit on pre-commit.sh)

Failed merges:

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

2 years agoRollup merge of #87942 - oconnor663:pre_commit_exec, r=jyn514
Yuki Okushi [Thu, 12 Aug 2021 06:32:59 +0000 (15:32 +0900)]
Rollup merge of #87942 - oconnor663:pre_commit_exec, r=jyn514

set the executable bit on pre-commit.sh

`x.py setup` hardlinks this file into .git/hooks. Prior to this commit,
that led to the following warning emitted by `git commit`:

    hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable.

Making the checked-in script executable fixes this issue, as the
hardlinked copy uses the same flags.

It looks like the file was originally executable, but that bit was
unset in commit b908905b3defa075d08661dc5916219a870b4856 of
https://github.com/rust-lang/rust/pull/85305. It's possible that was
unintentional.

2 years agoRollup merge of #87928 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Thu, 12 Aug 2021 06:32:58 +0000 (15:32 +0900)]
Rollup merge of #87928 - ehuss:update-cargo, r=ehuss

Update cargo

9 commits in cc17afbb0067b1f57d8882640f63b2168d5b7624..b51439fd8b505d4800a257acfecf3c69f81e35cf
2021-08-02 20:28:08 +0000 to 2021-08-09 18:40:05 +0000
- Deduplicate entries in cargo --list (rust-lang/cargo#9773)
- Include aliases with other commands (rust-lang/cargo#9764)
- Add a profile option to select the codegen backend (rust-lang/cargo#9118)
- remove useless conversions (rust-lang/cargo#9617)
- collapse nested if blocks (rust-lang/cargo#9613)
- Refactor fake_file() away from cargo_command tests (rust-lang/cargo#9767)
- Update cargo-platform to 0.1.2 (rust-lang/cargo#9762)
- Bump to the latest jobserver dependency (rust-lang/cargo#9760)
- Fix semver check for rust 1.54.0 (rust-lang/cargo#9763)

2 years agoRollup merge of #87925 - ehuss:update-books, r=ehuss
Yuki Okushi [Thu, 12 Aug 2021 06:32:57 +0000 (15:32 +0900)]
Rollup merge of #87925 - ehuss:update-books, r=ehuss

Update books

## nomicon

2 commits in f51734eb5566c826b471977747ea3d7d6915bbe9..0c7e5bd1428e7838252bb57b7f0fbfda4ec82f02
2021-07-23 18:24:35 +0900 to 2021-08-04 10:18:22 -0700
- Document lifetime elision for fn types, Fn*, impl (rust-lang/nomicon#298)
- Remove unnecessary `extern crate`s (rust-lang/nomicon#297)

## reference

3 commits in 3b7be075af5d6e402a18efff672a8a265b4596fd..4884fe45c14f8b22121760fb117181bb4da8dfe0
2021-07-26 13:20:11 -0700 to 2021-07-28 21:31:28 -0700
- Mention "function item type to `fn pointer`" coercion (rust-lang/reference#1079)
- example for bindings after at (rust-lang/reference#1027)
- array-expr.md: fix typo; 'polish' sentence (rust-lang/reference#1080)

## book

10 commits in a07036f864b37896b31eb996cd7aedb489f69a1f..7e49659102f0977d9142190e1ba23345c0f00eb1
2021-07-26 20:19:46 -0400 to 2021-08-03 21:41:35 -0400
- Make explicit that enum variant construction is a function
- Clarify why None means we have to annotate the type
- Make the convert quotes script able to do one chapter
- Snapshot of chapter 5
-  (rust-lang/book#2811)
-  (rust-lang/book#2809)
- Ugh quote script, that's not right
- Introduce the dbg macro. Connects to rust-lang/book#1658
- Add an example of declaring and instantiating unit-like structs. Fixes rust-lang/book#2442.
- Remove authors field from all the manifests (rust-lang/book#2805)

## rustc-dev-guide

5 commits in 09343d6f921d2a07c66f8c41ec3d65bf1fa52556..c4644b427cbdaafc7a87be0ccdf5d8aaa07ac35f
2021-07-26 00:37:28 +0200 to 2021-08-10 20:41:44 +0900
- Remove a dead link in `new-target.md` + other nits (rust-lang/rustc-dev-guide#1186)
- Add description of -opt-bisect-limit LLVM option (rust-lang/rustc-dev-guide#1182)
- Fixed team responsible for stabilization (rust-lang/rustc-dev-guide#1181)
- Add S-Inactive PRs as another source of things contributors could work on (rust-lang/rustc-dev-guide#1177)
- git.md: Fix No-Merge Policy link

## embedded-book

1 commits in 09986cd352404eb4659db44613b27cac9aa652fc..4f9fcaa30d11ba52b641e6fd5206536d65838af9
2021-07-18 19:26:46 +0000 to 2021-08-06 17:43:12 +0000
- Fix typo in 'Memory Mapped Registers'  (rust-embedded/book#298)

2 years agoRollup merge of #87903 - jackh726:logging-cleanup, r=oli-obk
Yuki Okushi [Thu, 12 Aug 2021 06:32:56 +0000 (15:32 +0900)]
Rollup merge of #87903 - jackh726:logging-cleanup, r=oli-obk

Reduce verbosity of tracing output of  RUSTC_LOG

The current output is really hard to read, I find, for things like trait selection. I nearly always end up removing these calls locally.

r? ```@oli-obk``` since you originally authored this

2 years agoRollup merge of #87878 - lnicola:rust-analyzer-2021-08-09, r=lnicola
Yuki Okushi [Thu, 12 Aug 2021 06:32:55 +0000 (15:32 +0900)]
Rollup merge of #87878 - lnicola:rust-analyzer-2021-08-09, r=lnicola

:arrow_up: rust-analyzer

2 years agoRollup merge of #87671 - jesyspa:issue-87319-multiple-newlines, r=estebank
Yuki Okushi [Thu, 12 Aug 2021 06:32:54 +0000 (15:32 +0900)]
Rollup merge of #87671 - jesyspa:issue-87319-multiple-newlines, r=estebank

Warn when an escaped newline skips multiple lines

Resolves #87319

2 years agoRollup merge of #85835 - Seppel3210:master, r=yaahc
Yuki Okushi [Thu, 12 Aug 2021 06:32:53 +0000 (15:32 +0900)]
Rollup merge of #85835 - Seppel3210:master, r=yaahc

Implement Extend<(A, B)> for (Extend<A>, Extend<B>)

I oriented myself at the implementation of `Iterator::unzip` and also rewrote the impl in terms of `(A, B)::extend` after that.

Since (A, B) now also implements Extend we could also mention in the documentation of unzip that it can do "nested unzipping" (you could unzip `Iterator<Item=(A, (B, C))>` into `(Vec<A>, (Vec<B>, Vec<C>))` for example) but I'm not sure of that so I'm asking here 🙂

(P.S. I saw a couple of people asking if there is an unzip3 but there isn't. So this could be a way to get equivalent functionality)

2 years agoAuto merge of #85296 - bjorn3:plugin_cleanup, r=petrochenkov
bors [Thu, 12 Aug 2021 04:30:41 +0000 (04:30 +0000)]
Auto merge of #85296 - bjorn3:plugin_cleanup, r=petrochenkov

Plugin interface cleanup

The first commit performs two uncontroversial cleanups. The second commit removes `#[plugin_registrar]` and instead requires you to export a `__rustc_plugin_registrar` function, this will require a change to servo's script_plugins (cc `@jdm)`

2 years agoAuto merge of #87843 - kornelski:try_reserve, r=m-ou-se
bors [Thu, 12 Aug 2021 01:16:22 +0000 (01:16 +0000)]
Auto merge of #87843 - kornelski:try_reserve, r=m-ou-se

TryReserveErrorKind tests and inline

A small follow-up to #87408

2 years agoAuto merge of #86532 - estebank:delete-suggestion-underline, r=petrochenkov
bors [Wed, 11 Aug 2021 19:26:01 +0000 (19:26 +0000)]
Auto merge of #86532 - estebank:delete-suggestion-underline, r=petrochenkov

Make deleted code in a suggestion clearer

Show suggestions that include deletions in a way similar to `diff`'s output.

<img width="628" alt="" src="https://user-images.githubusercontent.com/1606434/123350316-9078e580-d50f-11eb-89b9-78431b85e23f.png">

For changes that do not have deletions, use `+` as an underline for additions and `~` as an underline for replacements.

<img width="631" alt="" src="https://user-images.githubusercontent.com/1606434/123701745-1ac68f80-d817-11eb-950b-09e5afd7532f.png">

For multiline suggestions, we now use `~` in the gutter to signal replacements and `+` to signal whole line replacements/additions.

<img width="834" alt="" src="https://user-images.githubusercontent.com/1606434/123701331-8eb46800-d816-11eb-9dcd-ef9098071afb.png">

In all cases we now use color to highlight the specific spans and snippets.

2 years agoset the executable bit on pre-commit.sh
Jack O'Connor [Wed, 11 Aug 2021 18:57:35 +0000 (14:57 -0400)]
set the executable bit on pre-commit.sh

`x.py setup` hardlinks this file into .git/hooks. Prior to this commit,
that led to the following warning emitted by `git commit`:

    hint: The '.git/hooks/pre-commit' hook was ignored because it's not set as executable.

Making the checked-in script executable fixes this issue, as the
hardlinked copy uses the same flags.

It looks like the file was originally executable, but that bit was
unset in commit b908905b3defa075d08661dc5916219a870b4856 of
https://github.com/rust-lang/rust/pull/85305. It's possible that was
unintentional.

2 years agoFix rustdoc-js tool string "parsing"
Guillaume Gomez [Wed, 11 Aug 2021 18:14:26 +0000 (20:14 +0200)]
Fix rustdoc-js tool string "parsing"
Improve tool: add support for multiline comments

2 years agoupdate clippy
Esteban Kuber [Wed, 11 Aug 2021 14:21:33 +0000 (14:21 +0000)]
update clippy

2 years agoMake concrete_opaque_types be FxHashSet<DefId>
Santiago Pastorino [Mon, 9 Aug 2021 23:34:09 +0000 (20:34 -0300)]
Make concrete_opaque_types be FxHashSet<DefId>

2 years agoRenamed variable str -> tail for clarity
Anton Golov [Wed, 11 Aug 2021 11:57:28 +0000 (13:57 +0200)]
Renamed variable str -> tail for clarity

2 years agoAuto merge of #87892 - rust-lang:spec-fill-size-one-bye, r=the8472
bors [Wed, 11 Aug 2021 11:40:20 +0000 (11:40 +0000)]
Auto merge of #87892 - rust-lang:spec-fill-size-one-bye, r=the8472

Remove size_of == 1 case from `fill` specialization.

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

See [discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/potential.20UB.20in.20slice.3A.3Afill/near/248875743).

2 years agoAdd UI tests for string escape warnings.
Anton Golov [Wed, 11 Aug 2021 10:13:24 +0000 (12:13 +0200)]
Add UI tests for string escape warnings.

2 years agoModify structured suggestion output
Esteban Küber [Tue, 22 Jun 2021 02:07:19 +0000 (19:07 -0700)]
Modify structured suggestion output

* On suggestions that include deletions, use a diff inspired output format
* When suggesting addition, use `+` as underline
* Color highlight modified span

2 years agoUpdate format string tests to explicitly escape multiple newlines
Anton Golov [Sat, 31 Jul 2021 21:09:19 +0000 (23:09 +0200)]
Update format string tests to explicitly escape multiple newlines

From what I can tell, the goal of the tests is to ensure that the error
formatting is correct.  I think this is still being tested as intended
after this change.

2 years agoWarn when an escaped newline skips multiple lines
Anton Golov [Sat, 31 Jul 2021 18:35:37 +0000 (20:35 +0200)]
Warn when an escaped newline skips multiple lines

2 years agoAuto merge of #87587 - oli-obk:lazy_tait, r=spastorino
bors [Wed, 11 Aug 2021 05:14:45 +0000 (05:14 +0000)]
Auto merge of #87587 - oli-obk:lazy_tait, r=spastorino

Various refactorings of the TAIT infrastructure

Before this PR we used to store the opaque type knowledge outside the `InferCtxt`, so it got recomputed on every opaque type instantiation.

I also removed a feature gate check that makes no sense in the planned lazy TAIT resolution scheme

Each commit passes all tests, so this PR is best reviewed commit by commit.

r? `@spastorino`

2 years agoAuto merge of #87254 - rusticstuff:rustc_codegen_llvm_dont_emit_zero_sized_padding...
bors [Wed, 11 Aug 2021 01:36:23 +0000 (01:36 +0000)]
Auto merge of #87254 - rusticstuff:rustc_codegen_llvm_dont_emit_zero_sized_padding, r=eddyb

LLVM codegen: Don't emit zero-sized padding for fields

Currently padding is emitted before fields of a struct and at the end of the struct regardless of the ABI. Even if no padding is required zero-sized padding fields are emitted. This is not useful and - more importantly - it make it impossible to generate the exact vector types that LLVM expects for certain ARM SIMD intrinsics. This change should unblock the implementation of many ARM intrinsics using the `unadjusted` ABI, see https://github.com/rust-lang/stdarch/issues/1143#issuecomment-827404092.

This is a proof of concept only because the field lookup now takes O(number of fields) time compared to O(1) before since it recalculates the mapping at every lookup. I would like to find out how big the performance impact actually is before implementing caching or restricting this behavior to the `unadjusted` ABI.

cc `@SparrowLii` `@bjorn3`

([Discussion on internals](https://internals.rust-lang.org/t/feature-request-add-a-way-in-rustc-for-generating-struct-type-llvm-ir-without-paddings/15007))

2 years agoAuto merge of #87923 - JohnTitor:rollup-id54fyz, r=JohnTitor
bors [Tue, 10 Aug 2021 22:37:57 +0000 (22:37 +0000)]
Auto merge of #87923 - JohnTitor:rollup-id54fyz, r=JohnTitor

Rollup of 14 pull requests

Successful merges:

 - #86840 (Constify implementations of `(Try)From` for int types)
 - #87582 (Implement `Printer` for `&mut SymbolPrinter`)
 - #87636 (Added the `Option::unzip()` method)
 - #87700 (Expand explanation of E0530)
 - #87811 (Do not ICE on HIR based WF check when involving lifetimes)
 - #87848 (removed references to parent/child from std::thread documentation)
 - #87854 (correctly handle enum variants in `opt_const_param_of`)
 - #87861 (Fix heading colours in Ayu theme)
 - #87865 (Clarify terms in rustdoc book)
 - #87876 (add `windows` count test)
 - #87880 (Remove duplicate trait bounds in `rustc_data_structures::graph`)
 - #87881 (Proper table row formatting in platform support)
 - #87889 (Use smaller spans when suggesting method call disambiguation)
 - #87895 (typeck: don't suggest inaccessible fields in struct literals and suggest ignoring inaccessible fields in struct patterns)

Failed merges:

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

2 years agoUpdate cargo
Eric Huss [Tue, 10 Aug 2021 20:40:56 +0000 (13:40 -0700)]
Update cargo

2 years agoUpdate books
Eric Huss [Tue, 10 Aug 2021 19:38:00 +0000 (12:38 -0700)]
Update books

2 years agoRollup merge of #87895 - TheWastl:issue-87872, r=estebank
Yuki Okushi [Tue, 10 Aug 2021 19:18:47 +0000 (04:18 +0900)]
Rollup merge of #87895 - TheWastl:issue-87872, r=estebank

typeck: don't suggest inaccessible fields in struct literals and suggest ignoring inaccessible fields in struct patterns

Fixes #87872.

This PR adjusts the missing field diagnostic logic in typeck so that when any of the missing fields in a struct literal or pattern is inaccessible then the error is less confusing, even if some of the missing fields are accessible.

See also #76524.

2 years agoRollup merge of #87889 - estebank:method-call-disambiguate, r=oli-obk
Yuki Okushi [Tue, 10 Aug 2021 19:18:46 +0000 (04:18 +0900)]
Rollup merge of #87889 - estebank:method-call-disambiguate, r=oli-obk

Use smaller spans when suggesting method call disambiguation

Use smaller spans when suggesting method call disambiguation.

2 years agoRollup merge of #87881 - badboy:platform-support-formatting, r=ehuss
Yuki Okushi [Tue, 10 Aug 2021 19:18:45 +0000 (04:18 +0900)]
Rollup merge of #87881 - badboy:platform-support-formatting, r=ehuss

Proper table row formatting in platform support

Also moves the target into alphabetical order

2 years agoRollup merge of #87880 - pierwill:graph-duplicate-trait-bound, r=LeSeulArtichaut
Yuki Okushi [Tue, 10 Aug 2021 19:18:44 +0000 (04:18 +0900)]
Rollup merge of #87880 - pierwill:graph-duplicate-trait-bound, r=LeSeulArtichaut

Remove duplicate trait bounds in `rustc_data_structures::graph`

Remove duplicate trait bounds in `rustc_data_structures::graph`.

2 years agoRollup merge of #87876 - lcnr:windows_no_panic, r=m-ou-se
Yuki Okushi [Tue, 10 Aug 2021 19:18:43 +0000 (04:18 +0900)]
Rollup merge of #87876 - lcnr:windows_no_panic, r=m-ou-se

add `windows` count test

cc #87767

2 years agoRollup merge of #87865 - tsoutsman:master, r=GuillaumeGomez
Yuki Okushi [Tue, 10 Aug 2021 19:18:41 +0000 (04:18 +0900)]
Rollup merge of #87865 - tsoutsman:master, r=GuillaumeGomez

Clarify terms in rustdoc book

Fixes #70898

I chose to completely remove the term directive over attribute because rustdoc has a lint called `invalid_codeblock_attributes` and the term attributes is used throughout the book. I slightly changed the introductory sentence to describe the relationship between annotations and attributes.

I also moved the text explaining the example from below the blocks to above the blocks which is more in line with the rest of the book. I also changed the description for the `should_panic` attribute as I found it a little confusing. Finally, some of the blocks were `text` and some were `rust` so I changed them all to `text` which is in line with the rest of the book.

2 years agoRollup merge of #87861 - tsoutsman:patch-1, r=GuillaumeGomez
Yuki Okushi [Tue, 10 Aug 2021 19:18:40 +0000 (04:18 +0900)]
Rollup merge of #87861 - tsoutsman:patch-1, r=GuillaumeGomez

Fix heading colours in Ayu theme

Closes #87828
The issue seems to stem from #87210 where code headings were changed from a heading containing a `code` element to a heading with the `code-header` class. `rustdoc.css` was updated, but `ayu.css` was missed.

2 years agoRollup merge of #87854 - BoxyUwU:var-None, r=oli-obk
Yuki Okushi [Tue, 10 Aug 2021 19:18:39 +0000 (04:18 +0900)]
Rollup merge of #87854 - BoxyUwU:var-None, r=oli-obk

correctly handle enum variants in `opt_const_param_of`

Fixes #87542

`opt_const_param_of` was returning `None` for args on an enum variant `Enum::Variant::<10>` because we called `generics_of` on the enum variant which has no generics.

r? `@oli-obk`

2 years agoRollup merge of #87848 - godmar:@godmar/thread-join-documentation-fix, r=joshtriplett
Yuki Okushi [Tue, 10 Aug 2021 19:18:38 +0000 (04:18 +0900)]
Rollup merge of #87848 - godmar:@godmar/thread-join-documentation-fix, r=joshtriplett

removed references to parent/child from std::thread documentation

- also clarifies how thread.join and detaching of threads works
- the previous prose implied that there is a relationship between a
spawning thread and the thread being spawned, and that "child" threads
couldn't outlive their "parents" unless detached, which is incorrect.

2 years agoRollup merge of #87811 - estebank:issue-87549, r=oli-obk
Yuki Okushi [Tue, 10 Aug 2021 19:18:37 +0000 (04:18 +0900)]
Rollup merge of #87811 - estebank:issue-87549, r=oli-obk

Do not ICE on HIR based WF check when involving lifetimes

Fix #87549.

2 years agoRollup merge of #87700 - kornelski:e530text, r=oli-obk
Yuki Okushi [Tue, 10 Aug 2021 19:18:36 +0000 (04:18 +0900)]
Rollup merge of #87700 - kornelski:e530text, r=oli-obk

Expand explanation of E0530

The explanation didn't cover a puzzling case of enum variants missing fields.

2 years agoRollup merge of #87636 - Kixiron:unzip-option, r=scottmcm
Yuki Okushi [Tue, 10 Aug 2021 19:18:34 +0000 (04:18 +0900)]
Rollup merge of #87636 - Kixiron:unzip-option, r=scottmcm

Added the `Option::unzip()` method

* Adds the `Option::unzip()` method to turn an `Option<(T, U)>` into `(Option<T>, Option<U>)` under the `unzip_option` feature
* Adds tests for both `Option::unzip()` and `Option::zip()`, I noticed that `.zip()` didn't have any
* Adds `#[inline]` to a few of `Option`'s methods that were missing it

2 years agoRollup merge of #87582 - tmiasko:symbol-printer, r=michaelwoerister
Yuki Okushi [Tue, 10 Aug 2021 19:18:33 +0000 (04:18 +0900)]
Rollup merge of #87582 - tmiasko:symbol-printer, r=michaelwoerister

Implement `Printer` for `&mut SymbolPrinter`

to avoid passing `SymbolPrinter` by value.

2 years agoRollup merge of #86840 - usbalbin:const_from, r=oli-obk
Yuki Okushi [Tue, 10 Aug 2021 19:18:33 +0000 (04:18 +0900)]
Rollup merge of #86840 - usbalbin:const_from, r=oli-obk

Constify implementations of `(Try)From` for int types

I believe this to be one of the (many?) things blocking const (Range) iterators.

~~If this is to be merged maybe that should wait until `#![feature(const_trait_impl)]` no longer needs `#![allow(incomplete_features)]`?~~ - Done

2 years agotypeck: better diagnostics for missing inaccessible fields in struct literals/patterns
TheWastl [Tue, 10 Aug 2021 14:17:45 +0000 (16:17 +0200)]
typeck: better diagnostics for missing inaccessible fields in struct literals/patterns

- typeck/expr: don't suggest adding fields in struct literals with inaccessible fields
- typeck/pat: suggest ignoring inaccessible fields in struct patterns

2 years agoReplace #[plugin_registrar] with exporting __rustc_plugin_registrar
bjorn3 [Fri, 14 May 2021 13:37:53 +0000 (15:37 +0200)]
Replace #[plugin_registrar] with exporting __rustc_plugin_registrar

2 years agoDon't collect into a `Vec` that is immediately being iterated on again.
Oli Scherer [Tue, 10 Aug 2021 11:03:10 +0000 (11:03 +0000)]
Don't collect into a `Vec` that is immediately being iterated on again.

2 years agoSTD support for the ESP-IDF framework
ivmarkov [Thu, 29 Jul 2021 17:18:22 +0000 (20:18 +0300)]
STD support for the ESP-IDF framework

2 years agoReduce verbosity of RUSTC_LOG
jackh726 [Tue, 10 Aug 2021 01:39:39 +0000 (21:39 -0400)]
Reduce verbosity of RUSTC_LOG

2 years agoRemove size_of == 1 case from `fill` specialization.
Mara Bos [Mon, 9 Aug 2021 17:25:28 +0000 (19:25 +0200)]
Remove size_of == 1 case from `fill` specialization.

2 years agoUse smaller spans when suggesting method call disambiguation
Esteban Kuber [Mon, 9 Aug 2021 16:47:09 +0000 (16:47 +0000)]
Use smaller spans when suggesting method call disambiguation

2 years agoLink to edition guide instead of issues for 2021 lints.
Mara Bos [Mon, 9 Aug 2021 15:45:01 +0000 (17:45 +0200)]
Link to edition guide instead of issues for 2021 lints.

2 years agoTest: Use smallvec directly instead of boxed.
Hans Kratz [Mon, 9 Aug 2021 15:42:37 +0000 (15:42 +0000)]
Test: Use smallvec directly instead of boxed.

2 years agoAdded tracking issue to unstable attribute
Chase Wilson [Thu, 5 Aug 2021 17:44:22 +0000 (12:44 -0500)]
Added tracking issue to unstable attribute

2 years agoEnabled unzip_option feature for core tests & unzip docs
Chase Wilson [Sat, 31 Jul 2021 23:16:34 +0000 (18:16 -0500)]
Enabled unzip_option feature for core tests & unzip docs

2 years agoAdded some basic tests for `Option::unzip()` and `Option::zip()` (I noticed that...
Chase Wilson [Fri, 30 Jul 2021 18:13:59 +0000 (13:13 -0500)]
Added some basic tests for `Option::unzip()` and `Option::zip()` (I noticed that zip had no tests)

2 years agoAdded the `Option::unzip()` method
Chase Wilson [Fri, 30 Jul 2021 18:11:25 +0000 (13:11 -0500)]
Added the `Option::unzip()` method

2 years agoProper table row formatting in platform support
Jan-Erik Rediger [Mon, 9 Aug 2021 14:09:11 +0000 (16:09 +0200)]
Proper table row formatting in platform support

Also moves the target into alphabetical order

2 years agoRemove duplicate trait bounds in `rustc_data_structures::graph`
pierwill [Mon, 9 Aug 2021 13:52:04 +0000 (08:52 -0500)]
Remove duplicate trait bounds in `rustc_data_structures::graph`

2 years agoAuto merge of #85357 - Andy-Python-Programmer:aarch64_uefi_target, r=petrochenkov
bors [Mon, 9 Aug 2021 13:16:51 +0000 (13:16 +0000)]
Auto merge of #85357 - Andy-Python-Programmer:aarch64_uefi_target, r=petrochenkov

Add `aarch64-unknown-uefi` target

This pull request adds the `aarch64-unknown-uefi` target.

2 years agoAvoid unnecessary allocation.
Hans Kratz [Mon, 9 Aug 2021 12:59:23 +0000 (12:59 +0000)]
Avoid unnecessary allocation.

2 years agoTEST: Use SmallVec<[u32; 4]> for field projection.
Hans Kratz [Mon, 9 Aug 2021 12:25:33 +0000 (12:25 +0000)]
TEST: Use SmallVec<[u32; 4]> for field projection.

2 years agoFix nits.
Hans Kratz [Mon, 9 Aug 2021 12:08:18 +0000 (12:08 +0000)]
Fix nits.

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 9 Aug 2021 10:48:36 +0000 (13:48 +0300)]
:arrow_up: rust-analyzer

2 years agoadd `windows` count test
lcnr [Mon, 9 Aug 2021 09:08:39 +0000 (11:08 +0200)]
add `windows` count test

2 years agoAuto merge of #87820 - elichai:patch-2, r=kennytm
bors [Mon, 9 Aug 2021 08:19:19 +0000 (08:19 +0000)]
Auto merge of #87820 - elichai:patch-2, r=kennytm

Replace read_to_string with read_line in Stdin example

The current example results in infinitely reading from stdin, which can confuse newcomers trying to read from stdin.
(`@razmag` encountered this while learning the language from the docs)

2 years agoDo not ICE on HIR based WF check when involving lifetimes
Esteban Küber [Fri, 6 Aug 2021 09:36:54 +0000 (02:36 -0700)]
Do not ICE on HIR based WF check when involving lifetimes

Fix #87549.

2 years agoAdd the aarch64-unknown-uefi target
unknown [Sun, 16 May 2021 03:28:16 +0000 (13:28 +1000)]
Add the aarch64-unknown-uefi target

* This commit adds the aarch64-unknown-uefi target and also adds it into
the supported targets list under the tier-3 target table.
* Uses the small code model by default

Signed-off-by: Andy-Python-Programmer <andypythonappdeveloper@gmail.com>
2 years agoAuto merge of #87619 - 12101111:fix-native_link_modifiers_bundle, r=petrochenkov
bors [Mon, 9 Aug 2021 03:59:30 +0000 (03:59 +0000)]
Auto merge of #87619 - 12101111:fix-native_link_modifiers_bundle, r=petrochenkov

Fix feature gate checking of static-nobundle and native_link_modifiers

Feature native_link_modifiers_bundle don't need feature static-nobundle
to work.

Also check the feature gates when using native_link_modifiers from command line options. Current nighly compiler don't check those feature gate.

```
> touch lib.rs
> rustc +nightly lib.rs -L /usr/lib -l static:+bundle=dl --crate-type=rlib
> rustc +nightly lib.rs -L /usr/lib -l dylib:+as-needed=dl --crate-type=dylib -Ctarget-feature=-crt-static
> rustc +nightly lib.rs -L /usr/lib -l static:-bundle=dl --crate-type=rlib
error[E0658]: kind="static-nobundle" is unstable
  |
  = note: see issue #37403 <https://github.com/rust-lang/rust/issues/37403> for more information
  = help: add `#![feature(static_nobundle)]` to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.

```

First found this in https://github.com/rust-lang/rust/pull/85600#discussion_r676612655

2 years agoAuto merge of #87465 - audunhalland:refactor_typeck_primary_body_of, r=eddyb
bors [Mon, 9 Aug 2021 01:08:52 +0000 (01:08 +0000)]
Auto merge of #87465 - audunhalland:refactor_typeck_primary_body_of, r=eddyb

Simplify typeck/primary_body_of, fix comment to match return signature

Hi, new contributor here! I'm carefully reading through the various modules just to learn. I noticed this function, `primary_body_of`, which has gone through a couple of refactors over time, adding new `Option`s to its returned tuple. Observations:

1. the `fn`'s documentation was not all up to date with the the current return signature.
2. `FnHeader` and `FnDecl` are always both `Some` or `None`. So I figured it might just return a reference to the full `hir::FnSig`, for simplicity and more precise typing. It's a pure refactor.

I'm learning better by working with code than just reading it, so here goes! If you want to avoid pure refactor PRs that don't really fix anything, I can revert the code change to only update the comment instead.

2 years agoClarify terms in rustdoc book
Klim Tsoutsman [Sun, 8 Aug 2021 14:10:03 +0000 (00:10 +1000)]
Clarify terms in rustdoc book

Change code blocks to Rust

2 years agoAuto merge of #87235 - poliorcetics:issue-87217-fn-quali-order, r=nagisa
bors [Sun, 8 Aug 2021 22:28:01 +0000 (22:28 +0000)]
Auto merge of #87235 - poliorcetics:issue-87217-fn-quali-order, r=nagisa

Improve diagnostics for wrongly ordered keywords in function declaration

Fix #87217

`@rustbot` label A-diagnostics T-compiler

2 years agoAuto merge of #86879 - YohDeadfall:stabilize-vec-shrink-to, r=dtolnay
bors [Sun, 8 Aug 2021 19:37:02 +0000 (19:37 +0000)]
Auto merge of #86879 - YohDeadfall:stabilize-vec-shrink-to, r=dtolnay

Stabilize Vec<T>::shrink_to

This PR stabilizes `shrink_to` feature and closes the corresponding issue. The second point was addressed already, and no `panic!` should occur.

Closes #56431.

2 years agoBump shrink_to stabilization to Rust 1.56
David Tolnay [Sun, 8 Aug 2021 18:36:53 +0000 (11:36 -0700)]
Bump shrink_to stabilization to Rust 1.56

2 years agoAuto merge of #87697 - GuillaumeGomez:add-e0784, r=nagisa
bors [Sun, 8 Aug 2021 16:40:14 +0000 (16:40 +0000)]
Auto merge of #87697 - GuillaumeGomez:add-e0784, r=nagisa

Assign E0784 error code for union expression errors

2 years agoFix Windows Command::env("PATH")
Chris Denton [Sun, 8 Aug 2021 13:23:08 +0000 (14:23 +0100)]
Fix Windows Command::env("PATH")

2 years ago Fix feature gate checking of static-nobundle and native_link_modifiers
12101111 [Fri, 6 Aug 2021 13:51:59 +0000 (21:51 +0800)]
 Fix feature gate checking of static-nobundle and native_link_modifiers

2 years agoAuto merge of #87827 - eddyb:wrapperless-mem-replace, r=m-ou-se
bors [Sun, 8 Aug 2021 13:11:09 +0000 (13:11 +0000)]
Auto merge of #87827 - eddyb:wrapperless-mem-replace, r=m-ou-se

Avoid using the `copy_nonoverlapping` wrapper through `mem::replace`.

This is a much simpler way to achieve the pre-#86003 behavior of `mem::replace` not needing dynamically-sized `memcpy`s (at least before inlining), than re-doing #81238 (which needs #86699 or something similar).

I didn't notice it until recently, but `ptr::write` already explicitly avoided using the wrapper, while `ptr::read` just called the wrapper (and was the reason for us observing any behavior change from #86003 in Rust-GPU).

<hr/>

The codegen test I've added fails without the change to `core::ptr::read` like this (ignore the `v0` mangling, I was using a worktree with it turned on by default, for this):
```llvm
       13: ; core::intrinsics::copy_nonoverlapping::<u8>
       14: ; Function Attrs: inlinehint nonlazybind uwtable
       15: define internal void `@_RINvNtCscK5tvALCJol_4core10intrinsics19copy_nonoverlappinghECsaS4X3EinRE8_25mem_replace_direct_memcpy(i8*` %src, i8* %dst, i64 %count) unnamed_addr #0 {
       16: start:
       17:  %0 = mul i64 %count, 1
       18:  call void `@llvm.memcpy.p0i8.p0i8.i64(i8*` align 1 %dst, i8* align 1 %src, i64 %0, i1 false)
not:17      !~~~~~~~~~~~~~~~~~~~~~                                                                     error: no match expected
       19:  ret void
       20: }
```
With the `core::ptr::read` change, `core::intrinsics::copy_nonoverlapping` doesn't get instantiated and the test passes.

<hr/>

r? `@m-ou-se` cc `@nagisa` (codegen test) `@oli-obk` / `@RalfJung` (miri diagnostic changes)

2 years agoFix heading colours in Ayu theme
Klim Tsoutsman [Sun, 8 Aug 2021 12:35:51 +0000 (22:35 +1000)]
Fix heading colours in Ayu theme

Closes #87828
The issue seems to stem from #87210 where code headings were changed from a heading containing code to a heading with the `code-header` class. `rustdoc.css` was updated, but `ayu.css` was missed.