Commit Graph

172321 Commits

Author SHA1 Message Date
Dylan DPC
99f3132cd7
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`.
2022-07-15 10:39:41 +05:30
bors
30243dd87e Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, r=cjgillot
gather body owners

Issue #96341
2022-07-15 01:03:55 +00:00
bors
1ba1fec234 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.
2022-07-14 21:50:14 +00:00
bors
c2f428d2f3 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
2022-07-14 19:03:58 +00:00
Rémy Rakic
97510f2128 fix dwarf debuginfo being used in addition to CodeView on windows
Fixes the debuginfo size increase regression introduced by the DWARF5 support.
2022-07-14 20:41:55 +02:00
bors
74621c764e 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
2022-07-14 16:23:07 +00:00
Dylan DPC
f74358d052
Rollup merge of #99236 - psumbera:Issue99208, r=Mark-Simulacrum
solaris: unbreak build on native platform

Fixes: #99208
2022-07-14 19:24:08 +05:30
Dylan DPC
39936fd0b7
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
2022-07-14 19:24:06 +05:30
Dylan DPC
d3a1aa0b43
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.
2022-07-14 19:24:05 +05:30
Dylan DPC
ecae3d74e2
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`
2022-07-14 19:24:04 +05:30
Dylan DPC
8c5c983e5b
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
2022-07-14 19:24:03 +05:30
Dylan DPC
2b17aa67fc
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
2022-07-14 19:24:02 +05:30
bors
24699bcbad 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.
2022-07-14 13:42:09 +00:00
Petr Sumbera
1e64a7b4f1 solaris: unbreak build on native platform
Fixes: #99208
2022-07-14 13:44:40 +02:00
bors
f1a8854f9b 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
2022-07-14 11:00:30 +00:00
Amanieu d'Antras
f4e7813121 Fix spans for asm diagnostics
Line spans were incorrect if the first line of an asm statement was an
empty string.
2022-07-14 11:20:52 +02:00
kadmin
20fb8aba8f Fix overlapping impls 2022-07-14 09:01:17 +00:00
Dylan DPC
c1b43ef589
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.
2022-07-14 14:14:23 +05:30
Dylan DPC
85159a4df8
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
2022-07-14 14:14:22 +05:30
Dylan DPC
e5a86d7358
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``
2022-07-14 14:14:21 +05:30
Dylan DPC
103b8602b7
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.
2022-07-14 14:14:20 +05:30
Dylan DPC
f5e9cb53ab
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``
2022-07-14 14:14:19 +05:30
bors
0ed9c64c3e 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`
2022-07-14 08:14:31 +00:00
bors
431c6f8499 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)
2022-07-14 05:07:22 +00:00
Eric Huss
8d06175b7c Update cargo 2022-07-13 21:25:48 -07:00
Josh Triplett
d431338b25 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.
2022-07-13 19:28:20 -07:00
bors
8a392a5992 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`
2022-07-14 02:22:48 +00:00
Katherine Philip
96d34dc9ff Update tests 2022-07-13 17:28:11 -07:00
bors
cbb07c27a4 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
2022-07-13 23:42:05 +00:00
Katherine Philip
083bd7cb1d Remove predicate note 2022-07-13 16:29:05 -07:00
Katherine Philip
b33955a0ef Add checks & fallback branch 2022-07-13 16:29:05 -07:00
Katherine Philip
82ab171673 Use emit_inference_failure_err for ConstEvaluatable predicates 2022-07-13 16:29:00 -07:00
Joshua Nelson
3c9765cff1 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.
2022-07-13 17:47:06 -05:00
Ralf Jung
07fe9882cc add array tests, cleanup, tidy, and bless 2022-07-13 18:31:29 -04:00
Ralf Jung
e4593ef0f2 assigning to a union field can never drop now 2022-07-13 18:27:28 -04:00
Ralf Jung
5bf6017b87 remove untagged_union feature gate 2022-07-13 18:27:28 -04:00
Ralf Jung
6dfede3b9d also allow arrays of allowed types 2022-07-13 18:27:28 -04:00
Ralf Jung
ec7152cdf6 allow unions with mutable references and tuples of allowed types 2022-07-13 18:27:28 -04:00
Ralf Jung
848d23b57b factor 'is this type allowed as union field on stable' into separate function 2022-07-13 18:27:28 -04:00
Preston From
1219f72f90 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
2022-07-13 15:34:10 -06:00
bors
87588a2afd 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
2022-07-13 21:01:20 +00:00
Miguel Guarniz
2d265b6f75 collect module item-likes in visit_items
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13 13:54:45 -04:00
Niklas Jonsson
f94484fe7e reduce scope of allow(rustc::potential_query_instability) in rustc_span 2022-07-13 19:30:08 +02:00
bors
c80dde43f9 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
2022-07-13 17:13:27 +00:00
Miguel Guarniz
275497c35e merge visitors in queries
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13 12:22:49 -04:00
Miguel Guarniz
b599cf45d6 inline associated_body
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13 12:22:49 -04:00
Miguel Guarniz
c6e7c0514f use gathered body_owners in par_body_owners
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-13 12:22:25 -04:00
bors
42bd138126 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`
2022-07-13 14:32:33 +00:00
Dylan DPC
3933b2b310
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.
2022-07-13 19:32:37 +05:30
Dylan DPC
68cfdbb5c1
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
2022-07-13 19:32:36 +05:30