]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoprotect `std::io::Take::limit` from overflow in `read`
Frank King [Thu, 17 Mar 2022 15:11:49 +0000 (23:11 +0800)]
protect `std::io::Take::limit` from overflow in `read`

fixs #94981

2 years agoAuto merge of #94928 - lcnr:inline-as_substs, r=michaelwoerister
bors [Tue, 15 Mar 2022 13:14:13 +0000 (13:14 +0000)]
Auto merge of #94928 - lcnr:inline-as_substs, r=michaelwoerister

inline `tuple_fields`

more https://github.com/rust-lang/rust/pull/93505 fun, after this i have no idea what might be causing the perf impact.

2 years agoAuto merge of #94261 - michaelwoerister:debuginfo-types-refactor, r=wesleywiser
bors [Tue, 15 Mar 2022 10:52:32 +0000 (10:52 +0000)]
Auto merge of #94261 - michaelwoerister:debuginfo-types-refactor, r=wesleywiser

debuginfo: Refactor debuginfo generation for types

This PR implements the refactoring of the `rustc_codegen_llvm::debuginfo::metadata` module as described in MCP https://github.com/rust-lang/compiler-team/issues/482.

In particular it
- changes names to use `di_node` instead of `metadata`
- uniformly names all functions that build new debuginfo nodes `build_xyz_di_node`
- renames `CrateDebugContext` to `CodegenUnitDebugContext` (which is more accurate)
- removes outdated parts from `compiler/rustc_codegen_llvm/src/debuginfo/doc.md`
- moves `TypeMap` and functions that work directly work with it to a new `type_map` module
- moves enum related builder functions to a new `enums` module
- splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate
- uses `SmallVec` instead of `Vec` in many places
- removes the old infrastructure for dealing with recursion cycles (`create_and_register_recursive_type_forward_declaration()`, `RecursiveTypeDescription`, `set_members_of_composite_type()`, `MemberDescription`, `MemberDescriptionFactory`, `prepare_xyz_metadata()`, etc)
- adds `type_map::build_type_with_children()` as a replacement for dealing with recursion cycles
- adds many (doc-)comments explaining what's going on
- changes cpp-like naming for C-Style enums so they don't get a `enum$<...>` name (because the NatVis visualizer does not apply to them)
- fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields
- changes cpp-like naming for generator enums so that NatVis works for them
- changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it

The following could be done in subsequent PRs:
- add caching for `closure_saved_names_of_captured_variables`
- add caching for `generator_layout_and_saved_local_names`
- fix inconsistent handling of what is considered a C-style enum wrt to debuginfo
- rename `metadata` module to `types`
- move common generator fields to front instead of appending them

This PR is based on https://github.com/rust-lang/rust/pull/93644 which is not merged yet.

Right now, the changes are all done in one big commit. They could be split into smaller commits but hopefully the list of changes above makes it tractable to review them as a single commit too.

For now: r? `@ghost` (let's see if this affects compile times)

2 years agodebuginfo: Refactor debuginfo generation for types -- Make generator-objects test...
Michael Woerister [Tue, 15 Mar 2022 10:45:51 +0000 (11:45 +0100)]
debuginfo: Refactor debuginfo generation for types -- Make generator-objects test case architecture independent.

2 years agoAuto merge of #94938 - lnicola:rust-analyzer-2022-03-14, r=lnicola
bors [Tue, 15 Mar 2022 07:23:50 +0000 (07:23 +0000)]
Auto merge of #94938 - lnicola:rust-analyzer-2022-03-14, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoAuto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber
bors [Tue, 15 Mar 2022 03:56:33 +0000 (03:56 +0000)]
Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber

More robust fallback for `use` suggestion

Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion.

But this was fragile, as illustrated in issue #87613

This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion.

Fix #87613

2 years agoAuto merge of #92285 - compiler-errors:dyn-proj-bounds, r=nikomatsakis
bors [Tue, 15 Mar 2022 01:31:42 +0000 (01:31 +0000)]
Auto merge of #92285 - compiler-errors:dyn-proj-bounds, r=nikomatsakis

check ~Projection~ all supertrait bounds when confirming dyn candidate

I'm pretty sure Projection is the only other PredicateKind that we care about enforcing here.

Fixes #80800

2 years agocheck all dyn obligations, actually
Michael Goulet [Tue, 1 Feb 2022 03:11:23 +0000 (19:11 -0800)]
check all dyn obligations, actually

2 years agocheck Projection supertrait bounds when confirming dyn candidate
Michael Goulet [Sun, 26 Dec 2021 06:45:05 +0000 (22:45 -0800)]
check Projection supertrait bounds when confirming dyn candidate

2 years agoAuto merge of #94935 - matthiaskrgr:rollup-2o2kyz6, r=matthiaskrgr
bors [Mon, 14 Mar 2022 21:51:31 +0000 (21:51 +0000)]
Auto merge of #94935 - matthiaskrgr:rollup-2o2kyz6, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #90621 (Stabilise `aarch64_target_feature`)
 - #93977 (Type params and assoc types have unit metadata if they are sized)
 - #94670 (Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383))
 - #94884 (Fix remaining meta-variable expression TODOs)
 - #94931 (update miri)

Failed merges:

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

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 14 Mar 2022 17:04:16 +0000 (19:04 +0200)]
:arrow_up: rust-analyzer

2 years agodebuginfo: Refactor debuginfo generation for types -- Rename DebugInfoMethods::create...
Michael Woerister [Mon, 14 Mar 2022 16:18:30 +0000 (17:18 +0100)]
debuginfo: Refactor debuginfo generation for types -- Rename DebugInfoMethods::create_vtable_metadata() to DebugInfoMethods::create_vtable_debuginfo()

2 years agodebuginfo: Refactor debuginfo generation for types -- Address review comments.
Michael Woerister [Mon, 14 Mar 2022 16:11:58 +0000 (17:11 +0100)]
debuginfo: Refactor debuginfo generation for types -- Address review comments.

2 years agoRollup merge of #94931 - RalfJung:miri, r=RalfJung
Matthias Krüger [Mon, 14 Mar 2022 16:25:00 +0000 (17:25 +0100)]
Rollup merge of #94931 - RalfJung:miri, r=RalfJung

update miri

Fixes https://github.com/rust-lang/rust/issues/94910
r? `@ghost`

2 years agoRollup merge of #94884 - c410-f3r:meta-take-2, r=petrochenkov
Matthias Krüger [Mon, 14 Mar 2022 16:24:59 +0000 (17:24 +0100)]
Rollup merge of #94884 - c410-f3r:meta-take-2, r=petrochenkov

Fix remaining meta-variable expression TODOs

As promised on https://github.com/rust-lang/rust/pull/93545.

cc #83527
cc `@mark-i-m`
cc `@petrochenkov`

2 years agoRollup merge of #94670 - xFrednet:rfc-2383-expect-impl-after-party, r=flip1995,wesley...
Matthias Krüger [Mon, 14 Mar 2022 16:24:58 +0000 (17:24 +0100)]
Rollup merge of #94670 - xFrednet:rfc-2383-expect-impl-after-party, r=flip1995,wesleywiser

Improve `expect` impl and handle `#[expect(unfulfilled_lint_expectations)]` (RFC 2383)

This PR updates unstable `ExpectationIds` in stashed diagnostics and adds some asserts to ensure that the stored expectations are really empty in the end. Additionally, it handles the `#[expect(unfulfilled_lint_expectations)]` case.

According to the [Errors and lints docs](https://rustc-dev-guide.rust-lang.org/diagnostics.html#diagnostic-levels) the `error` level should only be used _"when the compiler detects a problem that makes it unable to compile the program"_. As this isn't the case with `#[expect(unfulfilled_lint_expectations)]` I decided to only create a warning. To avoid adding a new lint only for this case, I simply emit a `unfulfilled_lint_expectations` diagnostic with an additional note.

---

r? `@wesleywiser` I'm requesting a review from you since you reviewed the previous PR https://github.com/rust-lang/rust/pull/87835. You are welcome to reassign it if you're busy :upside_down_face:

rfc: [RFC-2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html)

tracking issue: https://github.com/rust-lang/rust/issues/85549

cc: `@flip1995` In case you're also interested in this :)

2 years agoRollup merge of #93977 - compiler-errors:sized-generic-metadata, r=wesleywiser
Matthias Krüger [Mon, 14 Mar 2022 16:24:57 +0000 (17:24 +0100)]
Rollup merge of #93977 - compiler-errors:sized-generic-metadata, r=wesleywiser

Type params and assoc types have unit metadata if they are sized

Extend the logic in `Pointee` projection to ensure that we can satisfy `<T as Pointee>::Metadata = ()` if `T: Sized`.

cc: `@SimonSapin` and #93959

2 years agoRollup merge of #90621 - adamgemmell:dev/stabilise-target-feature, r=Amanieu
Matthias Krüger [Mon, 14 Mar 2022 16:24:56 +0000 (17:24 +0100)]
Rollup merge of #90621 - adamgemmell:dev/stabilise-target-feature, r=Amanieu

Stabilise `aarch64_target_feature`

This PR stabilises `aarch64_target_feature` - see https://github.com/rust-lang/rust/issues/90620

2 years agoAuto merge of #94929 - flip1995:clippyup, r=Manishearth
bors [Mon, 14 Mar 2022 16:24:12 +0000 (16:24 +0000)]
Auto merge of #94929 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

A few days delayed, because I recovered from a cold last week and couldn't get myself to do the sync, sorry. :upside_down_face:

2 years agodebuginfo: Refactor debuginfo generation for types -- Address outstanding FIXMEs.
Michael Woerister [Thu, 3 Mar 2022 13:43:17 +0000 (14:43 +0100)]
debuginfo: Refactor debuginfo generation for types -- Address outstanding FIXMEs.

2 years agodebuginfo: Refactor debuginfo generation for types -- Run x.py fmt
Michael Woerister [Thu, 3 Mar 2022 11:45:35 +0000 (12:45 +0100)]
debuginfo: Refactor debuginfo generation for types -- Run x.py fmt

2 years agoRemove out-dated information from rustc_codegen_llvm/src/debuginfo/doc.md
Michael Woerister [Thu, 3 Mar 2022 11:35:55 +0000 (12:35 +0100)]
Remove out-dated information from rustc_codegen_llvm/src/debuginfo/doc.md

2 years agocompiletest: Don't update PDB files of test cases in-place.
Michael Woerister [Thu, 3 Mar 2022 11:34:38 +0000 (12:34 +0100)]
compiletest: Don't update PDB files of test cases in-place.

2 years agodebuginfo: change cpp-like naming for generator environments so that NatVis works...
Michael Woerister [Thu, 3 Mar 2022 11:10:02 +0000 (12:10 +0100)]
debuginfo: change cpp-like naming for generator environments so that NatVis works for them

2 years agodebuginfo: Refactor debuginfo generation for types
Michael Woerister [Thu, 3 Mar 2022 10:15:25 +0000 (11:15 +0100)]
debuginfo: Refactor debuginfo generation for types

This commit
- changes names to use di_node instead of metadata
- uniformly names all functions that build new debuginfo nodes build_xyz_di_node
- renames CrateDebugContext to CodegenUnitDebugContext (which is more accurate)
- moves TypeMap and functions that work directly work with it to a new type_map module
- moves and reimplements enum related builder functions to a new enums module
- splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate
- uses SmallVec instead of Vec in many places
- removes the old infrastructure for dealing with recursion cycles (create_and_register_recursive_type_forward_declaration(), RecursiveTypeDescription, set_members_of_composite_type(), MemberDescription, MemberDescriptionFactory, prepare_xyz_metadata(), etc)
- adds type_map::build_type_with_children() as a replacement for dealing with recursion cycles
- adds many (doc-)comments explaining what's going on
- changes cpp-like naming for C-Style enums so they don't get a enum$<...> name (because the NatVis visualizer does not apply to them)
- fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields
- changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it

2 years agoupdate miri
Ralf Jung [Mon, 14 Mar 2022 13:52:47 +0000 (09:52 -0400)]
update miri

2 years agoAuto merge of #93749 - ridwanabdillahi:riscv32im_support, r=wesleywiser
bors [Mon, 14 Mar 2022 13:43:20 +0000 (13:43 +0000)]
Auto merge of #93749 - ridwanabdillahi:riscv32im_support, r=wesleywiser

Add riscv32im-unknown-none-elf built-in target triple.

* Add built-in target `riscv32im-unknown-none-elf`.
* Update `platform-support.md` to list it as a Tier 3 target.

Below are details on how this target meets the requirements for tier 3:

> 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.)

I would be willing to be a target maintainer, though I would appreciate if others with more experience around RISC-V volunteered to help with that as well.

> 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.

Uses the same naming as the LLVM target, and the same convention as many other bare-metal targets.

> 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.

I don't believe there is any ambiguity here.

> 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.

I don't see any legal issues here.

> The target must not introduce license incompatibilities.
> Anything added to the Rust repository must be under the standard Rust license (MIT OR 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.
> 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.
> Targets should not require proprietary (non-FOSS) components to link a functional binary or library.
> "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.

I see no issues with any of the above.

> 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.

Only relevant to those making approval decisions.

> 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.

`core` and `alloc` can be used. `std` cannot be used as this is a bare-metal target.

> 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.

Use `--target=x86_64-unknown-none-elf` option to cross compile, just like any target. The target does not support running tests.

> 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.
> 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.

I don't foresee this being a problem.

> 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.
> 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.

No other targets should be affected by the pull request.

2 years agoFix remaining meta-variable expression TODOs
Caio [Mon, 14 Mar 2022 11:29:20 +0000 (08:29 -0300)]
Fix remaining meta-variable expression TODOs

2 years agoAuto merge of #94915 - bjorn3:fix_test_box_def, r=tmiasko
bors [Mon, 14 Mar 2022 11:17:42 +0000 (11:17 +0000)]
Auto merge of #94915 - bjorn3:fix_test_box_def, r=tmiasko

Fix definition of Box in ssa-analysis-regression-50041.rs

The Box in liballoc always has a field for the allocator. It is quite
hard to support both the old and new definition of Box in cg_clif so
this change uses the new definition in this test too.

2 years agoUpdate Cargo.lock
flip1995 [Mon, 14 Mar 2022 11:03:16 +0000 (12:03 +0100)]
Update Cargo.lock

2 years agoMerge commit 'dc5423ad448877e33cca28db2f1445c9c4473c75' into clippyup
flip1995 [Mon, 14 Mar 2022 11:02:53 +0000 (12:02 +0100)]
Merge commit 'dc5423ad448877e33cca28db2f1445c9c4473c75' into clippyup

2 years agoStabilise `aarch64_target_feature`
Adam Gemmell [Thu, 10 Feb 2022 16:43:45 +0000 (16:43 +0000)]
Stabilise `aarch64_target_feature`

2 years agoTie `fp` and `neon`
Adam Gemmell [Thu, 10 Mar 2022 17:50:46 +0000 (17:50 +0000)]
Tie `fp` and `neon`

2 years agoinline `tuple_fields`
lcnr [Mon, 14 Mar 2022 10:46:32 +0000 (11:46 +0100)]
inline `tuple_fields`

2 years agoAuto merge of #8534 - flip1995:rustup, r=flip1995
bors [Mon, 14 Mar 2022 10:34:17 +0000 (10:34 +0000)]
Auto merge of #8534 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2022-03-14
flip1995 [Mon, 14 Mar 2022 10:29:39 +0000 (11:29 +0100)]
Bump nightly version -> 2022-03-14

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Mon, 14 Mar 2022 10:29:18 +0000 (11:29 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #94139 - est31:let_else_rustdoc, r=notriddle
bors [Mon, 14 Mar 2022 07:39:53 +0000 (07:39 +0000)]
Auto merge of #94139 - est31:let_else_rustdoc, r=notriddle

librustdoc: adopt let else in more places

Continuation of #89933, #91018, #91481, #93046, #93590, #94011.

I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This PR handles librustdoc.

2 years agoAuto merge of #94921 - aDotInTheVoid:rustdoc-json-format-cleanup, r=CraftSpider
bors [Mon, 14 Mar 2022 05:10:49 +0000 (05:10 +0000)]
Auto merge of #94921 - aDotInTheVoid:rustdoc-json-format-cleanup, r=CraftSpider

rustdoc-json: Clean Up json format

No semantic changes, but better names

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

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

r? `@CraftSpider`

`@rustbot` modify labels: +A-rustdoc-json +T-rustdoc +C-cleanup

2 years agoAuto merge of #94773 - cjgillot:lifetime-fresh-did, r=oli-obk
bors [Mon, 14 Mar 2022 02:49:21 +0000 (02:49 +0000)]
Auto merge of #94773 - cjgillot:lifetime-fresh-did, r=oli-obk

Identify anonymous lifetimes by their DefId in HIR.

`ParamName::Fresh` currently identifies anonymous lifetimes by an `usize` index computed from the number of lifetimes in scope. This makes the behaviour of lowering dependent on the contents of the surrounding item in unpredictable ways.

This PR replaces this index by the `LocalDefId` of the synthetized generic lifetime parameter. This makes obvious which parameter the lifetime corresponds to.

2 years agorustdoc-json-types: implementors -> implementations
Nixon Enraght-Moony [Sun, 13 Mar 2022 23:37:04 +0000 (23:37 +0000)]
rustdoc-json-types: implementors -> implementations

Closes #94198

2 years agorustdoc-json-types: ty -> type_
Nixon Enraght-Moony [Sun, 13 Mar 2022 23:13:57 +0000 (23:13 +0000)]
rustdoc-json-types: ty -> type_

Fixes #94889

2 years agoAuto merge of #94832 - jonhoo:default-static, r=Mark-Simulacrum
bors [Sun, 13 Mar 2022 23:06:14 +0000 (23:06 +0000)]
Auto merge of #94832 - jonhoo:default-static, r=Mark-Simulacrum

bootstrap: untangle static-libstdcpp & llvm-tools

Previously, the static-libstdcpp setting was tied to llvm-tools such
that enabling the latter always enabled the latter. This seems
unfortunate, since it is entirely reasonable for someone to want to
_not_ statically link stdc++, but _also_ want to build the llvm-tools.
This patch therefore separates the two settings such that neither
implies the other.

On its own, that would change the default behavior in a way that's
likely to surprise users. Specifically, users who build llvm-tools
_likely_ want those tools to be statically compiled against libstdc++,
since otherwise users with older GLIBCXX will be unable to run the
vended tools. So, we also flip the default for the `static-libstdcpp`
setting such that builds always link statically against libstdc++ by
default, but it's _possible_ to opt out.

See also #94719.

2 years agoUpdate comments.
Camille GILLOT [Sun, 13 Mar 2022 22:13:58 +0000 (23:13 +0100)]
Update comments.

2 years agoAuto merge of #94916 - matthiaskrgr:rollup-s6zedfl, r=matthiaskrgr
bors [Sun, 13 Mar 2022 20:59:29 +0000 (20:59 +0000)]
Auto merge of #94916 - matthiaskrgr:rollup-s6zedfl, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #93292 (Implement `BITS` constant for non-zero integers)
 - #94777 (Update armv7-unknown-linux-uclibceabi platform support page.)
 - #94816 (Add `Atomic*::get_mut_slice`)
 - #94844 (Reduce rustbuild bloat caused by serde_derive)
 - #94907 (Omit stdarch test crates from the rust-src component)

Failed merges:

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

2 years agoRollup merge of #94907 - bjorn3:smaller_rust_src_component, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Mar 2022 19:02:02 +0000 (20:02 +0100)]
Rollup merge of #94907 - bjorn3:smaller_rust_src_component, r=Mark-Simulacrum

Omit stdarch test crates from the rust-src component

These crates aren't necessary for building the standard library. This saves 30MB of disk space.

Fixes #94906

2 years agoRollup merge of #94844 - bjorn3:rustbuild_cleanup, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Mar 2022 19:02:01 +0000 (20:02 +0100)]
Rollup merge of #94844 - bjorn3:rustbuild_cleanup, r=Mark-Simulacrum

Reduce rustbuild bloat caused by serde_derive

This reduces the size of the `.text` section from 10.1MiB (6.2MiB for just rustbuild code) to 9.3MiB (5.3MiB for just rustbuild code).

This also reduces compile time from ~6.1s for incr recompilation to ~5.6s.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #94816 - WaffleLapkin:atomic_get_mut_slice, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Mar 2022 19:02:00 +0000 (20:02 +0100)]
Rollup merge of #94816 - WaffleLapkin:atomic_get_mut_slice, r=Mark-Simulacrum

Add `Atomic*::get_mut_slice`

This PR adds the inverse of `Atomic*::from_mut_slice` introduced in #94384 with the following API:
```rust
// core::sync::atomic

impl Atomic* {
    fn get_mut_slice(this: &mut [Self]) -> &mut [*];
}
```

cc `@cuviper`

-----

For now I've used the same tracking issue as `Atomic*::from_mut_slice`, should I open a new one?

2 years agoRollup merge of #94777 - lancethepants:armv7-unknown-linux-uclibceabi, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Mar 2022 19:01:59 +0000 (20:01 +0100)]
Rollup merge of #94777 - lancethepants:armv7-unknown-linux-uclibceabi, r=Mark-Simulacrum

Update armv7-unknown-linux-uclibceabi platform support page.

A few edits and fixes to the support page for the armv7-unknown-linux-uclibceabi target.

2 years agoRollup merge of #93292 - nvzqz:nonzero-bits, r=dtolnay
Matthias Krüger [Sun, 13 Mar 2022 19:01:58 +0000 (20:01 +0100)]
Rollup merge of #93292 - nvzqz:nonzero-bits, r=dtolnay

Implement `BITS` constant for non-zero integers

This adds the associated [`BITS`](https://doc.rust-lang.org/stable/std/primitive.usize.html#associatedconstant.BITS) constant to `NonZero{U,I}{8,16,32,64,128,size}`.

This is useful when a type alias refers to either a regular or non-zero integer.

2 years agoAuto merge of #94738 - Urgau:rustbuild-check-cfg-values, r=Mark-Simulacrum
bors [Sun, 13 Mar 2022 18:34:00 +0000 (18:34 +0000)]
Auto merge of #94738 - Urgau:rustbuild-check-cfg-values, r=Mark-Simulacrum

Enable conditional checking of values in the Rust codebase

This pull-request enable conditional checking of (well known) values in the Rust codebase.

Well known values were added in https://github.com/rust-lang/rust/pull/94362. All the `target_*` values are taken from all the built-in targets which is why some extra values were needed do be added as they are not (yet ?) defined in any built-in targets.

r? `@Mark-Simulacrum`

2 years agoFix definition of Box in ssa-analysis-regression-50041.rs
bjorn3 [Sun, 13 Mar 2022 18:09:52 +0000 (19:09 +0100)]
Fix definition of Box in ssa-analysis-regression-50041.rs

The Box in liballoc always has a field for the allocator. It is quite
hard to support both the old and new definition of Box in cg_clif so
this change uses the new definition in this test too.

2 years agoOmit stdarch test crates from the rust-src component
bjorn3 [Sun, 13 Mar 2022 14:09:48 +0000 (15:09 +0100)]
Omit stdarch test crates from the rust-src component

These crates aren't necessary for building the standard library. This
saves 30MB of disk space.

Fixes #94906

2 years agoRemove FieldName enum
bjorn3 [Sun, 13 Mar 2022 16:35:02 +0000 (17:35 +0100)]
Remove FieldName enum

2 years agoAuto merge of #8422 - buttercrab:only_used_in_recursion, r=llogiq
bors [Sun, 13 Mar 2022 16:11:25 +0000 (16:11 +0000)]
Auto merge of #8422 - buttercrab:only_used_in_recursion, r=llogiq

new lint: `only_used_in_recursion`

changed:
- added `only_used_in_recursion`.
- fixed code that variables are only used in recursion.
- this would not lint when `unused_variable`

This fixes: #8390

-----

changelog: add lint [`only_used_in_recursion`]

2 years agoAuto merge of #94704 - Kobzol:llvm-pgo-update-suite, r=Mark-Simulacrum
bors [Sun, 13 Mar 2022 15:53:14 +0000 (15:53 +0000)]
Auto merge of #94704 - Kobzol:llvm-pgo-update-suite, r=Mark-Simulacrum

Gather LLVM PGO profiles from `rustc-perf` suite on real-world crates

This PR expands the benchmark suite used to gather LLVM PGO profiles in CI from `libcore` to several real-world crates. I hand-picked a few crates, but the list is up for debate.

Previous results that we got from running `syn,cargo,serde` looked pretty [good](https://perf.rust-lang.org/compare.html?start=2631aeef823a9e16d31f999d3f07001e5fcc4b3d&end=abf097afa10dde1aa3d8a1d422724a46aab79bf3).

Running `libcore` + `rustc-perf` with some number of crates is repeated now (and for BOLT it will also be needed), so maybe we can extract it to a bash function?

r? `@Mark-Simulacrum`

2 years agoadd clearing return vars
Jaeyong Sung [Sun, 13 Mar 2022 15:13:57 +0000 (00:13 +0900)]
add clearing return vars

2 years agoAuto merge of #8471 - J-ZhengLi:master-issue7040, r=llogiq
bors [Sun, 13 Mar 2022 14:49:56 +0000 (14:49 +0000)]
Auto merge of #8471 - J-ZhengLi:master-issue7040, r=llogiq

new lint that detects useless match expression

fixes #7040

changelog: Add new  lint [`needless_match`] under complexity lint group

2 years agoPrevent duplicate monomorphization of deserialization impls
bjorn3 [Thu, 3 Mar 2022 17:44:02 +0000 (18:44 +0100)]
Prevent duplicate monomorphization of deserialization impls

This reduces binary size from 9.7MiB (5.8MiB for just rustbuild code)
to 9.3MiB (5.3MiB for just rustbuild code).

This doesn't reduce compile time in a statistically significant way.

2 years agoUse trimmed down deserialization impl for config
bjorn3 [Wed, 2 Mar 2022 18:43:43 +0000 (19:43 +0100)]
Use trimmed down deserialization impl for config

This reduces binary size from 10.1MiB (6.2MiB for just rustbuild code)
to 9.7MiB (5.8MiB for just rustbuild code).

This also reduces compile time from ~6.1s for incr recompilation to ~5.6s.

There is still a lot of
unnecessary code due to the toml crate monomorphizing every
deserialization impl 5 times.

2 years agoRename derive_merge macro to define_config and move Deserialize impl into it
bjorn3 [Wed, 2 Mar 2022 17:38:40 +0000 (18:38 +0100)]
Rename derive_merge macro to define_config and move Deserialize impl into it

2 years agoAuto merge of #94899 - workingjubilee:bump-simd-clamp, r=workingjubilee
bors [Sun, 13 Mar 2022 13:30:18 +0000 (13:30 +0000)]
Auto merge of #94899 - workingjubilee:bump-simd-clamp, r=workingjubilee

Bump portable-simd to shadow Ord

Yon usual bump.
Summary for reference:
- We are moving away from the subjective "directional" nomenclature, so `horizontal_*` becomes `reduce_*`, et cetera.
- In addition, `Simd<Int, N>` now has methods which shadow Ord's methods directly, making those methods behave like the already "overloaded" float methods do.

2 years agoAuto merge of #94897 - camelid:query-doc-hidden, r=cjgillot
bors [Sun, 13 Mar 2022 11:12:01 +0000 (11:12 +0000)]
Auto merge of #94897 - camelid:query-doc-hidden, r=cjgillot

Queryify `is_doc_hidden`

It came up hot on some profiling of rustdoc I did, so hopefully turning
it into a query will help.

2 years agoAuto merge of #94320 - GuillaumeGomez:sidebar-display, r=jsha
bors [Sun, 13 Mar 2022 07:56:08 +0000 (07:56 +0000)]
Auto merge of #94320 - GuillaumeGomez:sidebar-display, r=jsha

Fix sidebar elements display

The bug can be seen more easily when the javascript is disabled:

![Screenshot from 2022-02-24 12-18-28](https://user-images.githubusercontent.com/3050060/155514578-cbefd3dd-f006-47e9-bc76-7c26d7e823e8.png)

r? `@jsha`

2 years agoAuto merge of #94862 - pierwill:bootstrap-useless, r=Dylan-DPC
bors [Sun, 13 Mar 2022 05:37:56 +0000 (05:37 +0000)]
Auto merge of #94862 - pierwill:bootstrap-useless, r=Dylan-DPC

Remove unneeded conversions in bootstrapping code

Fixes warnings from `clippy::useless_conversion` in `src/bootstrap`.

2 years agoAuto merge of #94898 - RalfJung:miri, r=RalfJung
bors [Sun, 13 Mar 2022 02:27:30 +0000 (02:27 +0000)]
Auto merge of #94898 - RalfJung:miri, r=RalfJung

update Miri

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

2 years agoUse reduce_sum in as_simd example
Jubilee Young [Sun, 13 Mar 2022 00:43:38 +0000 (16:43 -0800)]
Use reduce_sum in as_simd example

2 years agoupdate Miri
Ralf Jung [Sun, 13 Mar 2022 00:30:26 +0000 (19:30 -0500)]
update Miri

2 years agoSync portable-simd to rust-lang/portable-simd@72df4c45056a8bc0d1b3f06fdc828722177f0763
Jubilee Young [Sun, 13 Mar 2022 00:09:37 +0000 (16:09 -0800)]
Sync portable-simd to rust-lang/portable-simd@72df4c45056a8bc0d1b3f06fdc828722177f0763

2 years agoAuto merge of #94895 - matthiaskrgr:rollup-9hue5qk, r=matthiaskrgr
bors [Sun, 13 Mar 2022 00:01:32 +0000 (00:01 +0000)]
Auto merge of #94895 - matthiaskrgr:rollup-9hue5qk, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #94867 (Add regression test for `<i32 as Iterator>::count`)
 - #94886 (Update browser-ui-test version used in CI)
 - #94894 (Remove needless use of `Into`)

Failed merges:

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

2 years agoportable-simd#261: Rename horizontal_* to reduce_*
Jubilee [Sat, 12 Mar 2022 23:34:58 +0000 (15:34 -0800)]
portable-simd#261: Rename horizontal_* to reduce_*

2 years agorust-lang/portable-simd#262: also implement clamp for integer vectors
Ralf Jung [Sat, 12 Mar 2022 23:32:28 +0000 (18:32 -0500)]
rust-lang/portable-simd#262: also implement clamp for integer vectors

* add test from issue rust-lang/portable-simd#253

2 years agoQueryify `is_doc_hidden`
Noah Lev [Sat, 12 Mar 2022 22:27:51 +0000 (14:27 -0800)]
Queryify `is_doc_hidden`

It came up hot on some profiling of rustdoc I did, so hopefully turning
it into a query will help.

2 years agoRollup merge of #94894 - camelid:into, r=nagisa
Matthias Krüger [Sat, 12 Mar 2022 21:56:02 +0000 (22:56 +0100)]
Rollup merge of #94894 - camelid:into, r=nagisa

Remove needless use of `Into`

2 years agoRollup merge of #94886 - GuillaumeGomez:update-browser-ui-test, r=notriddle
Matthias Krüger [Sat, 12 Mar 2022 21:56:02 +0000 (22:56 +0100)]
Rollup merge of #94886 - GuillaumeGomez:update-browser-ui-test, r=notriddle

Update browser-ui-test version used in CI

I realized that the extension of `assert-text*` commands was generated not completely valid (it stopped at first "success" and moved instead of running all checks). It was fixed in [this PR](https://github.com/GuillaumeGomez/browser-UI-test/pull/280).

We don't use this feature currently in the rustdoc GUI tests, but just in case...

r? ``@notriddle``

2 years agoRollup merge of #94867 - notriddle:notriddle/i32-count-regression-test, r=Dylan-DPC
Matthias Krüger [Sat, 12 Mar 2022 21:56:01 +0000 (22:56 +0100)]
Rollup merge of #94867 - notriddle:notriddle/i32-count-regression-test, r=Dylan-DPC

Add regression test for `<i32 as Iterator>::count`

Closes #84495

2 years agoAuto merge of #90358 - DevinR528:omitted-field-fix, r=jackh726
bors [Sat, 12 Mar 2022 21:34:30 +0000 (21:34 +0000)]
Auto merge of #90358 - DevinR528:omitted-field-fix, r=jackh726

Fix exposing fields marked unstable or doc hidden

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

Work towards https://github.com/rust-lang/rust/issues/89554

Filter fields that are marked `doc(hidden)` or are unstable with that feature turned off. This brings structs and enums into alignment behavior-wise when emitting warning/errors about pattern exhaustiveness/reachability.

cc `@Nadrieril`

2 years agoRemove needless use of `Into`
Noah Lev [Sat, 12 Mar 2022 21:00:12 +0000 (13:00 -0800)]
Remove needless use of `Into`

2 years agoFix rebase conflicts with stderr files
Devin Ragotzy [Sat, 12 Mar 2022 20:38:44 +0000 (15:38 -0500)]
Fix rebase conflicts with stderr files

2 years agoFormat reordered imports in tyck/pat
Devin Ragotzy [Sun, 6 Mar 2022 23:01:03 +0000 (18:01 -0500)]
Format reordered imports in tyck/pat

2 years agoOnly filter doc(hidden) fields/variants when not crate local
Devin Ragotzy [Mon, 6 Dec 2021 21:17:22 +0000 (16:17 -0500)]
Only filter doc(hidden) fields/variants when not crate local

2 years agoUpdate output for doc hidden usefulness ui test output
Devin Ragotzy [Thu, 28 Oct 2021 00:58:23 +0000 (20:58 -0400)]
Update output for doc hidden usefulness ui test output

2 years agoAdd struct to doc hidden usefulness ui tests
Devin Ragotzy [Thu, 28 Oct 2021 00:57:47 +0000 (20:57 -0400)]
Add struct to doc hidden usefulness ui tests

2 years agoAdd struct to stability ui tests in usefulness
Devin Ragotzy [Thu, 28 Oct 2021 00:55:44 +0000 (20:55 -0400)]
Add struct to stability ui tests in usefulness

2 years agoUpdate non-exhaustive omitted_patterns ui output
Devin Ragotzy [Thu, 28 Oct 2021 00:30:26 +0000 (20:30 -0400)]
Update non-exhaustive omitted_patterns ui output

2 years agoAdd unstable struct fields to ui tests
Devin Ragotzy [Thu, 28 Oct 2021 00:29:53 +0000 (20:29 -0400)]
Add unstable struct fields to ui tests

2 years agoFix omitted_patterns lint showing unstable/doc hidden fields
Devin Ragotzy [Thu, 28 Oct 2021 00:29:14 +0000 (20:29 -0400)]
Fix omitted_patterns lint showing unstable/doc hidden fields

2 years agoAuto merge of #94865 - notriddle:notriddle/single-colon-path-not-const-generics,...
bors [Sat, 12 Mar 2022 19:10:33 +0000 (19:10 +0000)]
Auto merge of #94865 - notriddle:notriddle/single-colon-path-not-const-generics, r=cjgillot

diagnostics: single colon within `<>` probably, not type ascription

Fixes #94812

2 years agoAuto merge of #94711 - ouz-a:master3, r=oli-obk
bors [Sat, 12 Mar 2022 16:37:07 +0000 (16:37 +0000)]
Auto merge of #94711 - ouz-a:master3, r=oli-obk

Return early to fix ICE

This fixes #94627, ICE happens because compiler tries to suggest constraining type parameter but the only constraint is implicit `std::Sized` one, so it gets removed and there is nothing to suggest resulting in ICE.

2 years agodon't call multipart_suggestion
ouz-a [Sat, 12 Mar 2022 15:51:28 +0000 (18:51 +0300)]
don't call multipart_suggestion

2 years agoUse consistent prose for `::`
Michael Howell [Sat, 12 Mar 2022 15:20:36 +0000 (08:20 -0700)]
Use consistent prose for `::`

Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2 years agoUpdate browser-ui-test version used in CI
Guillaume Gomez [Sat, 12 Mar 2022 15:07:42 +0000 (16:07 +0100)]
Update browser-ui-test version used in CI

2 years agoAuto merge of #94873 - DrMeepster:box_alloc_ice3, r=oli-obk
bors [Sat, 12 Mar 2022 14:18:34 +0000 (14:18 +0000)]
Auto merge of #94873 - DrMeepster:box_alloc_ice3, r=oli-obk

Fix ICE when using Box<T, A>, again

Sequel to #94043, fixes #94835.

2 years agoIdentify anonymous lifetimes by their DefId in HIR.
Camille GILLOT [Tue, 1 Mar 2022 20:08:26 +0000 (21:08 +0100)]
Identify anonymous lifetimes by their DefId in HIR.

2 years agoUse `Self::BITS` in `log2` implementation
Nikolai Vazquez [Sat, 12 Mar 2022 13:01:35 +0000 (08:01 -0500)]
Use `Self::BITS` in `log2` implementation

2 years agoImplement `BITS` constant for non-zero integers
Nikolai Vazquez [Sat, 12 Mar 2022 13:00:45 +0000 (08:00 -0500)]
Implement `BITS` constant for non-zero integers

2 years agoAuto merge of #94870 - notriddle:notriddle/filter-regression, r=oli-obk
bors [Sat, 12 Mar 2022 11:58:07 +0000 (11:58 +0000)]
Auto merge of #94870 - notriddle:notriddle/filter-regression, r=oli-obk

diagnostics: do not spurriously claim something is "not an iterator"

Fixes a minor regression caused by #94746, where `iter::Filter` is spurriously declared "not an iterator."

2 years agoAuto merge of #94875 - matthiaskrgr:rollup-tq1li2d, r=matthiaskrgr
bors [Sat, 12 Mar 2022 09:30:06 +0000 (09:30 +0000)]
Auto merge of #94875 - matthiaskrgr:rollup-tq1li2d, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #94150 (rustdoc-json: Include GenericParamDefKind::Type::synthetic in JSON)
 - #94833 ([2/2] Implement macro meta-variable expression)
 - #94863 (Remove redundant slicing of whole ranges in `bootstrap`)

Failed merges:

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

2 years agoRollup merge of #94863 - pierwill:bootstrap-slicing, r=Mark-Simulacrum
Matthias Krüger [Sat, 12 Mar 2022 08:35:47 +0000 (09:35 +0100)]
Rollup merge of #94863 - pierwill:bootstrap-slicing, r=Mark-Simulacrum

Remove redundant slicing of whole ranges in `bootstrap`

Found with `clippy::redundant_slicing`.

2 years agoRollup merge of #94833 - c410-f3r:meta-take-2, r=petrochenkov
Matthias Krüger [Sat, 12 Mar 2022 08:35:45 +0000 (09:35 +0100)]
Rollup merge of #94833 - c410-f3r:meta-take-2, r=petrochenkov

[2/2] Implement macro meta-variable expression

Final part of https://github.com/rust-lang/rust/pull/93545#issuecomment-1050963295

r? `@petrochenkov`