Commit Graph

223220 Commits

Author SHA1 Message Date
Lukas Markeffsky
4f15a772b3 Add rustdoc::unescaped_backtick lint 2023-04-29 13:13:25 +02:00
bjorn3
72022bb24d Sync from rust f495605381 2023-04-29 11:10:56 +00:00
clundro
bca9387e1c update wasi_clock_time_api ref.
Signed-off-by: clundro <859287553@qq.com>
2023-04-29 19:04:16 +08:00
Camille GILLOT
63028ac3a1 Do not force anonymous lifetimes in consts to be static. 2023-04-29 10:32:31 +00:00
Guillaume Gomez
344dd0e828 Make repr attribute local_only 2023-04-29 11:50:16 +02:00
bors
f2299490c1 Auto merge of #108106 - the8472:layout-opt, r=wesleywiser
Improve niche placement by trying two strategies and picking the better result

Fixes #104807
Fixes #105371

Determining which sort order is better requires calculating the struct size (so we can calculate the niche offset). But that in turn depends on the field order, so happens after sorting. So the simple way to solve that is to run the whole thing twice and pick the better result.

1st commit is just code motion, the meat is in the later ones.
2023-04-29 08:55:04 +00:00
jyn
500c19c8ee windows: kill rust-analyzer-proc-macro-srv before deleting stage0 directory
This fixes the following recurring error on windows:
```
Traceback (most recent call last):
  File "C:\Users\jyn\src\rust\x.py", line 29, in <module>
    bootstrap.main()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 963, in main
    bootstrap(args)
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 927, in bootstrap
    build.download_toolchain()
  File "C:\Users\jyn\src\rust\src\bootstrap\bootstrap.py", line 437, in download_toolchain
    shutil.rmtree(bin_root)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
    return _rmtree_unsafe(path, onerror)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 617, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\jyn\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\jyn\\src\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\rust-analyzer-proc-macro-srv.exe'
```
2023-04-29 03:21:51 -05:00
Joshua Nelson
d50ce1536c download-rustc: Give a better error message if artifacts can't be downloaded
Before:
```
downloading https://ci-artifacts.rust-lang.org/rustc-builds/bf5cad8e775fb326465e5c1b98693e5d259da156/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
curl: (22) The requested URL returned error: 404
```

After:
```
downloading https://ci-artifacts.rust-lang.org/rustc-builds/bf5cad8e775fb326465e5c1b98693e5d259da156/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
curl: (22) The requested URL returned error: 404

error: failed to download pre-built rustc from CI

note: old builds get deleted after a certain time
help: if trying to compile an old commit of rustc, disable `download-rustc` in config.toml:

[rust]
download-rustc = false
```
2023-04-29 02:59:41 -05:00
jyn
107257eedc switch Crate to run_cargo_test 2023-04-29 02:31:25 -05:00
jyn
fc5a742b24 [wip] separate out a test_crate_args fn 2023-04-29 02:19:39 -05:00
jyn
41d7937493 Remove unnecessary test_kind field and TestKind struct 2023-04-29 02:19:37 -05:00
bors
af2c7e0f9b Auto merge of #110978 - Dylan-DPC:rollup-xclzwax, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #110614 (Clear response values for overflow in new solver)
 - #110894 (Bump libffi-sys to 2.3.0)
 - #110932 (include source error for LoadLibraryExW)
 - #110958 (Make sure that some stdlib method signatures aren't accidental refinements)
 - #110962 (Make drop_flags an IndexVec.)
 - #110965 (Don't duplicate anonymous lifetimes for async fn in traits)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-29 06:17:37 +00:00
Dylan DPC
81910a1b21
Rollup merge of #110965 - compiler-errors:anon-lt-dupe-oops, r=cjgillot
Don't duplicate anonymous lifetimes for async fn in traits

`record_lifetime_params_for_async` needs to be called outside of the scope of the function, or else it'll end up collecting anonymous lifetimes twice (those on the function and those within the `AnonymousCreateParameter` rib). This matches how `record_lifetime_params_for_async` is being used for functions with bodies below.

This fixes (partially) #110963 when the lifetimes are late-bound, but does not do so when the lifetimes are early-bound (as seen from the known-bug that I added).
2023-04-29 11:27:56 +05:30
Dylan DPC
7721c7319d
Rollup merge of #110962 - cjgillot:no-hash-drops, r=compiler-errors
Make drop_flags an IndexVec.

Fixes https://github.com/rust-lang/rust/issues/91943
2023-04-29 11:27:56 +05:30
Dylan DPC
339786e012
Rollup merge of #110958 - compiler-errors:stdlib-refinement, r=cuviper
Make sure that some stdlib method signatures aren't accidental refinements

In the process of implementing https://rust-lang.github.io/rfcs/3245-refined-impls.html, I found a bunch of stdlib implementations that accidentally "refined" their method signatures by dropping  (unnecessary) bounds.

This isn't currently a problem, but may become one if/when method  signature refining is stabilized in the future. Shouldn't hurt to make these signatures a bit more accurate anyways.

NOTE (just to be clear lol): This does not affect behavior at all, since we don't actually take advantage of refined implementations yet!
2023-04-29 11:27:55 +05:30
Dylan DPC
650f8fddd9
Rollup merge of #110932 - sameer:master, r=michaelwoerister
include source error for LoadLibraryExW

In #107595, we added retry behavior for LoadLibraryExW on Windows. If it fails we do not print the underlying error that Windows returned. This made #110889 a little harder to debug.

In this PR I am adding the source error in the message if it is available.
2023-04-29 11:27:55 +05:30
Dylan DPC
55df5c8023
Rollup merge of #110894 - loongarch-rs:bump-libffi-sys, r=Mark-Simulacrum
Bump libffi-sys to 2.3.0

Bump libffi-sys to 2.3.0 that includes LoongArch support.

Thanks

Related: https://github.com/rust-lang/miri/pull/2858
2023-04-29 11:27:54 +05:30
Dylan DPC
6da62a40f2
Rollup merge of #110614 - compiler-errors:new-solver-overflow-response, r=lcnr
Clear response values for overflow in new solver

When we have an overflow, return a trivial query response. This fixes an ICE with the code described in #110544:

```rust
trait Trait {}

struct W<T>(T);

impl<T, U> Trait for W<(W<T>, W<U>)>
where
    W<T>: Trait,
    W<U>: Trait,
{}

fn impls<T: Trait>() {}

fn main() {
    impls::<W<_>>()
}
```

Where, while proving `W<?0>: Trait`, we overflow but still apply the query response of `?0 = (W<?1>, W<?2>)`. Then while re-processing the query to validate that our evaluation result was stable, we get a different query response that looks like `?1 = (W<?3>, W<?4>), ?2 = (W<?5>, W<?6>)`, and so we trigger the ICE.

Also, by returning a trivial query response we also avoid the infinite-loop/OOM behavior of the old solver.

r? ``@lcnr``
2023-04-29 11:27:54 +05:30
John Bobbo
47fb8e6c70
Deny the unsafe_op_in_unsafe_fn lint in
`rustc_arena`.
2023-04-28 21:00:54 -07:00
bors
572c0d553f Auto merge of #110643 - pietroalbini:pa-bump-stage0, r=Mark-Simulacrum
[master] Bump stage0

r? `@Mark-Simulacrum`
2023-04-29 02:29:14 +00:00
bindsdev
107d480892 improve error notes for packed struct reference diagnostic 2023-04-28 20:28:56 -05:00
bors
7a96158b53 Auto merge of #110967 - matthiaskrgr:rollup-vfbl7gm, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #110877 (Provide better type hints when a type doesn't support a binary operator)
 - #110917 (only error combining +whole-archive and +bundle for rlibs)
 - #110921 (Use `NonNull::new_unchecked` and `NonNull::len` in `rustc_arena`.)
 - #110927 (Encoder/decoder cleanups)
 - #110944 (share BinOp::Offset between CTFE and Miri)
 - #110948 (run-make test: using single quotes to not trigger the shell)
 - #110957 (Fix an ICE in conflict error diagnostics)
 - #110960 (fix false negative for `unused_mut`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-28 23:13:42 +00:00
The 8472
61fb5a91b7 layout-alignment-promotion logic should depend on the niche-bias
For start-biased layout we want to avoid overpromoting so that
the niche doesn't get pushed back.
For end-biased layout we want to avoid promoting fields that
may contain one of the niches of interest.
2023-04-28 23:08:54 +02:00
The 8472
afe106cdc8 [review] add comments, turn flag into enum 2023-04-28 23:08:54 +02:00
The 8472
67a835d755 fix codegen test 2023-04-28 23:08:54 +02:00
Matthias Krüger
34ef13b15b
Rollup merge of #110960 - lukas-code:unused-mut, r=compiler-errors
fix false negative for `unused_mut`

fixes https://github.com/rust-lang/rust/issues/110849

We want to avoid double diagnostics for code like this, but only if an error actually occurs:
```rust
fn main() {
    let mut x: (i32, i32);
    x.0 = 1;
}
```

The first commit fixes the lint and the second one removes all the unused `mut`s it found.
2023-04-28 22:56:47 +02:00
Matthias Krüger
235d088412
Rollup merge of #110957 - WaffleLapkin:reach_generator_conflict_error, r=cjgillot
Fix an ICE in conflict error diagnostics

Fixes  #110929
r? ``@cjgillot``
2023-04-28 22:56:47 +02:00
Matthias Krüger
afbb1881ab
Rollup merge of #110948 - TimNN:patch-1, r=WaffleLapkin
run-make test: using single quotes to not trigger the shell

This test got added in #110801.

I'm no expert on Makefiles, but IIUC this command is passed to the shell, which usually tries to execute commands specified in between backticks in double-quoted strings.

Using single quotes should fix this, I think. (Note: Waiting for CI to test this, since I only have a web browser available right now).

r? ``@jyn514``

cc ``@WaffleLapkin``

Since this is breaking our build bot, even if it is not directly LLVM related: ``@rustbot`` label: +llvm-main
2023-04-28 22:56:46 +02:00
Matthias Krüger
03da9dbea0
Rollup merge of #110944 - RalfJung:offset, r=compiler-errors
share BinOp::Offset between CTFE and Miri

r? ``@oli-obk``
2023-04-28 22:56:46 +02:00
Matthias Krüger
37076ebbe5
Rollup merge of #110927 - nnethercote:Encoder-Decoder-cleanups, r=scottmcm
Encoder/decoder cleanups

Best reviewed one commit at a time.

r? ``@scottmcm``
2023-04-28 22:56:45 +02:00
Matthias Krüger
4751c85e50
Rollup merge of #110921 - JohnBobbo96:rustc_arena_nonnull, r=Nilstrieb
Use `NonNull::new_unchecked` and `NonNull::len` in `rustc_arena`.

This avoids a few extra dereferences as well as an `unwrap`.

According to the docs for [`NonNull::len`](https://doc.rust-lang.org/std/ptr/struct.NonNull.html#method.len) this also ensures that:

> This function is safe, even when the non-null raw slice cannot be dereferenced to a slice because the pointer does not have a valid address.

I am also fairly sure that the `unwrap` is unneeded in this case, as the docs for [`Box::into_raw`](https://doc.rust-lang.org/std/boxed/struct.Box.html#method.into_raw) also state:

> Consumes the Box, returning a wrapped raw pointer.
**The pointer will be properly aligned and non-null.**
2023-04-28 22:56:45 +02:00
Matthias Krüger
33f15e899d
Rollup merge of #110917 - Be-ing:whole_archive_with_staticlib_fix, r=petrochenkov
only error combining +whole-archive and +bundle for rlibs

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

Checking `flavor == RlibFlavor::Normal` was accidentally lost in 601fc8b36b
https://github.com/rust-lang/rust/pull/105601

That caused combining +whole-archive and +bundle link modifiers on non-rlib crates to fail with a confusing error message saying that combination is unstable for rlibs. In particular, this caused the build to fail when +whole-archive was used on staticlib crates, even though +whole-archive effectively does nothing on non-bin crates because the final linker invocation is left to an external build system.

cc ``@petrochenkov``
2023-04-28 22:56:44 +02:00
Matthias Krüger
aba9fb4696
Rollup merge of #110877 - compiler-errors:binop-err, r=cjgillot
Provide better type hints when a type doesn't support a binary operator

For example, when checking whether `vec![A] == vec![A]` holds, we first evaluate the LHS's ty, then probe for any `PartialEq` implementations for that. If none is found, we report an error by evaluating `Vec<A>: PartialEq<?0>` for fulfillment errors, but the RHS is not yet evaluated and remains an inference variable `?0`!

To fix this, we evaluate the RHS and equate it to that RHS infer var `?0`, so that we are able to provide more detailed fulfillment errors for why `Vec<A>: PartialEq<Vec<A>>` doesn't hold (namely, the nested obligation `A: PartialEq<A>` doesn't hold).

Fixes #95285
Fixes #110867
2023-04-28 22:56:44 +02:00
bors
f495605381 Auto merge of #110901 - GuillaumeGomez:inlined-repr-rustdoc, r=notriddle
rustdoc: Fix missing `repr` attribute in doc(inline) on foreign items

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

r? `@notriddle`
2023-04-28 20:33:33 +00:00
Michael Goulet
4e05cfb5ff Don't duplicate anonymous lifetimes for async fn in traits 2023-04-28 20:21:03 +00:00
Michael Howell
2299ba1ca2 rustdoc: fix weird margins between Deref impl items
In the old setup, if the dereffed-to item has multiple impl blocks,
each one gets its own `div.impl-items` in the section, but there
are no headers separating them. Since the last method in a
`div.impl-items` has no bottom margin, and there are no margins
between these divs, there is no margin between the last method
of one impl and the first method of the following impl.

This patch fixes it by simplifying the HTML. Each Deref block gets
exactly one `div.impl-items`, no matter how many impl blocks it
actually has.
2023-04-28 13:16:10 -07:00
Camille GILLOT
7f26191aed Make drop_flags an IndexVec. 2023-04-28 20:12:45 +00:00
Michael Howell
10c77b1cd0 rustdoc: move deref tests into a directory 2023-04-28 12:54:26 -07:00
Lukas Markeffsky
fc63926e18 remove unused muts 2023-04-28 20:19:48 +02:00
Maybe Waffle
754a62c306 Fix an ICE in conflict errors diagnostics 2023-04-28 17:37:56 +00:00
Michael Goulet
33871c97ab Make sure that signatures aren't accidental refinements 2023-04-28 17:36:49 +00:00
Lukas Markeffsky
69c71dacda fix false negative for unused_mut 2023-04-28 19:35:40 +02:00
bors
f357475170 Auto merge of #110952 - ehuss:update-awscli, r=cuviper
Update awscli

The Windows GitHub Actions image just updated to pip 23.1.1 which broke the PyYaml installer in the current AWS CLI mirror.  It now requires setuptools, wheel, and Cython to be installed manually.  This updates to include that, as well as updating the versions of all the packages. This also now uses python3 on macOS since python2 doesn't work with the newer versions.

I have only tested that these install correctly, but not that they work correctly.

Pietro mentioned that we should just switch to aws cli 2, which I agree is probably the better solution. I'm posting this PR in case it helps unblock CI.
2023-04-28 17:30:55 +00:00
Maybe Waffle
b29b56f520 Add regression test for issue 110929 2023-04-28 16:50:28 +00:00
Josh Stone
dc94522072 bless line changes in tests-listing-format-json.run.stdout 2023-04-28 09:22:29 -07:00
Pietro Albini
a7bb8c7851 handle cfg(bootstrap) 2023-04-28 08:47:55 -07:00
Pietro Albini
d64f46a553 bump stage0 2023-04-28 08:47:55 -07:00
Pietro Albini
4e04da6183 replace version placeholders 2023-04-28 08:47:55 -07:00
Sameer Puri
24adb1f68c include source error for LoadLibraryExW 2023-04-28 17:32:46 +02:00
Eric Huss
dd6314f96c Update awscli 2023-04-28 08:30:34 -07:00