Commit Graph

222895 Commits

Author SHA1 Message Date
jyn
2469afef1a Make the BUG_REPORT_URL configurable by tools
This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy
the entire hook implementation.

- Switch clippy to the new hook

  This also adds a `extra_info` callback so clippy can include its own version number, which differs
  from rustc's.

- Call `install_ice_hook` in rustfmt
2023-05-01 21:44:04 -05:00
jyn
f0be14565f drive-by cleanup of rustdoc comment 2023-04-29 06:39:10 -05: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
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
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
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
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
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
Eric Huss
dd6314f96c Update awscli 2023-04-28 08:30:34 -07:00
Tim Neumann
f1b88eab50
run-make test: using single quotes to not trigger the shell 2023-04-28 16:11:45 +02:00
Ralf Jung
586d17d330 share BinOp::Offset between CTFE and Miri 2023-04-28 16:00:08 +02:00
bors
43a78029b4 Auto merge of #110837 - scottmcm:offset-for-add, r=compiler-errors
Use MIR's `Offset` for pointer `add` too

~~Status: draft while waiting for #110822 to land, since this is built atop that.~~
~~r? `@ghost~~`

Canonical Rust code has mostly moved to `add`/`sub` on pointers, which take `usize`, instead of `offset` which takes `isize`.  (And, relatedly, when `sub_ptr` was added it turned out it replaced every single in-tree use of `offset_from`, because `usize` is just so much more useful than `isize` in Rust.)

Unfortunately, `intrinsics::offset` could only accept `*const` and `isize`, so there's a *huge* amount of type conversions back and forth being done.  They're identity conversions in the backend, but still end up producing quite a lot of unhelpful MIR.

This PR changes `intrinsics::offset` to accept `*const` *and* `*mut` along with `isize` *and* `usize`.  Conveniently, the backends and CTFE already handle this, since MIR's `BinOp::Offset` [already supports all four combinations](adaac6b166/compiler/rustc_const_eval/src/transform/validate.rs (L523-L528)).

To demonstrate the difference, I added some `mir-opt/pre-codegen/` tests around slice indexing.  Here's the difference to `[T]::get_mut`, since it uses `<*mut _>::add` internally:
```diff
`@@` -79,30 +70,21 `@@` fn slice_get_mut_usize(_1: &mut [u32], _2: usize) -> Option<&mut u32> {
         StorageLive(_12);                // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         StorageLive(_9);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         _9 = _8 as *mut u32 (PtrToPtr);  // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageLive(_13);                // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        _13 = _2 as isize (IntToInt);    // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageLive(_14);                // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageLive(_15);                // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        _15 = _9 as *const u32 (Pointer(MutToConstPointer)); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        _14 = Offset(move _15, _13);     // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageDead(_15);                // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        _7 = move _14 as *mut u32 (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageDead(_14);                // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
-        StorageDead(_13);                // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+        _7 = Offset(_9, _2);             // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
         StorageDead(_9);                 // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         StorageDead(_12);                // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
         StorageDead(_11);                // scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL
```
1c1c8e442a (diff-a841b6a4538657add3f39bc895744331453d0625e7aace128b1f604f0b63c8fdR80)
2023-04-28 09:26:59 +00:00
Nicholas Nethercote
23e91d4d73 Remove some unnecessary derives.
I was curious about how many `Encodable`/`Decodable` derives we have.
Some grepping revealed that it's over 500 of each, but the number of
`Encodable` ones was higher, which was weird. Most of the
`Encodable`-only ones were in `hir.rs`. This commit removes them all,
plus some other unnecessary derives in that file and others that I found
via trial and error.
2023-04-28 18:34:55 +10:00
Nicholas Nethercote
a676dfa888 Remove MemDecoder::read_byte.
It's just a synonym for `read_u8`.
2023-04-28 18:34:55 +10:00
Nicholas Nethercote
7a16d25365 Add some provided methods to Encoder/Decoder.
The methods for `i8`, `bool`, `char`, `str` are the same for all impls,
because they layered on top of other methods.
2023-04-28 18:34:54 +10:00
Nicholas Nethercote
fa133f5354 Remove a low-value assertion.
Checking that `read_raw_bytes(len)` changes the position by `len` is a
reasonable thing for a test, but isn't much use in just one of the
zillion `Decodable` impls.
2023-04-28 18:34:52 +10:00
bors
2fce229086 Auto merge of #110924 - matthiaskrgr:rollup-jvznpq2, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #110766 (More core::fmt::rt cleanup.)
 - #110873 (Migrate trivially translatable `rustc_parse` diagnostics)
 - #110904 (rustdoc: rebind bound vars to type-outlives predicates)
 - #110913 (Add some missing built-in lints)
 - #110918 (`remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied)
 - #110920 (Fix unavailable url)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-28 06:32:01 +00:00
Scott McMurray
e1da77c76d Also use mir::Offset for pointer add 2023-04-27 22:44:42 -07:00
Matthias Krüger
dda14941e0
Rollup merge of #110920 - cuishuang:master, r=jyn514
Fix unavailable url

The previous link is no longer accessible (404).

Use latest link.
2023-04-28 07:34:04 +02:00
Matthias Krüger
6476b79df7
Rollup merge of #110918 - ChrisDenton:on-error-resume-next, r=cuviper
`remove_dir_all`: try deleting the directory even if `FILE_LIST_DIRECTORY` access is denied

If opening a directory with `FILE_LIST_DIRECTORY` access fails then we should try opening without requesting that access. We may still be able to delete it if it's empty or a link.

Fixes https://github.com/rust-lang/cargo/issues/12042
2023-04-28 07:34:04 +02:00
Matthias Krüger
901bab70d3
Rollup merge of #110913 - compiler-errors:missing-lints, r=Nilstrieb
Add some missing built-in lints

(and also sort them, so this is best reviewed one commit at a time)

Fixes #110911

I wonder if there's a good way to detect when a lint is built-in (i.e. not associated to a lint pass). If so, it needs to be added to this list, or else we're unable to `allow` or `deny` it. Leaving that for future work, I guess...
2023-04-28 07:34:03 +02:00
Matthias Krüger
8ce92daa85
Rollup merge of #110904 - fmease:rustdoc-fix-110900, r=compiler-errors
rustdoc: rebind bound vars to type-outlives predicates

Fixes #110900.
2023-04-28 07:34:03 +02:00
Matthias Krüger
29f5ec3640
Rollup merge of #110873 - clubby789:migrate-rustc-parse-trivial, r=compiler-errors
Migrate trivially translatable `rustc_parse` diagnostics

cc #100717

Migrate diagnostics in `rustc_parse` which are emitted in a single statement. I worked on this by expanding the lint introduced in #108760, although that isn't included here as there is much more work to be done to satisfy it
2023-04-28 07:34:02 +02:00
Matthias Krüger
cf911ac757
Rollup merge of #110766 - m-ou-se:fmt-rt, r=jyn514
More core::fmt::rt cleanup.

- Removes the `V1` suffix from the `Argument` and `Flag` types.

- Moves more of the format_args lang items into the `core::fmt::rt` module. (The only remaining lang item in `core::fmt` is `Arguments` itself, which is a public type.)

Part of https://github.com/rust-lang/rust/issues/99012

Follow-up to https://github.com/rust-lang/rust/pull/110616
2023-04-28 07:34:02 +02:00
bors
033aa092ab Auto merge of #110919 - JohnTitor:rollup-9phs2vx, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #109702 (configure --set support list as arguments)
 - #110620 (Document `const {}` syntax for `std::thread_local`.)
 - #110721 (format panic message only once)
 - #110881 (refactor(docs): remove macro resolution fallback)
 - #110893 (remove inline const deadcode in typeck)
 - #110898 (Remove unused std::sys_common::thread_local_key::Key)
 - #110909 (Skip `rustc` version detection on macOS)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-28 03:27:33 +00:00
John Bobbo
618841b815
Use NonNull::new_unchecked and NonNull::len in
`rustc_arena`.
2023-04-27 19:48:37 -07:00
cui fliter
176144e821 Fix unavailable url
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-04-28 09:54:35 +08:00
Yuki Okushi
00b9ce5a2a
Rollup merge of #110909 - john-h-k:build/no-rustc-version-darwin, r=jyn514
Skip `rustc` version detection on macOS

Fixes #104723
2023-04-28 10:52:02 +09:00
Yuki Okushi
75be558071
Rollup merge of #110898 - m-ou-se:remove-unused-thread-local-key, r=cuviper
Remove unused std::sys_common::thread_local_key::Key

Part of https://github.com/rust-lang/rust/issues/110897

This `Key` type seems unused. Let's remove it and see if anything explodes. :)
2023-04-28 10:52:01 +09:00
Yuki Okushi
c464be96f8
Rollup merge of #110893 - BoxyUwU:inline_const_nits, r=compiler-errors
remove inline const deadcode in typeck

inline consts get typeck'd with their parent so this is not reachable
2023-04-28 10:52:00 +09:00
Yuki Okushi
0246af8664
Rollup merge of #110881 - bvanjoi:fix-110879, r=jyn514
refactor(docs): remove macro resolution fallback

close https://github.com/rust-lang/rust/issues/110879

r?`@jyn514`
2023-04-28 10:52:00 +09:00
Yuki Okushi
eea5f8a9c4
Rollup merge of #110721 - lukas-code:panic-fmt, r=Amanieu
format panic message only once

Formatting the panic message multiple times can cause problems for some real-world crates, so here's a test to ensure that we don't do that.

This was regressed in https://github.com/rust-lang/rust/pull/109507 and reverted in https://github.com/rust-lang/rust/pull/110782.

fixes https://github.com/rust-lang/rust/issues/110717
fixes https://github.com/rust-itertools/itertools/issues/694
2023-04-28 10:51:59 +09:00
Yuki Okushi
085fbe9098
Rollup merge of #110620 - Nilstrieb:document-the-undocumented, r=thomcc
Document `const {}` syntax for `std::thread_local`.

It exists and is pretty cool. More people should use it.

It was added in #83416 and stabilized in #91355 with the tracking issue #84223.
2023-04-28 10:51:59 +09:00
Yuki Okushi
6b0da57551
Rollup merge of #109702 - chenyukang:yukang/fix-109316-configure, r=albertlarsan68
configure --set support list as arguments

Fixes #109316

r? `@jyn514`
2023-04-28 10:51:59 +09:00
Chris Denton
ddff7f0e50
remove_dir_all: delete directory with fewer perms
If opening a directory with `FILE_LIST_DIRECTORY` access fails then we should try opening without requesting that access. We may still be able to delete it if it's empty or a link.
2023-04-28 02:30:45 +01:00
bors
9a3258fa52 Auto merge of #110801 - WaffleLapkin:io-tests, r=jyn514
Fix `ui/io-checks/inaccessbile-temp-dir.rs` test

Fixes #110794

r? `@jyn514`
2023-04-28 00:17:47 +00:00
Nicholas Nethercote
37c9e45186 Add a comment explaining the lack of Decoder::read_enum_variant.
Because I was wondering about it, and this may save a future person from
also wondering.
2023-04-28 09:51:00 +10:00