]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agobootstrap: make LLVM build respect *FLAGS envvars
Jon Gjengset [Fri, 11 Feb 2022 19:44:44 +0000 (11:44 -0800)]
bootstrap: make LLVM build respect *FLAGS envvars

This tidies up the logic in `src/bootstrap/native.rs` such that:

 - `CMAKE_*_LINKER_FLAGS` is not overridden if we add to it twice.
 - `CMAKE_*_FLAGS` also include the standard `*FLAGS` environment
   variables, which CMake respects when we _don't_ set `CMAKE_*_FLAGS`.
 - `llvm.ldflags` from `config.toml` appends to the ldflags Rust's
   bootstrap logic adds, rather than replacing them.

Fixes #93880.

2 years agoAuto merge of #93891 - matthiaskrgr:rollup-xadut8w, r=matthiaskrgr
bors [Fri, 11 Feb 2022 15:16:09 +0000 (15:16 +0000)]
Auto merge of #93891 - matthiaskrgr:rollup-xadut8w, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #92242 (Erase regions before calculating layout for packed field capture)
 - #93443 (Add comment on stable_hash_impl for OwnerNodes)
 - #93742 (Drop rustc-docs from complete profile)
 - #93852 (rustdoc: remove support for multi-query search)
 - #93853 (Make all `hir::Map` methods consistently by-value)
 - #93861 (Fix ICE if no trait assoc const eq)
 - #93862 (Split x86_64-apple builder into two)
 - #93864 (Remove ArchiveBuilder::update_symbols)

Failed merges:

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

2 years agoRollup merge of #93864 - bjorn3:cleanup_archive_handling, r=petrochenkov
Matthias Krüger [Fri, 11 Feb 2022 06:48:10 +0000 (07:48 +0100)]
Rollup merge of #93864 - bjorn3:cleanup_archive_handling, r=petrochenkov

Remove ArchiveBuilder::update_symbols

All paths to an ArchiveBuilder::build call update_symbols first.

2 years agoRollup merge of #93862 - Mark-Simulacrum:apple-split, r=pietroalbini
Matthias Krüger [Fri, 11 Feb 2022 06:48:09 +0000 (07:48 +0100)]
Rollup merge of #93862 - Mark-Simulacrum:apple-split, r=pietroalbini

Split x86_64-apple builder into two

This splits out roughly 20-25 minutes of work, which should result in roughly parity with some of the other apple builders at approximately 2.2-2.4 hours per successful build.

r? `@pietroalbini`

2 years agoRollup merge of #93861 - JulianKnodt:notraitace, r=wesleywiser
Matthias Krüger [Fri, 11 Feb 2022 06:48:08 +0000 (07:48 +0100)]
Rollup merge of #93861 - JulianKnodt:notraitace, r=wesleywiser

Fix ICE if no trait assoc const eq

Fixes #93835

2 years agoRollup merge of #93853 - steffahn:map_by_value, r=wesleywiser
Matthias Krüger [Fri, 11 Feb 2022 06:48:06 +0000 (07:48 +0100)]
Rollup merge of #93853 - steffahn:map_by_value, r=wesleywiser

Make all `hir::Map` methods consistently by-value

`hir::Map` only consists of a single reference (as part of the contained `TyCtxt`) anyways, so copying is literally zero overhead compared to passing a reference

2 years agoRollup merge of #93852 - GuillaumeGomez:remove-multi-query, r=jsha
Matthias Krüger [Fri, 11 Feb 2022 06:48:05 +0000 (07:48 +0100)]
Rollup merge of #93852 - GuillaumeGomez:remove-multi-query, r=jsha

rustdoc: remove support for multi-query search

This is needed by https://github.com/rust-lang/rust/pull/90630 to make feature changes non-existent.

cc `@camelid`
r? `@jsha`

2 years agoRollup merge of #93742 - Mark-Simulacrum:skip-rustc-docs-complete, r=pietroalbini
Matthias Krüger [Fri, 11 Feb 2022 06:48:04 +0000 (07:48 +0100)]
Rollup merge of #93742 - Mark-Simulacrum:skip-rustc-docs-complete, r=pietroalbini

Drop rustc-docs from complete profile

Addresses #75833, but does not fully fix it -- we should support side-by-side installation of these ideally, but that's not currently possible.

r? `@pietroalbini`

2 years agoRollup merge of #93443 - spastorino:add-stable-hash-impl-doc, r=cjgillot
Matthias Krüger [Fri, 11 Feb 2022 06:48:03 +0000 (07:48 +0100)]
Rollup merge of #93443 - spastorino:add-stable-hash-impl-doc, r=cjgillot

Add comment on stable_hash_impl for OwnerNodes

r? `@cjgillot`

cc `@oli-obk`

`@bors` rollup=always

2 years agoRollup merge of #92242 - compiler-errors:layout-modulo-regions, r=matthewjasper
Matthias Krüger [Fri, 11 Feb 2022 06:48:02 +0000 (07:48 +0100)]
Rollup merge of #92242 - compiler-errors:layout-modulo-regions, r=matthewjasper

Erase regions before calculating layout for packed field capture

Self-explanatory. We just erase region inferencing because we don't need that for layout computation... Q: layouts are always equal modulo regions, right?

Fixes #92240

2 years agoAuto merge of #93865 - flip1995:clippyup, r=Manishearth,flip1995
bors [Fri, 11 Feb 2022 06:26:47 +0000 (06:26 +0000)]
Auto merge of #93865 - flip1995:clippyup, r=Manishearth,flip1995

Update Clippy

r? `@Manishearth`

2 years agoSplit x86_64 apple builder into two
Mark Rousskov [Thu, 10 Feb 2022 16:39:02 +0000 (11:39 -0500)]
Split x86_64 apple builder into two

2 years agoAuto merge of #93860 - ehuss:update-rls, r=ehuss
bors [Thu, 10 Feb 2022 19:48:52 +0000 (19:48 +0000)]
Auto merge of #93860 - ehuss:update-rls, r=ehuss

Update rls

2 commits in f37425e33c864c697af06df66e7473444605c149..3df74381f37617ec800537c11fb0c3130f5f3616
2022-01-15 18:07:20 +0100 to 2022-02-10 07:33:33 -0800
- chore: Upgrade cargo (rust-lang/rls#1764)
- Bump rls-analysis version

2 years agoClippy: Fix botstrap fallout
flip1995 [Thu, 10 Feb 2022 18:52:01 +0000 (19:52 +0100)]
Clippy: Fix botstrap fallout

2 years agoMerge commit '57b3c4b90f4346b3990c1be387c3b3ca7b78412c' into clippyup
flip1995 [Thu, 10 Feb 2022 17:40:06 +0000 (18:40 +0100)]
Merge commit '57b3c4b90f4346b3990c1be387c3b3ca7b78412c' into clippyup

2 years agoUnconditionally update symbols
bjorn3 [Thu, 10 Feb 2022 17:27:18 +0000 (18:27 +0100)]
Unconditionally update symbols

All paths to an ArchiveBuilder::build call update_symbols first.

2 years agoRemove unnecessary update_symbols call
bjorn3 [Thu, 10 Feb 2022 17:18:38 +0000 (18:18 +0100)]
Remove unnecessary update_symbols call

For cg_llvm update_symbols merely sets a flag, so changing the position
or removing an additional call doesn't have any effect.

2 years agoAuto merge of #8409 - flip1995:rustup, r=flip1995
bors [Thu, 10 Feb 2022 17:14:39 +0000 (17:14 +0000)]
Auto merge of #8409 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2022-02-10
flip1995 [Thu, 10 Feb 2022 17:11:49 +0000 (18:11 +0100)]
Bump nightly version -> 2022-02-10

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 10 Feb 2022 17:11:27 +0000 (18:11 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoFix ICE if no trait assoc const eq
kadmin [Thu, 10 Feb 2022 16:00:54 +0000 (16:00 +0000)]
Fix ICE if no trait assoc const eq

2 years agoUpdate rls
Eric Huss [Thu, 10 Feb 2022 15:47:01 +0000 (07:47 -0800)]
Update rls

2 years agoAuto merge of #93854 - matthiaskrgr:rollup-bh2a85j, r=matthiaskrgr
bors [Thu, 10 Feb 2022 12:31:51 +0000 (12:31 +0000)]
Auto merge of #93854 - matthiaskrgr:rollup-bh2a85j, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #92670 (add kernel target for RustyHermit)
 - #93756 (Support custom options for LLVM build)
 - #93802 (fix oversight in the `min_const_generics` checks)
 - #93808 (Remove first headings indent)
 - #93824 (Stabilize cfg_target_has_atomic)
 - #93830 (Refactor sidebar printing code)
 - #93843 (kmc-solid: Fix wait queue manipulation errors in the `Condvar` implementation)

Failed merges:

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

2 years agoRemove support for multi-query search
Guillaume Gomez [Thu, 10 Feb 2022 10:39:35 +0000 (11:39 +0100)]
Remove support for multi-query search

2 years agoRemove further usage of `&hir::Map`
Frank Steffahn [Thu, 10 Feb 2022 12:04:59 +0000 (13:04 +0100)]
Remove further usage of `&hir::Map`

2 years agoRollup merge of #93843 - solid-rs:fix-kmc-solid-condvar, r=m-ou-se
Matthias Krüger [Thu, 10 Feb 2022 11:10:02 +0000 (12:10 +0100)]
Rollup merge of #93843 - solid-rs:fix-kmc-solid-condvar, r=m-ou-se

kmc-solid: Fix wait queue manipulation errors in the `Condvar` implementation

This PR fixes a number of bugs in the `Condvar` wait queue implementation used by the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets. These bugs can occur when there are multiple threads waiting on the same `Condvar` and sometimes manifest as an `unwrap` failure.

2 years agoRollup merge of #93830 - camelid:cleanup-section-code, r=GuillaumeGomez
Matthias Krüger [Thu, 10 Feb 2022 11:10:01 +0000 (12:10 +0100)]
Rollup merge of #93830 - camelid:cleanup-section-code, r=GuillaumeGomez

Refactor sidebar printing code

This is the refactoring parts of #92660, plus the trait aliases capitalization
consistency fix. I think this will be necessary for #92658.

r? `@GuillaumeGomez`

2 years agoRollup merge of #93824 - Amanieu:stable_cfg_target_has_atomic, r=davidtwco
Matthias Krüger [Thu, 10 Feb 2022 11:10:00 +0000 (12:10 +0100)]
Rollup merge of #93824 - Amanieu:stable_cfg_target_has_atomic, r=davidtwco

Stabilize cfg_target_has_atomic

`target_has_atomic_equal_alignment` is now tracked separately in #93822.

Closes #32976

2 years agoRollup merge of #93808 - GuillaumeGomez:headings-indent, r=jsha
Matthias Krüger [Thu, 10 Feb 2022 11:09:59 +0000 (12:09 +0100)]
Rollup merge of #93808 - GuillaumeGomez:headings-indent, r=jsha

Remove first headings indent

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

I removed the anchors displayed on hover because the cursor changes when you hover them in any case, removing the need for the indent altogether.

[Demo](https://rustdoc.crud.net/imperio/headings-indent/std/index.html).

Screenshot of the result:

![Screenshot from 2022-02-09 14-46-12](https://user-images.githubusercontent.com/3050060/153213824-74ef0b62-4f2b-4816-8912-6f2f3beacd29.png)

r? `@jsha`

2 years agoRollup merge of #93802 - lcnr:mcg-woops, r=BoxyUwU
Matthias Krüger [Thu, 10 Feb 2022 11:09:58 +0000 (12:09 +0100)]
Rollup merge of #93802 - lcnr:mcg-woops, r=BoxyUwU

fix oversight in the `min_const_generics` checks

r? `@BoxyUwU`

2 years agoRollup merge of #93756 - tmandry:llvm-build-config, r=Mark-Simulacrum
Matthias Krüger [Thu, 10 Feb 2022 11:09:56 +0000 (12:09 +0100)]
Rollup merge of #93756 - tmandry:llvm-build-config, r=Mark-Simulacrum

Support custom options for LLVM build

The LLVM build has a lot of options that rustbuild doesn't need to know about. We should allow the user to customize the LLVM build directly.

Here are some [example customizations][recipe] we'd like to do.

[recipe]: https://fuchsia.googlesource.com/infra/recipes/+/90105e5e4e37b0441c8dde538df54a55f79b3d22/recipes/contrib/clang_toolchain.py#579

2 years agoRollup merge of #92670 - hermitcore:kernel, r=davidtwco
Matthias Krüger [Thu, 10 Feb 2022 11:09:55 +0000 (12:09 +0100)]
Rollup merge of #92670 - hermitcore:kernel, r=davidtwco

add kernel target for RustyHermit

Currently, we are thinking to use *-unknown-none targets instead to define for every platform our own one (see hermitcore/rusty-hermit#197). However, the current target aarch64-unknown-none-softfloat doesn't support dynamic relocation. Our RustyHermit project uses this feature and consequently we define a new target aarch64-unknown-hermitkernel to support it.

> 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 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 kernel targets (e.g. `x86_64_unknown_none_linuxkernel`). In contrast to the bare-metal target for the aarch64 architecture, the unikernel requires dynamic relocation.

> 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. It use the same convention on x86_64 architecture.

> 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. For `std` exists already the target `aarch64_unknown_hermit`, which enables FPU support.

> 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=aarch64_unknown_hermitkernel` option to cross compile. The target does currently 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 agoMake all hir::Map methods consistently by-value
Frank Steffahn [Thu, 10 Feb 2022 10:42:02 +0000 (11:42 +0100)]
Make all hir::Map methods consistently by-value

(hir::Map only consists of a single reference anyways)

2 years agoAuto merge of #93511 - cjgillot:query-copy, r=oli-obk
bors [Thu, 10 Feb 2022 09:37:07 +0000 (09:37 +0000)]
Auto merge of #93511 - cjgillot:query-copy, r=oli-obk

Ensure that queries only return Copy types.

This should pervent the perf footgun of returning a result with an expensive `Clone` impl (like a `Vec` of a hash map).

I went for the stupid solution of allocating on an arena everything that was not `Copy`. Some query results could be made Copy easily, but I did not really investigate.

2 years agofix min_const_generics oversight
lcnr [Wed, 9 Feb 2022 11:29:43 +0000 (12:29 +0100)]
fix min_const_generics oversight

2 years agokmc-solid: Wait queue should be sorted in the descending order of task priorities
Tomoaki Kawada [Thu, 10 Feb 2022 02:26:46 +0000 (11:26 +0900)]
kmc-solid: Wait queue should be sorted in the descending order of task priorities

In ITRON, lower priority values mean higher priorities.

2 years agoAuto merge of #93836 - matthiaskrgr:rollup-d1ssiwl, r=matthiaskrgr
bors [Thu, 10 Feb 2022 02:27:43 +0000 (02:27 +0000)]
Auto merge of #93836 - matthiaskrgr:rollup-d1ssiwl, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #91443 (Better suggestions when user tries to collect into an unsized `[_]`)
 - #91504 (`#[used(linker)]` attribute)
 - #93503 (debuginfo: Fix DW_AT_containing_type vtable debuginfo regression)
 - #93753 (Complete removal of #[main] attribute from compiler)
 - #93799 (Fix typo in `std::fmt` docs)
 - #93813 (Make a few cleanup MIR passes public)

Failed merges:

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

2 years agokmc-solid: Fix wait queue manipulation errors in the `Condvar` implementation
Tomoaki Kawada [Wed, 9 Feb 2022 05:34:27 +0000 (14:34 +0900)]
kmc-solid: Fix wait queue manipulation errors in the `Condvar` implementation

2 years agoAdd llvm.build-config option
Tyler Mandry [Tue, 8 Feb 2022 01:56:53 +0000 (01:56 +0000)]
Add llvm.build-config option

2 years agoRollup merge of #93813 - xldenis:public-mir-passes, r=wesleywiser
Matthias Krüger [Wed, 9 Feb 2022 22:29:59 +0000 (23:29 +0100)]
Rollup merge of #93813 - xldenis:public-mir-passes, r=wesleywiser

Make a few cleanup MIR passes public

Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Making.20passes.20public.20again

This makes a few passes which used to be public, public again. I'd like to use these to clean up MIR code for my external rustc driver. The other option would be to make them all public, but I don't know if that's warranted / useful.

r? `@wesleywiser`

2 years agoRollup merge of #93799 - wooorm:patch-1, r=dtolnay
Matthias Krüger [Wed, 9 Feb 2022 22:29:58 +0000 (23:29 +0100)]
Rollup merge of #93799 - wooorm:patch-1, r=dtolnay

Fix typo in `std::fmt` docs

Hey!

Reading the docs (https://doc.rust-lang.org/std/fmt/#named-parameters), this seems like a typo?

The docs here also seem to mix “named argument” and “named parameter”? Intentional? Mistake?

2 years agoRollup merge of #93753 - jeremyBanks:main-conflict, r=petrochenkov
Matthias Krüger [Wed, 9 Feb 2022 22:29:57 +0000 (23:29 +0100)]
Rollup merge of #93753 - jeremyBanks:main-conflict, r=petrochenkov

Complete removal of #[main] attribute from compiler

resolves #93786

---

The `#[main]` attribute was mostly removed from the language in #84217, but not completely. It is still recognized as a builtin attribute by the compiler, but it has no effect. However, this no-op attribute is no longer gated by `#[feature(main)]` (which no longer exists), so it's possible to include it in code *on stable* without any errors, which seems unintentional. For example, the following code is accepted ([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=%23%5Bmain%5D%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22hello%20world%22)%3B%0A%7D%0A)).

```rust
#[main]
fn main() {
    println!("hello world");
}
```

Aside from that oddity, the existence of this attribute causes code like the following to fail ([playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&code=use%20tokio%3A%3Amain%3B%0A%0A%23%5Bmain%5D%0Afn%20main()%20%7B%0A%20%20%20%20println!(%22hello%20world%22)%3B%0A%7D%0A)). According https://github.com/rust-lang/rust/pull/84062#issuecomment-825038275, the removal of `#[main]` was expected to eliminate this conflict (previously reported as #62127).

```rust
use tokio::main;

#[main]
fn main() {
    println!("hello world");
}
```

```
error[E0659]: `main` is ambiguous
 --> src/main.rs:3:3
  |
3 | #[main]
  |   ^^^^ ambiguous name
  |
  = note: ambiguous because of a name conflict with a builtin attribute
  = note: `main` could refer to a built-in attribute
```

[This error message can be confusing](https://stackoverflow.com/q/71024443/1114), as the mostly-removed `#[main]` attribute is not mentioned in any documentation.

Since the current availability of `#[main]` on stable seems unintentional, and to needlessly block use of the `main` identifier in the attribute namespace, this PR finishes removing the `#[main]` attribute as described in https://github.com/rust-lang/rust/issues/29634#issuecomment-274951753 by deleting it from `builtin_attrs.rs`, and adds two test cases to ensure that the attribute is no longer accepted and no longer conflicts with other attributes imported as `main`.

2 years agoRollup merge of #93503 - michaelwoerister:fix-vtable-holder-debuginfo-regression...
Matthias Krüger [Wed, 9 Feb 2022 22:29:56 +0000 (23:29 +0100)]
Rollup merge of #93503 - michaelwoerister:fix-vtable-holder-debuginfo-regression, r=wesleywiser

debuginfo: Fix DW_AT_containing_type vtable debuginfo regression

This PR brings back the `DW_AT_containing_type` attribute for vtables after it has accidentally been removed in #89597.

It also implements a more accurate description of vtables. Instead of describing them as an array of void pointers, the compiler will now emit a struct type description with a field for each entry of the vtable.

r? ``@wesleywiser``

This PR should fix issue https://github.com/rust-lang/rust/issues/93164.
~~The PR is blocked on https://github.com/rust-lang/rust/pull/93154 because both of them modify the `codegen/debug-vtable.rs` test case.~~

2 years agoRollup merge of #91504 - cynecx:used_retain, r=nikic
Matthias Krüger [Wed, 9 Feb 2022 22:29:56 +0000 (23:29 +0100)]
Rollup merge of #91504 - cynecx:used_retain, r=nikic

`#[used(linker)]` attribute

See https://github.com/dtolnay/linkme/issues/41#issuecomment-927255631.

2 years agoRollup merge of #91443 - compiler-errors:bad_collect_into_slice, r=wesleywiser
Matthias Krüger [Wed, 9 Feb 2022 22:29:55 +0000 (23:29 +0100)]
Rollup merge of #91443 - compiler-errors:bad_collect_into_slice, r=wesleywiser

Better suggestions when user tries to collect into an unsized `[_]`

1. Extend the predicate on `rustc_on_unimplemented` to support substitutions like note, label, etc (i.e. treat it as a `OnUnimplementedFormatString`) so we can have slightly more general `rustc_on_unimplemented` special-cases.
2. Add a `rustc_on_unimplemented` if we fail on `FromIterator<A> for [A]` which happens when we don't explicitly collect into a `vec<A>`, but then pass the return from a `.collect` call into something that takes a slice.

Fixes #91423

2 years agoTitle-case trait aliases section for consistency
Noah Lev [Fri, 7 Jan 2022 23:30:50 +0000 (15:30 -0800)]
Title-case trait aliases section for consistency

2 years agoRefactor sidebar printing code
Noah Lev [Sat, 8 Jan 2022 00:30:01 +0000 (16:30 -0800)]
Refactor sidebar printing code

The new code is much simpler and easier to understand. In fact, the old
code actually had a subtle bug where it excluded a few item types,
including trait aliases, from the sidebar, even though they are rendered
on the page itself! Now, all sections should show up in the sidebar.

2 years agoDeduplicate item sections
Noah Lev [Sat, 8 Jan 2022 00:20:53 +0000 (16:20 -0800)]
Deduplicate item sections

2 years agorustdoc: Create enum for sections holding items
Noah Lev [Sat, 8 Jan 2022 00:12:11 +0000 (16:12 -0800)]
rustdoc: Create enum for sections holding items

2 years agoAvoid clone.
Camille GILLOT [Tue, 1 Feb 2022 17:52:22 +0000 (18:52 +0100)]
Avoid clone.

2 years agoExplain &Arc.
Camille GILLOT [Tue, 1 Feb 2022 17:46:04 +0000 (18:46 +0100)]
Explain &Arc.

2 years agoMake FnAbiError Copy.
Camille GILLOT [Tue, 1 Feb 2022 17:44:45 +0000 (18:44 +0100)]
Make FnAbiError Copy.

2 years agoUse a slice for object_lifetime_defaults.
Camille GILLOT [Tue, 1 Feb 2022 17:28:24 +0000 (18:28 +0100)]
Use a slice for object_lifetime_defaults.

2 years agoUse a slice in DefIdForest.
Camille GILLOT [Tue, 1 Feb 2022 17:27:49 +0000 (18:27 +0100)]
Use a slice in DefIdForest.

2 years agoEnsure that queries only return Copy types.
Camille GILLOT [Mon, 31 Jan 2022 18:55:34 +0000 (19:55 +0100)]
Ensure that queries only return Copy types.

2 years agoAuto merge of #93741 - Mark-Simulacrum:global-job-id, r=cjgillot
bors [Wed, 9 Feb 2022 18:54:30 +0000 (18:54 +0000)]
Auto merge of #93741 - Mark-Simulacrum:global-job-id, r=cjgillot

Refactor query system to maintain a global job id counter

This replaces the per-shard counters with a single global counter, simplifying
the JobId struct down to just a u64 and removing the need to pipe a DepKind
generic through a bunch of code. The performance implications on non-parallel
compilers are likely minimal (this switches to `Cell<u64>` as the backing
storage over a `u64`, but the latter was already inside a `RefCell` so it's not
really a significance divergence). On parallel compilers, the cost of a single
global u64 counter may be more significant: it adds a serialization point in
theory. On the other hand, we can imagine changing the counter to have a
thread-local component if it becomes worrisome or some similar structure.

The new design is sufficiently simpler that it warrants the potential for slight
changes down the line if/when we get parallel compilation to be more of a
default.

A u64 counter, instead of u32 (the old per-shard width), is chosen to avoid
possibly overflowing it and causing problems; it is effectively impossible that
we would overflow a u64 counter in this context.

2 years agoStabilize cfg_target_has_atomic
Amanieu d'Antras [Wed, 9 Feb 2022 18:14:35 +0000 (18:14 +0000)]
Stabilize cfg_target_has_atomic

Closes #32976

2 years agoSuggest collecting into `Vec<_>` when collecting into `[_]`
Michael Goulet [Thu, 2 Dec 2021 02:51:27 +0000 (18:51 -0800)]
Suggest collecting into `Vec<_>` when collecting into `[_]`

2 years agoAllow substitutions in `rustc_on_unimplemented` predicate
Michael Goulet [Thu, 2 Dec 2021 02:50:46 +0000 (18:50 -0800)]
Allow substitutions in `rustc_on_unimplemented` predicate

2 years agoMake a few cleanup MIR passes public
Xavier Denis [Wed, 9 Feb 2022 15:17:42 +0000 (16:17 +0100)]
Make a few cleanup MIR passes public

2 years agoAuto merge of #93724 - Mark-Simulacrum:drop-query-stats, r=michaelwoerister
bors [Wed, 9 Feb 2022 15:53:10 +0000 (15:53 +0000)]
Auto merge of #93724 - Mark-Simulacrum:drop-query-stats, r=michaelwoerister

Delete -Zquery-stats infrastructure

These statistics are computable from the self-profile data and/or ad-hoc collectable as needed, and in the meantime contribute to rustc bootstrap times -- locally, this PR shaves ~2.5% from rustc_query_impl builds in instruction counts.

If this does lose some functionality we want to keep, I think we should migrate it to self-profile (or a similar interface) rather than this ad-hoc reporting.

2 years agoUpdate rustdoc tests for headings indent
Guillaume Gomez [Wed, 9 Feb 2022 13:44:10 +0000 (14:44 +0100)]
Update rustdoc tests for headings indent

2 years agoUnify headings indent and remove useless anchor
Guillaume Gomez [Wed, 9 Feb 2022 13:43:44 +0000 (14:43 +0100)]
Unify headings indent and remove useless anchor

2 years agoAuto merge of #93681 - Mark-Simulacrum:rlink-binary, r=davidtwco,bjorn3
bors [Wed, 9 Feb 2022 12:51:53 +0000 (12:51 +0000)]
Auto merge of #93681 - Mark-Simulacrum:rlink-binary, r=davidtwco,bjorn3

Store rlink data in opaque binary format on disk

This removes one of the only uses of JSON decoding (to Rust structs) from the compiler, and fixes the FIXME comment. It's not clear to me what the reason for using JSON here originally was, and from what I can tell nothing outside of rustc expects to read the emitted information, so it seems like a reasonable step to move it to the metadata-encoding format (rustc_serialize::opaque).

Mostly intended as a FIXME fix, though potentially a stepping stone to dropping the support for Decodable to be used to decode JSON entirely (allowing for better/faster APIs on the Decoder trait).

cc #64191

2 years agoFix typo in `std::fmt` docs
Titus [Wed, 9 Feb 2022 10:26:10 +0000 (11:26 +0100)]
Fix typo in `std::fmt` docs

2 years agoMove tests into attributes directory to pacify tidy
Nikita Popov [Wed, 9 Feb 2022 10:00:39 +0000 (11:00 +0100)]
Move tests into attributes directory to pacify tidy

2 years agoAdd tracking issue
Nikita Popov [Wed, 9 Feb 2022 09:59:33 +0000 (10:59 +0100)]
Add tracking issue

2 years agoAuto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obk
bors [Wed, 9 Feb 2022 09:41:48 +0000 (09:41 +0000)]
Auto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obk

Improve opaque type higher-ranked region error message under NLL

Currently, any higher-ranked region errors involving opaque types
fall back to a generic "higher-ranked subtype error" message when
run under NLL. This PR adds better error message handling for this
case, giving us the same kinds of error messages that we currently
get without NLL:

```
error: implementation of `MyTrait` is not general enough
  --> $DIR/opaque-hrtb.rs:12:13
   |
LL | fn foo() -> impl for<'a> MyTrait<&'a str> {
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `MyTrait` is not general enough
   |
   = note: `impl MyTrait<&'2 str>` must implement `MyTrait<&'1 str>`, for any lifetime `'1`...
   = note: ...but it actually implements `MyTrait<&'2 str>`, for some specific lifetime `'2`

error: aborting due to previous error
```

To accomplish this, several different refactoring needed to be made:

* We now have a dedicated `InstantiateOpaqueType` struct which
implements `TypeOp`. This is used to invoke `instantiate_opaque_types`
during MIR type checking.
* `TypeOp` is refactored to pass around a `MirBorrowckCtxt`, which is
needed to report opaque type region errors.
* We no longer assume that all `TypeOp`s correspond to canonicalized
queries. This allows us to properly handle opaque type instantiation
(which does not occur in a query) as a `TypeOp`.
A new `ErrorInfo` associated type is used to determine what
additional information is used during higher-ranked region error
handling.
* The body of `try_extract_error_from_fulfill_cx`
has been moved out to a new function `try_extract_error_from_region_constraints`.
This allows us to re-use the same error reporting code between
canonicalized queries (which can extract region constraints directly
from a fresh `InferCtxt`) and opaque type handling (which needs to take
region constraints from the pre-existing `InferCtxt` that we use
throughout MIR borrow checking).

2 years agoAuto merge of #8404 - camsteffen:rm-ui-test, r=flip1995
bors [Wed, 9 Feb 2022 09:09:58 +0000 (09:09 +0000)]
Auto merge of #8404 - camsteffen:rm-ui-test, r=flip1995

Factor out ui_test suite

changelog: none

2 years agoAuto merge of #93795 - JohnTitor:rollup-n0dmsoo, r=JohnTitor
bors [Wed, 9 Feb 2022 06:54:16 +0000 (06:54 +0000)]
Auto merge of #93795 - JohnTitor:rollup-n0dmsoo, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #93445 (Add From<u8> for ExitCode)
 - #93694 (rustdoc: tweak line spacing and paragraph spacing for accessibility)
 - #93735 (Stabilize int_abs_diff in 1.60.0.)
 - #93746 (Remove defaultness from ImplItem.)
 - #93748 (rustc_query_impl: reduce visibility of some modules/fn's)
 - #93751 (Drop tracking: track borrows of projections)
 - #93781 (update `ty::TyKind` documentation)

Failed merges:

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

2 years agoRollup merge of #93781 - lcnr:ty-kind-docs, r=jackh726
Yuki Okushi [Wed, 9 Feb 2022 05:12:25 +0000 (14:12 +0900)]
Rollup merge of #93781 - lcnr:ty-kind-docs, r=jackh726

update `ty::TyKind` documentation

slightly unsure about `ty::Opaque` and `ty::Bound`/`ty::Placeholder`.

r? `@jackh726` `@nikomatsakis` `@oli-obk`

2 years agoRollup merge of #93751 - eholk:issue-93648-drop-tracking-projection, r=tmiasko
Yuki Okushi [Wed, 9 Feb 2022 05:12:24 +0000 (14:12 +0900)]
Rollup merge of #93751 - eholk:issue-93648-drop-tracking-projection, r=tmiasko

Drop tracking: track borrows of projections

Previous efforts to ignore partially consumed values meant we were also not considering borrows of a projection. This led to cases where we'd miss borrowed types which MIR expected to be there, leading to ICEs.

This PR also includes the `-Zdrop-tracking` flag from #93313. If that PR lands first, I'll rebase to drop the commit from this one.

Fixes #93648

2 years agoRollup merge of #93748 - klensy:vis-r, r=cjgillot
Yuki Okushi [Wed, 9 Feb 2022 05:12:23 +0000 (14:12 +0900)]
Rollup merge of #93748 - klensy:vis-r, r=cjgillot

rustc_query_impl: reduce visibility of some modules/fn's

Locally this reduces number of exported functions from 15221 -> 14952 and size a little.

Perf run please?

2 years agoRollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis
Yuki Okushi [Wed, 9 Feb 2022 05:12:22 +0000 (14:12 +0900)]
Rollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis

Remove defaultness from ImplItem.

This information is not really used anywhere, except HIR pretty-printing. This makes ImplItem and TraitItem more similar.

2 years agoRollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis
Yuki Okushi [Wed, 9 Feb 2022 05:12:22 +0000 (14:12 +0900)]
Rollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis

Remove defaultness from ImplItem.

This information is not really used anywhere, except HIR pretty-printing. This makes ImplItem and TraitItem more similar.

2 years agoRollup merge of #93735 - m-ou-se:stabilize-int-abs-diff, r=joshtriplett
Yuki Okushi [Wed, 9 Feb 2022 05:12:21 +0000 (14:12 +0900)]
Rollup merge of #93735 - m-ou-se:stabilize-int-abs-diff, r=joshtriplett

Stabilize int_abs_diff in 1.60.0.

FCP finished here: https://github.com/rust-lang/rust/issues/89492#issuecomment-1030694522

2 years agoRollup merge of #93694 - jsha:font-sizes-spacing, r=GuillaumeGomez
Yuki Okushi [Wed, 9 Feb 2022 05:12:18 +0000 (14:12 +0900)]
Rollup merge of #93694 - jsha:font-sizes-spacing, r=GuillaumeGomez

rustdoc: tweak line spacing and paragraph spacing for accessibility

The [W3C Web Content Accessibility Guidelines](https://www.w3.org/WAI/WCAG21/Understanding/visual-presentation.html) specify a minimum line spacing of 1.5 and a minimum paragraph spacing of 1.5 times the line spacing. Our current line spacing (implemented by line-height) is 1.4, so it's a small bump to go up to 1.5. Similarly, we have a paragraph spacing of 0.6em. Bump that to 0.75em (which is 1.5 times the 0.5em distance between lines).

Also, fix all the font sizes so instead of being round-ish numbers in rem (like 1.1rem, 1.2rem), they are round numbers in pixels: 16px, 18px, 20px, 22px, 24px. Ensure each font size is at least 2 pixels different than the nearest other font size, so distinctions can be clearly seen. Overall the font-sizes are mostly staying the same, being rounded up or down as appropriate. This will make reasoning about consistent layout sizes much easier.

Remove a few unused styles.

Simplify the display of the mobile-topbar location, by setting its margins to auto rather than trying to size it exactly to the topbar.

Part of #59845.

Demo: https://rustdoc.crud.net/jsha/font-sizes-spacing/std/string/struct.String.html

r? `@GuillaumeGomez`

2 years agoRollup merge of #93445 - yaahc:exitcode-constructor, r=dtolnay
Yuki Okushi [Wed, 9 Feb 2022 05:12:17 +0000 (14:12 +0900)]
Rollup merge of #93445 - yaahc:exitcode-constructor, r=dtolnay

Add From<u8> for ExitCode

This should cover a mostly cross-platform subset of supported exit codes.

We decided to stick with `u8` initially since its the common subset between all platforms that we support (excluding wasm which I think only works with `true` or `false`). Posix is supposed to take i32s, but in practice many unix platforms mask out all but the low 8 bits or in some cases the 8-15th bits. Windows takes a u32 instead of an i32. Bourne-compatible shells also report signals as exitcode 128 + `signal_no`, so there's some ambiguity there when returning exit codes > 127, but it is possible to disambiguate them on the other side so we decided against restricting the possible codes further than to `u8`.

## Related

- Detailed analysis of exit code support on various platforms: https://internals.rust-lang.org/t/mini-pre-rfc-redesigning-process-exitstatus/5426
- https://github.com/rust-lang/rust/issues/48711
- https://github.com/rust-lang/rust/issues/43301
- https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Termination.2FExit.20Status.20Stabilization

2 years agoAuto merge of #93793 - ehuss:update-cargo, r=ehuss
bors [Wed, 9 Feb 2022 04:05:55 +0000 (04:05 +0000)]
Auto merge of #93793 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 25fcb135d02ea897ce894b67ae021f48107d522b..c082648646cbb2be266df9ecbcdc253058158d68
2022-02-01 01:32:48 +0000 to 2022-02-08 14:55:05 +0000
- Add rustup link (rust-lang/cargo#10371)
- Improve startup time of bash completion. (rust-lang/cargo#10365)
- Stabilize `-Ztimings` as `--timings` (rust-lang/cargo#10245)
- Remove needless borrow (rust-lang/cargo#10360)
- Compute non custom build and non transitive deps for doc (rust-lang/cargo#10341)

2 years agoUpdate cargo
Eric Huss [Wed, 9 Feb 2022 02:55:23 +0000 (18:55 -0800)]
Update cargo

2 years agoAuto merge of #93778 - matthiaskrgr:rollup-yfngdao, r=matthiaskrgr
bors [Wed, 9 Feb 2022 01:18:06 +0000 (01:18 +0000)]
Auto merge of #93778 - matthiaskrgr:rollup-yfngdao, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91950 (Point at type when a `static` `#[global_allocator]` doesn't `impl` `GlobalAlloc`)
 - #92715 (Do not suggest char literal for zero-length strings)
 - #92917 (Don't constrain projection predicates with inference vars in GAT substs)
 - #93206 (Use `NtCreateFile` instead of `NtOpenFile` to open a file)
 - #93732 (add fut/back compat tests for implied trait bounds)
 - #93764 (:arrow_up: rust-analyzer)
 - #93767 (deduplicate `lcnr` in mailmap)

Failed merges:

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

2 years agoSwitch QueryJobId to a single global counter
Mark Rousskov [Mon, 7 Feb 2022 16:03:51 +0000 (11:03 -0500)]
Switch QueryJobId to a single global counter

This replaces the per-shard counters with a single global counter, simplifying
the JobId struct down to just a u64 and removing the need to pipe a DepKind
generic through a bunch of code. The performance implications on non-parallel
compilers are likely minimal (this switches to `Cell<u64>` as the backing
storage over a `u64`, but the latter was already inside a `RefCell` so it's not
really a significance divergence). On parallel compilers, the cost of a single
global u64 counter may be more significant: it adds a serialization point in
theory. On the other hand, we can imagine changing the counter to have a
thread-local component if it becomes worrisome or some similar structure.

The new design is sufficiently simpler that it warrants the potential for slight
changes down the line if/when we get parallel compilation to be more of a
default.

A u64 counter, instead of u32 (the old per-shard width), is chosen to avoid
possibly overflowing it and causing problems; it is effectively impossible that
we would overflow a u64 counter in this context.

2 years agoadd more tests and make used(linker/compiler) mutually exclusive
cynecx [Tue, 8 Feb 2022 22:51:17 +0000 (23:51 +0100)]
add more tests and make used(linker/compiler) mutually exclusive

2 years agoAuto merge of #93783 - oli-obk:lazy_tait_regression_fix, r=jackh726
bors [Tue, 8 Feb 2022 22:33:05 +0000 (22:33 +0000)]
Auto merge of #93783 - oli-obk:lazy_tait_regression_fix, r=jackh726

Fix regression from lazy opaque types

The breakage was found in https://github.com/rust-lang/rust/pull/92007#issuecomment-1032203011 and has not hit nightly yet.

2 years agoFactor out ui_test suite
Cameron Steffen [Tue, 8 Feb 2022 16:45:52 +0000 (10:45 -0600)]
Factor out ui_test suite

2 years agoAuto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen
bors [Tue, 8 Feb 2022 20:50:41 +0000 (20:50 +0000)]
Auto merge of #8374 - Alexendoo:bless-revisions, r=camsteffen

Support `cargo dev bless` for tests with revisions

changelog: internal: Support `cargo dev bless` for tests with revisions

Previously bless wouldn't pick up the saved stderr from `target/debug/tests/manual_assert.stage-id.edition2021.stderr` or `target/debug/tests/manual_assert.stage-id.edition2018.stderr` due to there being multiple revisions of the test output

This tweaks compile-test so the built files end up in e.g. `target/debug/tests/ui`, `target/debug/tests/ui-cargo` rather than share the `tests` dir. `cargo dev bless` then uses that to update all the `.stdout/stdout/fixed` files it can find

Also removes an empty file I found, and the logic to remove empty outputs as compiletest doesn't produce empty `.stdout/stderr` files

2 years agoImprove opaque type higher-ranked region error message under NLL
Aaron Hill [Sun, 19 Dec 2021 00:06:53 +0000 (19:06 -0500)]
Improve opaque type higher-ranked region error message under NLL

Currently, any higher-ranked region errors involving opaque types
fall back to a generic "higher-ranked subtype error" message when
run under NLL. This PR adds better error message handling for this
case, giving us the same kinds of error messages that we currently
get without NLL:

```
error: implementation of `MyTrait` is not general enough
  --> $DIR/opaque-hrtb.rs:12:13
   |
LL | fn foo() -> impl for<'a> MyTrait<&'a str> {
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `MyTrait` is not general enough
   |
   = note: `impl MyTrait<&'2 str>` must implement `MyTrait<&'1 str>`, for any lifetime `'1`...
   = note: ...but it actually implements `MyTrait<&'2 str>`, for some specific lifetime `'2`

error: aborting due to previous error
```

To accomplish this, several different refactoring needed to be made:

* We now have a dedicated `InstantiateOpaqueType` struct which
implements `TypeOp`. This is used to invoke `instantiate_opaque_types`
during MIR type checking.
* `TypeOp` is refactored to pass around a `MirBorrowckCtxt`, which is
needed to report opaque type region errors.
* We no longer assume that all `TypeOp`s correspond to canonicalized
queries. This allows us to properly handle opaque type instantiation
(which does not occur in a query) as a `TypeOp`.
A new `ErrorInfo` associated type is used to determine what
additional information is used during higher-ranked region error
handling.
* The body of `try_extract_error_from_fulfill_cx`
has been moved out to a new function `try_extract_error_from_region_constraints`.
This allows us to re-use the same error reporting code between
canonicalized queries (which can extract region constraints directly
from a fresh `InferCtxt`) and opaque type handling (which needs to take
region constraints from the pre-existing `InferCtxt` that we use
throughout MIR borrow checking).

2 years agoUpdate compiler/rustc_middle/src/ty/sty.rs
lcnr [Tue, 8 Feb 2022 17:11:59 +0000 (18:11 +0100)]
Update compiler/rustc_middle/src/ty/sty.rs

2 years agoUpdate compiler/rustc_middle/src/ty/sty.rs
lcnr [Tue, 8 Feb 2022 17:10:28 +0000 (18:10 +0100)]
Update compiler/rustc_middle/src/ty/sty.rs

Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2 years agoFix regression from lazy opaque types
Oli Scherer [Tue, 8 Feb 2022 16:47:24 +0000 (16:47 +0000)]
Fix regression from lazy opaque types

2 years agoupdate `ty::TyKind` documentation
lcnr [Tue, 8 Feb 2022 16:09:18 +0000 (17:09 +0100)]
update `ty::TyKind` documentation

2 years agoRollup merge of #93767 - lcnr:mailmap, r=Mark-Simulacrum
Matthias Krüger [Tue, 8 Feb 2022 15:40:51 +0000 (16:40 +0100)]
Rollup merge of #93767 - lcnr:mailmap, r=Mark-Simulacrum

deduplicate `lcnr` in mailmap

2 years agoRollup merge of #93764 - lnicola:rust-analyzer-2022-02-08, r=lnicola
Matthias Krüger [Tue, 8 Feb 2022 15:40:51 +0000 (16:40 +0100)]
Rollup merge of #93764 - lnicola:rust-analyzer-2022-02-08, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #93732 - lcnr:hrlt-backcompa, r=Mark-Simulacrum
Matthias Krüger [Tue, 8 Feb 2022 15:40:50 +0000 (16:40 +0100)]
Rollup merge of #93732 - lcnr:hrlt-backcompa, r=Mark-Simulacrum

add fut/back compat tests for implied trait bounds

the `guard` test was tested to cause a segfault with `-Zchalk`, very nice

cc ``@nikomatsakis`` #44491 #25860

2 years agoRollup merge of #93206 - ChrisDenton:ntopenfile, r=nagisa
Matthias Krüger [Tue, 8 Feb 2022 15:40:49 +0000 (16:40 +0100)]
Rollup merge of #93206 - ChrisDenton:ntopenfile, r=nagisa

Use `NtCreateFile` instead of `NtOpenFile` to open a file

Generally the internal `Nt*` functions should be avoided but when we do need to use one we should stick to the most commonly used for the job. To that end, this PR replaces `NtOpenFile` with `NtCreateFile`.

NOTE: The initial version of this comment hypothesised that this may help with some recent false positives from malware scanners. This hypothesis proved wrong. Sorry for the distraction.

2 years agoRollup merge of #92917 - jackh726:issue-91762-2, r=nikomatsakis
Matthias Krüger [Tue, 8 Feb 2022 15:40:48 +0000 (16:40 +0100)]
Rollup merge of #92917 - jackh726:issue-91762-2, r=nikomatsakis

Don't constrain projection predicates with inference vars in GAT substs

cc #91762

Not a fix, but a mitigation to prevent a backwards-compatible hazard where we normalize using a predicate only because it's the only one available, but shouldn't. This would constrain an inference variable which didn't really want. We already do this when selecting a projection candidate, which isn't always correct. But changing that is a problem for a different day.

Also found out that a suggestion for `await`ing a future was using the wrong substs.

r? ``@nikomatsakis``

2 years agoRollup merge of #92715 - chordtoll:empty-string, r=davidtwco
Matthias Krüger [Tue, 8 Feb 2022 15:40:47 +0000 (16:40 +0100)]
Rollup merge of #92715 - chordtoll:empty-string, r=davidtwco

Do not suggest char literal for zero-length strings

PR #92507 adds a hint to switch to single quotes when a char is expected and a single-character string literal is provided.

The check to ensure the string literal is one character long missed the 0-char case, and would incorrectly offer the hint.

This PR adds the missing check, and a test case to confirm the new behavior.

2 years agoRollup merge of #91950 - estebank:point-at-type-of-non-allocator, r=matthewjasper
Matthias Krüger [Tue, 8 Feb 2022 15:40:45 +0000 (16:40 +0100)]
Rollup merge of #91950 - estebank:point-at-type-of-non-allocator, r=matthewjasper

Point at type when a `static` `#[global_allocator]` doesn't `impl` `GlobalAlloc`

2 years agodebuginfo: Bring back DW_AT_containing_type for vtables -- address review comments
Michael Woerister [Tue, 8 Feb 2022 14:31:09 +0000 (15:31 +0100)]
debuginfo: Bring back DW_AT_containing_type for vtables -- address review comments

2 years agoAuto merge of #93572 - scottmcm:generic-iter-process, r=yaahc
bors [Tue, 8 Feb 2022 13:41:40 +0000 (13:41 +0000)]
Auto merge of #93572 - scottmcm:generic-iter-process, r=yaahc

Change `ResultShunt` to be generic over `Try`

Just a refactor (and rename) for now, so it's not `Result`-specific.

This could be used for a future `Iterator::try_collect`, or similar, but anything like that is left for a future PR.