Commit Graph

240784 Commits

Author SHA1 Message Date
The Miri Conjob Bot
bcc059500c Merge from rustc 2023-12-04 05:02:38 +00:00
The Miri Conjob Bot
da4fd2220f Preparing for merge from rustc 2023-12-04 04:56:13 +00:00
Nicholas Nethercote
d4933aaf1f Inline and remove DiagnosticBuilder::new_diagnostic_* functions.
They each have a single call site.
2023-12-04 15:42:12 +11:00
Nicholas Nethercote
114380d215 Give Handler::fatal and Session::fatal the same return type.
Currently, `Handler::fatal` returns `FatalError`. But `Session::fatal`
returns `!`, because it calls `Handler::fatal` and then calls `raise` on
the result. This inconsistency is unfortunate.

This commit changes `Handler::fatal` to do the `raise` itself, changing
its return type to `!`. This is safe because there are only two calls to
`Handler::fatal`, one in `rustc_session` and one in
`rustc_codegen_cranelift`, and they both call `raise` on the result.

`HandlerInner::fatal` still returns `FatalError`, so I renamed it
`fatal_no_raise` to emphasise the return type difference.
2023-12-04 15:42:06 +11:00
bors
85a4bd8f58 Auto merge of #116915 - bend-n:unwet, r=saethlin
Add an assume that the index is inbounds to slice::get_unchecked

Fixes #116878
2023-12-04 03:09:45 +00:00
bohan
199098b71b dedup for duplicate suggestions 2023-12-04 10:43:10 +08:00
Nadrieril
c1774a137d Document reentrancy in *Arena::alloc_from_iter 2023-12-04 02:24:10 +01:00
bendn
73afc00cf9
use assume(idx < self.len()) in [T]::get_unchecked 2023-12-04 06:00:12 +07:00
bors
c9808f8702 Auto merge of #117840 - RalfJung:miri-promise-align, r=cjgillot
miri: support 'promising' alignment for symbolic alignment check

Then use that ability in `slice::align_to`, so that even with `-Zmiri-symbolic-alignment-check`, it no longer has to return spuriously empty "middle" parts.

Fixes https://github.com/rust-lang/miri/issues/3068
2023-12-03 22:53:44 +00:00
bors
9fad685992 Auto merge of #118579 - matthiaskrgr:rollup-22kn8sa, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #117869 ([rustdoc] Add highlighting for comments in items declaration)
 - #118525 (coverage: Skip spans that can't be un-expanded back to the function body)
 - #118574 (rustc_session: Address all `rustc::potential_query_instability` lints)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-03 20:54:56 +00:00
Ralf Jung
2a3fcc0a57 move calling miri_promise_symbolic_alignment to a shared helper 2023-12-03 21:51:14 +01:00
Ralf Jung
bebba4f6e0 miri: support 'promising' alignment for symbolic alignment check 2023-12-03 21:51:14 +01:00
Matthias Krüger
caeaf31316
Rollup merge of #118574 - Enselic:query-instability, r=cjgillot
rustc_session: Address all `rustc::potential_query_instability` lints

Instead of allowing `rustc::potential_query_instability` on the whole crate we go over each lint and allow it individually if it is safe to do. Turns out all instances were safe to allow in this crate.

Part of #84447 which is **E-help-wanted**.
2023-12-03 21:28:32 +01:00
Matthias Krüger
80c94e81d9
Rollup merge of #118525 - Zalathar:skip-spans, r=cjgillot
coverage: Skip spans that can't be un-expanded back to the function body

When we extract coverage spans from MIR, we try to "un-expand" them back to spans that are inside the function's body span.

In cases where that doesn't succeed, the current code just swaps in the entire body span instead. But that tends to result in coverage spans that are completely unrelated to the control flow of the affected code, so it's better to just discard those spans.

---

Extracted from #118305, since this is a general improvement that isn't specific to branch coverage.

---

`@rustbot` label +A-code-coverage
2023-12-03 21:28:32 +01:00
Matthias Krüger
591b84583c
Rollup merge of #117869 - GuillaumeGomez:comment-highlighting-item-decl, r=notriddle
[rustdoc] Add highlighting for comments in items declaration

Fixes #117555.

So after the discussion in https://github.com/rust-lang/rust/pull/117643, the outcome was that having the comments in the item declaration at the same level (in term of color) as the rest of the code was actually a bit distracting and could be improved.

The current highlighting color for comments is "lighter" than the rest and I think it fits perfectly to improve the current situation. With this, we now have different "levels" which makes it easier to read and filter out what we want when reading the items declaration.

Here's a screenshot:

![image](https://github.com/rust-lang/rust/assets/3050060/dbd98029-e98b-4997-9a89-6b823eaac9a4)

r? `@notriddle`
2023-12-03 21:28:32 +01:00
bors
d12dc74a2c Auto merge of #118072 - estebank:issue-98982, r=cjgillot
Provide structured suggestion for type mismatch in loop

We currently provide only a `help` message, this PR introduces the last two structured suggestions instead:

```
error[E0308]: mismatched types
  --> $DIR/issue-98982.rs:2:5
   |
LL |   fn foo() -> i32 {
   |               --- expected `i32` because of return type
LL | /     for i in 0..0 {
LL | |         return i;
LL | |     }
   | |_____^ expected `i32`, found `()`
   |
note: the function expects a value to always be returned, but loops might run zero times
  --> $DIR/issue-98982.rs:2:5
   |
LL |     for i in 0..0 {
   |     ^^^^^^^^^^^^^ this might have zero elements to iterate on
LL |         return i;
   |         -------- if the loop doesn't execute, this value would never get returned
help: return a value for the case when the loop has zero elements to iterate on
   |
LL ~     }
LL ~     /* `i32` value */
   |
help: otherwise consider changing the return type to account for that possibility
   |
LL ~ fn foo() -> Option<i32> {
LL |     for i in 0..0 {
LL ~         return Some(i);
LL ~     }
LL ~     None
   |
```

Fix #98982.
2023-12-03 18:57:49 +00:00
bors
487d999e03 Auto merge of #3206 - RalfJung:simd-bitmask, r=RalfJung
SIMD bitmasks: use 'round up to multiple of 8' rather than 'clamp to at least 8'

This should prepare us better for a future with non-power-of-2 vectors, if they ever happen.
2023-12-03 18:28:31 +00:00
Ralf Jung
7c6ed0cc19 SIMD bitmasks: use 'round up to multiple of 8' rather than 'clamp to at least 8' 2023-12-03 19:24:03 +01:00
bors
db07cccb1e Auto merge of #113730 - belovdv:jobserver-init-check, r=petrochenkov
Report errors in jobserver inherited through environment variables

This pr attempts to catch situations, when jobserver exists, but is not being inherited.

r? `@petrochenkov`
2023-12-03 16:28:22 +00:00
bors
6da09594e6 Auto merge of #3205 - RalfJung:simd-bitmask, r=RalfJung
also test simd_select_bitmask on arrays for less than 8 elements
2023-12-03 15:21:45 +00:00
Ralf Jung
6e74d2ad50 disable a test that currently fails on big-endian 2023-12-03 16:19:53 +01:00
Ralf Jung
c9463698db also test directly calling simd_select_bitmask 2023-12-03 16:17:12 +01:00
Ralf Jung
92b4ffc688 handle the array case consistently for simd_select_bitmask and simd_bitmask
also move the two next to each other
2023-12-03 15:45:38 +01:00
bors
21d88b32cb Auto merge of #118526 - sjwang05:issue-118510, r=petrochenkov
Fix ICE: `fn_arg_names: unexpected item DefId(..)`

Fixes #118510
2023-12-03 14:26:39 +00:00
Martin Nordholts
d87460a507 rustc_session: Address all rustc::potential_query_instability lints
Instead of allowing `rustc::potential_query_instability` on the whole
crate we go over each lint and allow it individually if it is safe to
do. Turns out all instances were safe to allow in this crate.
2023-12-03 15:05:39 +01:00
Ralf Jung
56f50d53d1 also test simd_select_bitmask on arrays for less than 8 elements 2023-12-03 14:42:41 +01:00
Vadim Petrochenkov
17e799c270 rustc: Harmonize DefKind and DefPathData
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`.

`DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`.
It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change.

Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values.

`DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-12-03 16:24:56 +03:00
bors
8b6a4a93ed Auto merge of #118567 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2023-12-03 11:59:32 +00:00
Nadrieril
431cc4a3b0 Satisfy tidy 2023-12-03 12:25:46 +01:00
Nadrieril
70deb9a57f Disallow arm bodies on never patterns 2023-12-03 12:25:46 +01:00
Nadrieril
06a8ed10b6 Disallow guards on never patterns 2023-12-03 12:25:46 +01:00
Nadrieril
a2dcb3a6d9 Disallow an arm without a body (except for never patterns)
Parsing now accepts a match arm without a body, so we must make sure to
only accept that if the pattern is a never pattern.
2023-12-03 12:25:46 +01:00
Nadrieril
0bfebc6105 Detect attempts to expand a macro to a match arm again
Because a macro invocation can expand to a never pattern, we can't rule
out a `arm!(),` arm at parse time. Instead we detect that case at
expansion time, if the macro tries to output a pattern followed by `=>`.
2023-12-03 12:25:46 +01:00
Nadrieril
80bdcbf50a Parse a pattern with no arm 2023-12-03 12:25:46 +01:00
bors
28f9fe3262 Auto merge of #3204 - RalfJung:simd, r=RalfJung
add new SIMD intrinsics
2023-12-03 11:11:20 +00:00
Ralf Jung
2903f1c322 add simd_bswap and simd_bitreverse 2023-12-03 12:08:02 +01:00
Ralf Jung
31ea5181b6 add simd_cttz and simd_ctlz 2023-12-03 12:07:51 +01:00
Ralf Jung
edabd477f8 interpret: make numeric_intrinsic accessible from Miri 2023-12-03 11:51:58 +01:00
Ralf Jung
11db9de728 simd_select_bitmask: support passing the mask as an array 2023-12-03 11:28:40 +01:00
bors
2a316c410d Auto merge of #3203 - RalfJung:trophy, r=RalfJung
new trophy case entry

Cc https://github.com/rust-lang/rust/pull/118460
2023-12-03 09:49:42 +00:00
Ralf Jung
323ca94d92 new trophy case entry 2023-12-03 10:47:59 +01:00
bors
7ceaf19868 Auto merge of #118546 - RalfJung:hashbrown, r=Amanieu
update hashbrown

I had to also pull in an updated syn to make that work, and then cargo pulled in some more package updates.

r? `@Amanieu`
2023-12-03 09:03:14 +00:00
Ralf Jung
ef15a8182b codegen, miri: fix computing the offset of an unsized field in a packed struct 2023-12-03 08:26:51 +01:00
Ralf Jung
5a20bac6b3 more targeted errors when extern types end up in places they should not 2023-12-03 08:11:15 +01:00
bors
71940e0a8a Auto merge of #118487 - RalfJung:exposed-provenance, r=thomcc
move exposed-provenance APIs into separate feature gate

We have already stated explicitly for all the 'exposed' functions that

> Using this method means that code is *not* following strict provenance rules.

However, they were part of the same feature gate and still described as part of the strict provenance experiment. Unfortunately, their semantics are much less clear and certainly nowhere near stabilization, so in preparation for an attempt to stabilize the strict provenance APIs, I suggest we split the things related to "exposed" into their own feature gate. I also used this opportunity to better explain how Exposed Provenance fits into the larger plan here: this is *one possible candidate* for `as` semantics, but we don't know if it is actually viable, so we can't really promise that it is equivalent to `as`. If it works out we probably want to make `as` equivalent to the 'exposed' APIs; if it doesn't, we will remove them again and try to find some other semantics for `as`.
2023-12-03 07:04:12 +00:00
bors
6318e9dd89 Auto merge of #3202 - rust-lang:rustup-2023-12-03, r=saethlin
Automatic Rustup
2023-12-03 05:23:24 +00:00
The Miri Conjob Bot
3a6753b8b9 Merge from rustc 2023-12-03 05:11:24 +00:00
The Miri Conjob Bot
48176d4447 Preparing for merge from rustc 2023-12-03 05:04:26 +00:00
bors
2f1ba4a0af Auto merge of #118128 - RalfJung:bad-intrinsics, r=the8472
warn against using intrinsics that leave the scope of our memory model
2023-12-03 05:03:12 +00:00
bors
225e36cff9 Auto merge of #118542 - chenyukang:yukang-fix-parser-ice-118531, r=cjgillot
Fix parser ICE from attrs

Fixes #118531,
Fixes #118530.
2023-12-03 03:05:17 +00:00