]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #99131 - compiler-errors:label-fn, r=cjgillot
Dylan DPC [Fri, 15 Jul 2022 05:09:43 +0000 (10:39 +0530)]
Rollup merge of #99131 - compiler-errors:label-fn, r=cjgillot

Add label for generic arg (+ APIT) and RPIT callables in `label_fn_like`

Fixes #98308

2 years agoRollup merge of #99113 - WaffleLapkin:arc_simplify, r=Mark-Simulacrum
Dylan DPC [Fri, 15 Jul 2022 05:09:41 +0000 (10:39 +0530)]
Rollup merge of #99113 - WaffleLapkin:arc_simplify, r=Mark-Simulacrum

Simplify [a]rc code a little

Nothing interesting, just make [a]rc code a little nicer by using `byte_sub` and `let`-`else`.

2 years agoAuto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, r=cjgillot
bors [Fri, 15 Jul 2022 01:03:55 +0000 (01:03 +0000)]
Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, r=cjgillot

gather body owners

Issue #96341

2 years agoPoint out custom Fn-family trait impl
Michael Goulet [Wed, 13 Jul 2022 05:39:01 +0000 (05:39 +0000)]
Point out custom Fn-family trait impl

2 years agoAdd support for APIT and RPIT callables in label_fn_like
Michael Goulet [Sun, 10 Jul 2022 21:59:31 +0000 (21:59 +0000)]
Add support for APIT and RPIT callables in label_fn_like

2 years agoAuto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillot
bors [Thu, 14 Jul 2022 21:50:14 +0000 (21:50 +0000)]
Auto merge of #96544 - m-ysk:feature/issue-96358, r=cjgillot

Stop keeping metadata in memory before writing it to disk

Fixes #96358

I created this PR according with the instruction given in the issue except for the following points:

- While the issue says "Write metadata into the temporary file in `encode_and_write_metadata` even if `!need_metadata_file`", I could not do that. That is because though I tried to do that and run `x.py test`, I got a lot of test failures as follows.

<details>
<summary>List of failed tests</summary>
<pre>
<code>
failures:
    [ui] src/test/ui/json-multiple.rs
    [ui] src/test/ui/json-options.rs
    [ui] src/test/ui/rmeta/rmeta-rpass.rs
    [ui] src/test/ui/save-analysis/emit-notifications.rs
    [ui] src/test/ui/svh/changing-crates.rs
    [ui] src/test/ui/svh/svh-change-lit.rs
    [ui] src/test/ui/svh/svh-change-significant-cfg.rs
    [ui] src/test/ui/svh/svh-change-trait-bound.rs
    [ui] src/test/ui/svh/svh-change-type-arg.rs
    [ui] src/test/ui/svh/svh-change-type-ret.rs
    [ui] src/test/ui/svh/svh-change-type-static.rs
    [ui] src/test/ui/svh/svh-use-trait.rs

test result: FAILED. 12915 passed; 12 failed; 100 ignored; 0 measured; 0 filtered out; finished in 71.41s

Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
Build completed unsuccessfully in 0:01:58
</code>
</pre>
</details>

- I could not resolve the extra tasks about `create_rmeta_file` and `create_compressed_metadata_file` for my lack of ability.

2 years agoAuto merge of #99252 - lqd:win-dwarf5, r=eddyb
bors [Thu, 14 Jul 2022 19:03:58 +0000 (19:03 +0000)]
Auto merge of #99252 - lqd:win-dwarf5, r=eddyb

fix dwarf debuginfo being used in addition to CodeView on windows

Tackles the debuginfo size increase regression on windows to [unblock clippy](https://github.com/rust-lang/rust/issues/99143#issuecomment-1184638573) -- introduced by the DWARF5 support in #98350 cc `@pcwalton.`

r? `@eddyb`
Fixes #99143

2 years agofix dwarf debuginfo being used in addition to CodeView on windows
Rémy Rakic [Thu, 14 Jul 2022 18:41:55 +0000 (20:41 +0200)]
fix dwarf debuginfo being used in addition to CodeView on windows

Fixes the debuginfo size increase regression introduced by the DWARF5 support.

2 years agoAuto merge of #99242 - Dylan-DPC:rollup-34bqdh8, r=Dylan-DPC
bors [Thu, 14 Jul 2022 16:23:07 +0000 (16:23 +0000)]
Auto merge of #99242 - Dylan-DPC:rollup-34bqdh8, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #98072 (Add provider API to error trait)
 - #98580 (Emit warning when named arguments are used positionally in format)
 - #99000 (Move abstract const to middle)
 - #99192 (Fix spans for asm diagnostics)
 - #99222 (Better error message for generic_const_exprs inference failure)
 - #99236 (solaris: unbreak build on native platform)

Failed merges:

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

2 years agoRollup merge of #99236 - psumbera:Issue99208, r=Mark-Simulacrum
Dylan DPC [Thu, 14 Jul 2022 13:54:08 +0000 (19:24 +0530)]
Rollup merge of #99236 - psumbera:Issue99208, r=Mark-Simulacrum

solaris: unbreak build on native platform

Fixes: #99208
2 years agoRollup merge of #99222 - atsuzaki:generic_const_err, r=lcnr
Dylan DPC [Thu, 14 Jul 2022 13:54:06 +0000 (19:24 +0530)]
Rollup merge of #99222 - atsuzaki:generic_const_err, r=lcnr

Better error message for generic_const_exprs inference failure

Fixes #90531

This code:
```rs
#![feature(generic_const_exprs)]

fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {}

fn main() {
  let arr = [5; 5];
  foo(arr);
}
```

Will now emit the following error:
```rs
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> test.rs:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information

error[E0284]: type annotations needed
 --> test.rs:8:7
  |
8 |       foo(arr);
  |       ^^^ cannot infer the value of the const parameter `N` declared on the function `foo`
  |
note: required by a bound in `foo`
 --> test.rs:3:56
  |
3 | fn foo<const N: usize>(_arr: [u64; N + 1]) where [u64; N + 1]: {}
  |                                                        ^^^^^ required by this bound in `foo`
help: consider specifying the generic argument
  |
8 |       foo::<N>(arr);
  |          +++++

error: aborting due to previous error; 1 warning emitted
```

cc: `@lcnr` thanks a lot again for the help on this

2 years agoRollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkov
Dylan DPC [Thu, 14 Jul 2022 13:54:05 +0000 (19:24 +0530)]
Rollup merge of #99192 - Amanieu:fix-asm-srcloc, r=petrochenkov

Fix spans for asm diagnostics

Line spans were incorrect if the first line of an asm statement was an
empty string.

2 years agoRollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr
Dylan DPC [Thu, 14 Jul 2022 13:54:04 +0000 (19:24 +0530)]
Rollup merge of #99000 - JulianKnodt:allow_resolve_no_substs, r=lcnr

Move abstract const to middle

Moves AbstractConst (and all associated methods) to rustc middle for use in `rustc_infer`.
This allows for const resolution in infer to use abstract consts to walk consts and check if
they are resolvable.

This attempts to resolve the issue where `Foo<{ concrete const }, generic T>` is incorrectly marked as conflicting, and is independent from the other issue where nested abstract consts must be resolved.

r? `@lcnr`

2 years agoRollup merge of #98580 - PrestonFrom:issue_98466, r=estebank
Dylan DPC [Thu, 14 Jul 2022 13:54:03 +0000 (19:24 +0530)]
Rollup merge of #98580 - PrestonFrom:issue_98466, r=estebank

Emit warning when named arguments are used positionally in format

Addresses Issue 98466 by emitting an error if a named argument
is used like a position argument (i.e. the name is not used in
the string to be formatted).

Fixes rust-lang#98466

2 years agoRollup merge of #98072 - yaahc:generic-member-access, r=thomcc
Dylan DPC [Thu, 14 Jul 2022 13:54:02 +0000 (19:24 +0530)]
Rollup merge of #98072 - yaahc:generic-member-access, r=thomcc

Add provider API to error trait

Implements https://github.com/rust-lang/rfcs/pull/2895

2 years agoAuto merge of #95956 - yaahc:stable-in-unstable, r=cjgillot
bors [Thu, 14 Jul 2022 13:42:09 +0000 (13:42 +0000)]
Auto merge of #95956 - yaahc:stable-in-unstable, r=cjgillot

Support unstable moves via stable in unstable items

part of https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/moving.20items.20to.20core.20unstably and a blocker of https://github.com/rust-lang/rust/pull/90328.

The libs-api team needs the ability to move an already stable item to a new location unstably, in this case for Error in core. Otherwise these changes are insta-stable making them much harder to merge.

This PR attempts to solve the problem by checking the stability of path segments as well as the last item in the path itself, which is currently the only thing checked.

2 years agosolaris: unbreak build on native platform
Petr Sumbera [Thu, 14 Jul 2022 11:44:40 +0000 (13:44 +0200)]
solaris: unbreak build on native platform

Fixes: #99208
2 years agoAuto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC
bors [Thu, 14 Jul 2022 11:00:30 +0000 (11:00 +0000)]
Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #97720 (Always create elided lifetime parameters for functions)
 - #98315 (Stabilize `core::ffi:c_*` and rexport in `std::ffi`)
 - #98705 (Implement `for<>` lifetime binder for closures)
 - #99126 (remove allow(rustc::potential_query_instability) in rustc_span)
 - #99139 (Give a better error when `x dist` fails for an optional tool)

Failed merges:

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

2 years agoFix spans for asm diagnostics
Amanieu d'Antras [Tue, 12 Jul 2022 20:54:47 +0000 (22:54 +0200)]
Fix spans for asm diagnostics

Line spans were incorrect if the first line of an asm statement was an
empty string.

2 years agoFix overlapping impls
kadmin [Tue, 12 Jul 2022 07:11:05 +0000 (07:11 +0000)]
Fix overlapping impls

2 years agoRollup merge of #99139 - jyn514:dist-tool-help, r=Mark-Simulacrum
Dylan DPC [Thu, 14 Jul 2022 08:44:23 +0000 (14:14 +0530)]
Rollup merge of #99139 - jyn514:dist-tool-help, r=Mark-Simulacrum

Give a better error when `x dist` fails for an optional tool

Before:
```
thread 'main' panicked at 'Unable to build RLS', dist.rs:42:9
```

After:
```
thread 'main' panicked at 'Unable to build submodule tool RLS (use `missing-tools = true` to ignore this failure)
note: not all tools are available on all nightlies
help: see https://forge.rust-lang.org/infra/toolstate.html for more information', dist.rs:43:9
```

Closes https://github.com/rust-lang/rust/issues/85683 by explaining better why the error is expected.

2 years agoRollup merge of #99126 - NiklasJonsson:84447/rustc_span, r=petrochenkov
Dylan DPC [Thu, 14 Jul 2022 08:44:22 +0000 (14:14 +0530)]
Rollup merge of #99126 - NiklasJonsson:84447/rustc_span, r=petrochenkov

remove allow(rustc::potential_query_instability) in rustc_span

Also, avoid sorting before debug output as iteration order can now be
relied upon.

Related #84447

2 years agoRollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
Dylan DPC [Thu, 14 Jul 2022 08:44:21 +0000 (14:14 +0530)]
Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot

Implement `for<>` lifetime binder for closures

This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following:

```rust
let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) };
//       ^^^^^^^^^^^--- new!
```

cc ``@Aaron1011`` ``@cjgillot``

2 years agoRollup merge of #98315 - joshtriplett:stabilize-core-ffi-c, r=Mark-Simulacrum
Dylan DPC [Thu, 14 Jul 2022 08:44:20 +0000 (14:14 +0530)]
Rollup merge of #98315 - joshtriplett:stabilize-core-ffi-c, r=Mark-Simulacrum

Stabilize `core::ffi:c_*` and rexport in `std::ffi`

This only stabilizes the base types, not the non-zero variants, since
those have their own separate tracking issue and have not gone through
FCP to stabilize.

2 years agoRollup merge of #97720 - cjgillot:all-fresh, r=petrochenkov
Dylan DPC [Thu, 14 Jul 2022 08:44:19 +0000 (14:14 +0530)]
Rollup merge of #97720 - cjgillot:all-fresh, r=petrochenkov

Always create elided lifetime parameters for functions

Anonymous and elided lifetimes in functions are sometimes (async fns) --and sometimes not (regular fns)-- desugared to implicit generic parameters.

This difference of treatment makes it some downstream analyses more complicated to handle.  This step is a pre-requisite to perform lifetime elision resolution on AST.

There is currently an inconsistency in the treatment of argument-position impl-trait for functions and async fns:
```rust
trait Foo<'a> {}
fn foo(t: impl Foo<'_>) {} //~ ERROR missing lifetime specifier
async fn async_foo(t: impl Foo<'_>) {} //~ OK
fn bar(t: impl Iterator<Item = &'_ u8>) {} //~ ERROR missing lifetime specifier
async fn async_bar(t: impl Iterator<Item = &'_ u8>) {} //~ OK
```

The current implementation reports "missing lifetime specifier" on `foo`, but **accepts it** in `async_foo`.
This PR **proposes to accept** the anonymous lifetime in both cases as an extra generic lifetime parameter.
This change would be insta-stable, so let's ping t-lang.
Anonymous lifetimes in GAT bindings keep being forbidden:
```rust
fn foo(t: impl Foo<Assoc<'_> = Bar<'_>>) {}
                         ^^        ^^
                       forbidden   ok
```
I started a discussion here: https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Anonymous.20lifetimes.20in.20universal.20impl-trait/near/284968606

r? ``@petrochenkov``

2 years agoAuto merge of #98975 - jyn514:unstable_opts, r=wesleywiser
bors [Thu, 14 Jul 2022 08:14:31 +0000 (08:14 +0000)]
Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiser

Rename `debugging_opts` to `unstable_opts`

This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.

cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Codegen.20options.20.2F.20debugging.20options

r? `@Amanieu` cc `@nikic` `@joshtriplett`

2 years agoAuto merge of #99225 - ehuss:update-cargo, r=ehuss
bors [Thu, 14 Jul 2022 05:07:22 +0000 (05:07 +0000)]
Auto merge of #99225 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in b1dd22e668af5279e13a071ad4b17435bd6bfa4c..8827baaa781b37872134c1ba692a6f0aeb37890e
2022-07-09 14:48:50 +0000 to 2022-07-14 02:56:51 +0000
- Add a test for regressions in selecting the correct workspace root (rust-lang/cargo#10862)
- clarify profile used for 'cargo install --debug' (rust-lang/cargo#10861)
- servers should use 404 (rust-lang/cargo#10860)
- test(add): Ensure comments are preserved (rust-lang/cargo#10849)
- Fix nested workspace resolution (rust-lang/cargo#10846)
- Small tweaks to the future-incompat docs. (rust-lang/cargo#10856)
- Fixed extra period typo (rust-lang/cargo#10847)

2 years agoUpdate cargo
Eric Huss [Thu, 14 Jul 2022 04:25:48 +0000 (21:25 -0700)]
Update cargo

2 years agoStabilize `core::ffi:c_*` and rexport in `std::ffi`
Josh Triplett [Mon, 20 Jun 2022 20:59:58 +0000 (13:59 -0700)]
Stabilize `core::ffi:c_*` and rexport in `std::ffi`

This only stabilizes the base types, not the non-zero variants, since
those have their own separate tracking issue and have not gone through
FCP to stabilize.

2 years agoAuto merge of #98754 - jyn514:non-trivial-drop, r=compiler-errors
bors [Thu, 14 Jul 2022 02:22:48 +0000 (02:22 +0000)]
Auto merge of #98754 - jyn514:non-trivial-drop, r=compiler-errors

Fix drop-tracking ICE when a struct containing a field with a significant drop is used across an await

Previously, drop-tracking would incorrectly assume the struct would be dropped immediately, which was not true.

Fixes #98476. Also fixes https://github.com/rust-lang/rust/issues/98477, I think because the parent HIR node for type variables is the whole function instead of the expression where the variable is used.

r? `@eholk`

2 years agoUpdate tests
Katherine Philip [Thu, 14 Jul 2022 00:28:11 +0000 (17:28 -0700)]
Update tests

2 years agoAuto merge of #97995 - RalfJung:union-more-nodrop, r=Mark-Simulacrum
bors [Wed, 13 Jul 2022 23:42:05 +0000 (23:42 +0000)]
Auto merge of #97995 - RalfJung:union-more-nodrop, r=Mark-Simulacrum

allow unions with mutable references and tuples of allowed types

We currently allow shared references in unions, but not mutable references. That seems somewhat inconsistent. So let's allow all references, and while we are at it, let's make sure the set of allowed types is closed under tuples.

This will need T-lang FCP (at least).

Then remove the `tagged_unions` feature, since we do not plan to stabilize any more of it.
Closes https://github.com/rust-lang/rust/issues/55149

2 years agoRemove predicate note
Katherine Philip [Wed, 13 Jul 2022 17:27:19 +0000 (10:27 -0700)]
Remove predicate note

2 years agoAdd checks & fallback branch
Katherine Philip [Wed, 13 Jul 2022 17:25:58 +0000 (10:25 -0700)]
Add checks & fallback branch

2 years agoUse emit_inference_failure_err for ConstEvaluatable predicates
Katherine Philip [Wed, 13 Jul 2022 16:42:25 +0000 (09:42 -0700)]
Use emit_inference_failure_err for ConstEvaluatable predicates

2 years agoRename `debugging_opts` to `unstable_opts`
Joshua Nelson [Wed, 6 Jul 2022 12:44:47 +0000 (07:44 -0500)]
Rename `debugging_opts` to `unstable_opts`

This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.

2 years agoadd array tests, cleanup, tidy, and bless
Ralf Jung [Thu, 30 Jun 2022 14:17:49 +0000 (10:17 -0400)]
add array tests, cleanup, tidy, and bless

2 years agoassigning to a union field can never drop now
Ralf Jung [Thu, 30 Jun 2022 12:40:06 +0000 (08:40 -0400)]
assigning to a union field can never drop now

2 years agoremove untagged_union feature gate
Ralf Jung [Thu, 30 Jun 2022 02:33:18 +0000 (22:33 -0400)]
remove untagged_union feature gate

2 years agoalso allow arrays of allowed types
Ralf Jung [Sun, 19 Jun 2022 16:57:07 +0000 (09:57 -0700)]
also allow arrays of allowed types

2 years agoallow unions with mutable references and tuples of allowed types
Ralf Jung [Sat, 11 Jun 2022 05:12:57 +0000 (22:12 -0700)]
allow unions with mutable references and tuples of allowed types

2 years agofactor 'is this type allowed as union field on stable' into separate function
Ralf Jung [Sat, 11 Jun 2022 04:44:57 +0000 (21:44 -0700)]
factor 'is this type allowed as union field on stable' into separate function

2 years agoEmit warning when named arguments are used positionally in format
Preston From [Sat, 25 Jun 2022 05:52:13 +0000 (23:52 -0600)]
Emit warning when named arguments are used positionally in format

Addresses Issue 98466 by emitting a warning if a named argument
is used like a position argument (i.e. the name is not used in
the string to be formatted).

Fixes rust-lang#98466

2 years agoAuto merge of #99136 - CAD97:layout-faster, r=scottmcm
bors [Wed, 13 Jul 2022 21:01:20 +0000 (21:01 +0000)]
Auto merge of #99136 - CAD97:layout-faster, r=scottmcm

Take advantage of known-valid-align in layout.rs

An attempt to improve perf by `@nnethercote's` approach suggested in #99117

2 years agocollect module item-likes in visit_items
Miguel Guarniz [Wed, 13 Jul 2022 17:25:53 +0000 (13:25 -0400)]
collect module item-likes in visit_items

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoreduce scope of allow(rustc::potential_query_instability) in rustc_span
Niklas Jonsson [Sun, 10 Jul 2022 20:59:06 +0000 (22:59 +0200)]
reduce scope of allow(rustc::potential_query_instability) in rustc_span

2 years agoAuto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPC
bors [Wed, 13 Jul 2022 17:13:27 +0000 (17:13 +0000)]
Auto merge of #99210 - Dylan-DPC:rollup-879cp1t, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #98574 (Lower let-else in MIR)
 - #99011 (`UnsafeCell` blocks niches inside its nested type from being available outside)
 - #99030 (diagnostics: error messages when struct literals fail to parse)
 - #99155 (Keep unstable target features for asm feature checking)
 - #99199 (Refactor: remove an unnecessary `span_to_snippet`)

Failed merges:

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

2 years agomerge visitors in queries
Miguel Guarniz [Wed, 6 Jul 2022 23:13:49 +0000 (19:13 -0400)]
merge visitors in queries

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoinline associated_body
Miguel Guarniz [Wed, 6 Jul 2022 22:23:38 +0000 (18:23 -0400)]
inline associated_body

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agouse gathered body_owners in par_body_owners
Miguel Guarniz [Wed, 22 Jun 2022 23:12:18 +0000 (19:12 -0400)]
use gathered body_owners in par_body_owners

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoAuto merge of #98145 - ouz-a:some_branch, r=oli-obk
bors [Wed, 13 Jul 2022 14:32:33 +0000 (14:32 +0000)]
Auto merge of #98145 - ouz-a:some_branch, r=oli-obk

Pull Derefer before ElaborateDrops

_Follow up work to #97025 #96549 #96116 #95887 #95649_

This moves `Derefer` before `ElaborateDrops` and creates a new `Rvalue` called `VirtualRef` that allows us to bypass many constraints for `DerefTemp`.

r? `@oli-obk`

2 years agoRollup merge of #99199 - TaKO8Ki:remove-unnecessary-span-to-snippet, r=cjgillot
Dylan DPC [Wed, 13 Jul 2022 14:02:37 +0000 (19:32 +0530)]
Rollup merge of #99199 - TaKO8Ki:remove-unnecessary-span-to-snippet, r=cjgillot

Refactor: remove an unnecessary `span_to_snippet`

`span_suggestion_hidden` does not show the suggested code and the suggestion is used just for rustfix, so `span_to_snippet` is unnecessary here.

2 years agoRollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwco
Dylan DPC [Wed, 13 Jul 2022 14:02:36 +0000 (19:32 +0530)]
Rollup merge of #99155 - Amanieu:unstable-target-features, r=davidtwco

Keep unstable target features for asm feature checking

Inline assembly uses the target features to determine which registers
are available on the current target. However it needs to be able to
access unstable target features for this.

Fixes #99071

2 years agoRollup merge of #99030 - rust-lang:notriddle/field-recovery, r=petrochenkov
Dylan DPC [Wed, 13 Jul 2022 14:02:35 +0000 (19:32 +0530)]
Rollup merge of #99030 - rust-lang:notriddle/field-recovery, r=petrochenkov

diagnostics: error messages when struct literals fail to parse

If an expression is supplied where a field is expected, the parser can become convinced that it's a shorthand field syntax when it's not.

This PR addresses it by explicitly recording the permitted `:` token immediately after the identifier, and also adds a suggestion to insert the name of the field if it looks like a complex expression.

Fixes #98917

2 years agoRollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb
Dylan DPC [Wed, 13 Jul 2022 14:02:34 +0000 (19:32 +0530)]
Rollup merge of #99011 - oli-obk:UnsoundCell, r=eddyb

`UnsafeCell` blocks niches inside its nested type from being available outside

fixes #87341

This implements the plan by `@eddyb` in https://github.com/rust-lang/rust/issues/87341#issuecomment-886083646

Somewhat related PR (not strictly necessary, but that cleanup made this PR simpler): #94527

2 years agoRollup merge of #98574 - dingxiangfei2009:let-else-thir, r=oli-obk
Dylan DPC [Wed, 13 Jul 2022 14:02:33 +0000 (19:32 +0530)]
Rollup merge of #98574 - dingxiangfei2009:let-else-thir, r=oli-obk

Lower let-else in MIR

This MR will switch to lower let-else statements in MIR building instead.

To lower let-else in MIR, we build a mini-switch two branches. One branch leads to the matching case, and the other leads to the `else` block. This arrangement will allow temporary lifetime analysis running as-is so that the temporaries are properly extended according to the same rule applied to regular `let` statements.

cc https://github.com/rust-lang/rust/issues/87335

Fix #98672

2 years agoAdd feature gate.
Camille GILLOT [Wed, 22 Jun 2022 20:19:02 +0000 (22:19 +0200)]
Add feature gate.

2 years agoBless ui-fulldeps tests.
Camille GILLOT [Sat, 4 Jun 2022 20:50:19 +0000 (22:50 +0200)]
Bless ui-fulldeps tests.

2 years agoClippy fallout.
Camille GILLOT [Sat, 4 Jun 2022 12:17:00 +0000 (14:17 +0200)]
Clippy fallout.

2 years agoAlways use CreateParameter mode for function definitions.
Camille GILLOT [Sun, 19 Jun 2022 20:57:05 +0000 (22:57 +0200)]
Always use CreateParameter mode for function definitions.

2 years agoAuto merge of #99203 - GuillaumeGomez:rollup-b2re0dv, r=GuillaumeGomez
bors [Wed, 13 Jul 2022 11:10:51 +0000 (11:10 +0000)]
Auto merge of #99203 - GuillaumeGomez:rollup-b2re0dv, r=GuillaumeGomez

Rollup of 10 pull requests

Successful merges:

 - #98789 (rustdoc-json-types: Clean up derives.)
 - #98848 (Build the Clippy book as part of x.py doc)
 - #99020 (check non_exhaustive attr and private fields for transparent types)
 - #99132 (Add some autolabels for A-bootstrap and T-infra)
 - #99148 (Clarify that [iu]size bounds were only defined for the target arch)
 - #99152 (Use CSS variables to handle theming (part 2))
 - #99168 (Add regression test for #74713)
 - #99176 (:arrow_up: rust-analyzer)
 - #99183 (Mention rust-analyzer maintainers when `proc_macro` bridge is changed)
 - #99185 (llvm-wrapper: adapt for LLVM API change)

Failed merges:

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

2 years agoLimit test to x86 targets for reproducability
Oli Scherer [Wed, 13 Jul 2022 10:11:35 +0000 (10:11 +0000)]
Limit test to x86 targets for reproducability

2 years agoRollup merge of #99185 - krasimirgg:llvm-wrapper-inlineasm, r=nikic
Guillaume Gomez [Wed, 13 Jul 2022 08:38:50 +0000 (10:38 +0200)]
Rollup merge of #99185 - krasimirgg:llvm-wrapper-inlineasm, r=nikic

llvm-wrapper: adapt for LLVM API change

This adapts RustWrapper's ` LLVMRustInlineAsmVerify` for LLVM commit https://github.com/llvm/llvm-project/commit/00797b88e0113aeea03045b18b3f63332f850dfe.

2 years agoRollup merge of #99183 - jonas-schievink:proc_macro-mention-r-a, r=jyn514
Guillaume Gomez [Wed, 13 Jul 2022 08:38:49 +0000 (10:38 +0200)]
Rollup merge of #99183 - jonas-schievink:proc_macro-mention-r-a, r=jyn514

Mention rust-analyzer maintainers when `proc_macro` bridge is changed

rust-analyzer vendors a modified copy of the `proc_macro` crate in order to expand procedural macros built by Cargo. Since the ABI used by proc macros can change, we need to follow along with those changes. Getting notified when the proc macro bridge changes should make that easier, since that's what defines the ABI.

cc ```@rust-lang/wg-rls-2```

2 years agoRollup merge of #99176 - lnicola:rust-analyzer-2022-07-12, r=lnicola
Guillaume Gomez [Wed, 13 Jul 2022 08:38:48 +0000 (10:38 +0200)]
Rollup merge of #99176 - lnicola:rust-analyzer-2022-07-12, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #99168 - TaKO8Ki:add-regression-test-for-74713, r=Dylan-DPC
Guillaume Gomez [Wed, 13 Jul 2022 08:38:47 +0000 (10:38 +0200)]
Rollup merge of #99168 - TaKO8Ki:add-regression-test-for-74713, r=Dylan-DPC

Add regression test for #74713

closes #74713

2 years agoRollup merge of #99152 - GuillaumeGomez:css-theme-var, r=jsha
Guillaume Gomez [Wed, 13 Jul 2022 08:38:46 +0000 (10:38 +0200)]
Rollup merge of #99152 - GuillaumeGomez:css-theme-var, r=jsha

Use CSS variables to handle theming (part 2)

Follow-up of https://github.com/rust-lang/rust/pull/98460.

As usual, there shouldn't be any UI change.

You can test it [here](https://rustdoc.crud.net/imperio/css-theme-var/bar/index.html).

r? `@jsha`

2 years agoRollup merge of #99148 - SOF3:clarify-xsize-bound, r=scottmcm
Guillaume Gomez [Wed, 13 Jul 2022 08:38:45 +0000 (10:38 +0200)]
Rollup merge of #99148 - SOF3:clarify-xsize-bound, r=scottmcm

Clarify that [iu]size bounds were only defined for the target arch

2 years agoRollup merge of #99132 - jyn514:autolabel, r=Mark-Simulacrum
Guillaume Gomez [Wed, 13 Jul 2022 08:38:44 +0000 (10:38 +0200)]
Rollup merge of #99132 - jyn514:autolabel, r=Mark-Simulacrum

Add some autolabels for A-bootstrap and T-infra

2 years agoRollup merge of #99020 - fee1-dead-contrib:repr_transparent_non_exhaustive, r=oli-obk
Guillaume Gomez [Wed, 13 Jul 2022 08:38:43 +0000 (10:38 +0200)]
Rollup merge of #99020 - fee1-dead-contrib:repr_transparent_non_exhaustive, r=oli-obk

check non_exhaustive attr and private fields for transparent types

Fixes #78586.

2 years agoRollup merge of #98848 - flip1995:clippy-book, r=jyn514
Guillaume Gomez [Wed, 13 Jul 2022 08:38:42 +0000 (10:38 +0200)]
Rollup merge of #98848 - flip1995:clippy-book, r=jyn514

Build the Clippy book as part of x.py doc

r? ``@ehuss`` since you said you would be interested in helping moving this forward.

cc ``@jyn514`` as part of the bootstrap team.

2 years agoRollup merge of #98789 - aDotInTheVoid:rjdt-derives, r=jsha
Guillaume Gomez [Wed, 13 Jul 2022 08:38:41 +0000 (10:38 +0200)]
Rollup merge of #98789 - aDotInTheVoid:rjdt-derives, r=jsha

rustdoc-json-types: Clean up derives.

Closes #96189

Everything is `Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize` except `Crate` and `Item` which arn't `Hash`, as they have `HashMap`'s. See linked issue for reasoning.

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

2 years agoAuto merge of #99066 - est31:remove_box_librustdoc, r=jsha
bors [Wed, 13 Jul 2022 08:29:57 +0000 (08:29 +0000)]
Auto merge of #99066 - est31:remove_box_librustdoc, r=jsha

Remove most box syntax from librustdoc

This is the second attempt after the librustdoc specific changes have been reverted from #87781 in #89134, due to a minor, but exant regression caused by the changes. ~~There have been some changes to librustdoc in the past and maybe thanks to them there is no regression any more. If there is still a regression, one can investigate further and maybe find ways to fix the regressions. Thus, i request a perf run.~~ Edit: turns out there is still a regression, but it's caused only by a subset of the changes. So I've changed this PR to only contains the changes that don't cause any performance regressions, keeping the regression causing changes for a later PR.

2 years agoAuto merge of #99149 - ferrocene:pa-nightly-branch, r=Mark-Simulacrum
bors [Wed, 13 Jul 2022 05:24:18 +0000 (05:24 +0000)]
Auto merge of #99149 - ferrocene:pa-nightly-branch, r=Mark-Simulacrum

Configure nightly branch name in `stage0.json`

The beta version number detection code relies on git to know how many merge commits were made since we branched off, and in doing so hardcodes `master` as the default branch name. This works for rust-lang/rust, but is problematic for forks that use a different default branch name (in Ferrocene we use `main` instead).

This PR changes the code to instead load the default branch name from `src/stage0.json`. `bump-stage0` has also been updated to remove the need to update it every time a new field is added to `stage0.json`.

2 years agofix documentation
Deadbeef [Tue, 12 Jul 2022 10:33:52 +0000 (10:33 +0000)]
fix documentation

2 years agoavoid `&str` to `String` conversions
Takayuki Maeda [Wed, 13 Jul 2022 04:24:38 +0000 (13:24 +0900)]
avoid `&str` to `String` conversions

2 years agoremove an unnecessary `span_to_snippet`
Takayuki Maeda [Wed, 13 Jul 2022 04:24:06 +0000 (13:24 +0900)]
remove an unnecessary `span_to_snippet`

2 years agoAuto merge of #99101 - RalfJung:interpret-projections, r=oli-obk
bors [Wed, 13 Jul 2022 02:43:25 +0000 (02:43 +0000)]
Auto merge of #99101 - RalfJung:interpret-projections, r=oli-obk

interpret: refactor projection handling code

Moves our projection handling code into a common file, and avoids the use of a
general mplace-based fallback function by have more specialized implementations.

mplace_index (and the other slice-related functions) could be more efficient by
copy-pasting the body of operand_index. Or we could do some trait magic to share
the code between them. But for now this is probably fine.

This is the common part of https://github.com/rust-lang/rust/pull/99013 and https://github.com/rust-lang/rust/pull/99097. I am seeing some strange perf results so this probably should be its own change so we know which diff caused which perf changes...

r? `@oli-obk`

2 years agoFix clippy build
Maybe Waffle [Thu, 30 Jun 2022 10:18:51 +0000 (14:18 +0400)]
Fix clippy build

2 years agoAdd rustfmt test for formatting `for<>` before closures
Maybe Waffle [Sun, 3 Jul 2022 12:11:46 +0000 (16:11 +0400)]
Add rustfmt test for formatting `for<>` before closures

2 years agoimplement rustfmt formatting for `for<>` closure binders
Maybe Waffle [Thu, 30 Jun 2022 13:40:38 +0000 (17:40 +0400)]
implement rustfmt formatting for `for<>` closure binders

2 years agoAdd back expr size checks
Maybe Waffle [Mon, 11 Jul 2022 19:40:35 +0000 (23:40 +0400)]
Add back expr size checks

2 years agoAdd an indirection for closures in `hir::ExprKind`
Maybe Waffle [Mon, 11 Jul 2022 19:39:53 +0000 (23:39 +0400)]
Add an indirection for closures in `hir::ExprKind`

This helps bring `hir::Expr` size down, `Closure` was the biggest
variant, especially after `for<>` additions.

2 years agoAdd `LifetimeBinderKind::Closure`
Maybe Waffle [Sun, 3 Jul 2022 15:15:39 +0000 (19:15 +0400)]
Add `LifetimeBinderKind::Closure`

2 years agoadd test for implicit stuff in signatures of closures with `for<>`
Maybe Waffle [Fri, 24 Jun 2022 15:57:01 +0000 (19:57 +0400)]
add test for implicit stuff in signatures of closures with `for<>`

2 years agomake for<> in closures a possible place to suggest adding named lifetime
Maybe Waffle [Thu, 30 Jun 2022 09:06:19 +0000 (13:06 +0400)]
make for<> in closures a possible place to suggest adding named lifetime

2 years agoLower closure binders to hir & properly check them
Maybe Waffle [Tue, 12 Jul 2022 09:34:24 +0000 (13:34 +0400)]
Lower closure binders to hir & properly check them

2 years agoUpdate compiler/rustc_parse/src/parser/expr.rs
Michael Howell [Tue, 12 Jul 2022 14:34:49 +0000 (07:34 -0700)]
Update compiler/rustc_parse/src/parser/expr.rs

Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2 years agollvm-wrapper: adapt for LLVM API change
Krasimir Georgiev [Tue, 12 Jul 2022 15:36:28 +0000 (15:36 +0000)]
llvm-wrapper: adapt for LLVM API change

2 years agoMention rust-analyzer maintainers when `proc_macro` bridge is changed
Jonas Schievink [Tue, 12 Jul 2022 15:31:18 +0000 (17:31 +0200)]
Mention rust-analyzer maintainers when `proc_macro` bridge is changed

2 years agoignore wasm=32 & bless
ouz-a [Tue, 12 Jul 2022 13:02:17 +0000 (16:02 +0300)]
ignore wasm=32 & bless

2 years agoComment out expr size check
Maybe Waffle [Tue, 12 Jul 2022 09:33:25 +0000 (13:33 +0400)]
Comment out expr size check

2 years ago--bless tests
Maybe Waffle [Thu, 2 Jun 2022 16:15:41 +0000 (20:15 +0400)]
--bless tests

2 years agoParse closure binders
Maybe Waffle [Thu, 2 Jun 2022 16:15:05 +0000 (20:15 +0400)]
Parse closure binders

This is first step in implementing RFC 3216.
- Parse `for<'a>` before closures in ast
  - Error in lowering
- Add `closure_lifetime_binder` feature

2 years agoAuto merge of #99177 - Dylan-DPC:rollup-m0k9q2w, r=Dylan-DPC
bors [Tue, 12 Jul 2022 11:36:58 +0000 (11:36 +0000)]
Auto merge of #99177 - Dylan-DPC:rollup-m0k9q2w, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #98622 (rustc_target: Flip the default for `TargetOptions::executables` to true)
 - #98633 (Fix last `let_chains` blocker)
 - #98972 (Suggest adding a missing zero to a floating point number)
 - #99038 (Some more `EarlyBinder` cleanups)
 - #99154 (use PlaceRef::iter_projections to fix old FIXME)
 - #99171 (Put back UI test regex)

Failed merges:

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

2 years agoRollup merge of #99171 - GuillaumeGomez:rustdoc-ui-test-regex, r=Dylan-DPC
Dylan DPC [Tue, 12 Jul 2022 11:36:36 +0000 (17:06 +0530)]
Rollup merge of #99171 - GuillaumeGomez:rustdoc-ui-test-regex, r=Dylan-DPC

Put back UI test regex

I just realized I overwrote these two commits in https://github.com/rust-lang/rust/pull/99055 when force pushing to fix the stdout output...

r? `@Dylan-DPC`

2 years agoRollup merge of #99154 - rosehuds:master, r=cjgillot
Dylan DPC [Tue, 12 Jul 2022 11:36:35 +0000 (17:06 +0530)]
Rollup merge of #99154 - rosehuds:master, r=cjgillot

use PlaceRef::iter_projections to fix old FIXME

I added this function in 53481a5a8fde83ed1a5d7e8302be028a4c7d8da5

2 years agoRollup merge of #99038 - jackh726:earlybinder-cleanup, r=lcnr
Dylan DPC [Tue, 12 Jul 2022 11:36:34 +0000 (17:06 +0530)]
Rollup merge of #99038 - jackh726:earlybinder-cleanup, r=lcnr

Some more `EarlyBinder` cleanups

First commit has a couple unrelated cleanups, but otherwise each commit is self-explanatory

r? rust-lang/types

2 years agoRollup merge of #98972 - TaKO8Ki:suggest-adding-missing-zero-to-floating-point-number...
Dylan DPC [Tue, 12 Jul 2022 11:36:33 +0000 (17:06 +0530)]
Rollup merge of #98972 - TaKO8Ki:suggest-adding-missing-zero-to-floating-point-number, r=compiler-errors

Suggest adding a missing zero to a floating point number

fixes #98836

2 years agoRollup merge of #98633 - c410-f3r:yet-another-let-chain, r=estebank
Dylan DPC [Tue, 12 Jul 2022 11:36:33 +0000 (17:06 +0530)]
Rollup merge of #98633 - c410-f3r:yet-another-let-chain, r=estebank

Fix last `let_chains` blocker

In order to forbid things like `let x = (let y = 1);` or `if let a = 1 && { let x = let y = 1; } {}`, the parser **HAS** to know the context of `let`.

This context thing is not a surprise in the parser because you can see **a lot** of ad hoc fixes mixing parsing logic with validation logic creating code that looks more like spaghetti with tomato sauce.

To make things even greater, a new ad hoc fix was added to only allow `let`s in a valid `let_chains` context by checking the previously processed token. This was the only solution I could think of and believe me, I thought about it for a long time 👍

In the long term, it should be preferable to segregate different responsibilities or create a more robust and cleaner parser framework.

cc https://github.com/rust-lang/rust/pull/94927
cc https://github.com/rust-lang/rust/issues/53667