Commit Graph

254621 Commits

Author SHA1 Message Date
lcnr
feff7520df update crashes 2024-05-09 17:51:05 +00:00
lcnr
83e6da0be5 analyse visitor: build proof tree in probe 2024-05-09 17:29:53 +00:00
Julien
bdab8b1c0c
add FIXME 2024-05-09 13:29:46 -04:00
Matthias Krüger
779fe95298
Rollup merge of #124926 - Alexendoo:feature-maybe-incorrect, r=est31
Make `#![feature]` suggestion MaybeIncorrect

Fixes https://github.com/rust-lang/rust-clippy/issues/12784

The `unstable_name_collisions` lint uses `disabled_nightly_features` to mention the feature name, but accepting the suggestion would result in an ambiguity error

There are other calls where accepting the feature gate would fix code when ran with `cargo fix --broken-code`, though it's not always desirable to add a feature gate even if the user is currently on nightly so MaybeIncorrect seems appropriate
2024-05-09 19:09:31 +02:00
Matthias Krüger
a40fa8f443
Rollup merge of #124924 - goofylfg:master, r=est31
chore: remove repetitive words
2024-05-09 19:09:31 +02:00
Matthias Krüger
024881a36b
Rollup merge of #124923 - RalfJung:offset-from-errors, r=compiler-errors
interpret/miri: better errors on failing offset_from

Fixes https://github.com/rust-lang/miri/issues/3104
2024-05-09 19:09:30 +02:00
Matthias Krüger
0a917f89f3
Rollup merge of #124919 - nnethercote:Recovered-Yes-ErrorGuaranteed, r=compiler-errors
Add `ErrorGuaranteed` to `Recovered::Yes` and use it more.

The starting point for this was identical comments on two different fields, in `ast::VariantData::Struct` and `hir::VariantData::Struct`:
```
    // FIXME: investigate making this a `Option<ErrorGuaranteed>`
    recovered: bool
```
I tried that, and then found that I needed to add an `ErrorGuaranteed` to `Recovered::Yes`. Then I ended up using `Recovered` instead of `Option<ErrorGuaranteed>` for these two places and elsewhere, which required moving `ErrorGuaranteed` from `rustc_parse` to `rustc_ast`.

This makes things more consistent, because `Recovered` is used in more places, and there are fewer uses of `bool` and
`Option<ErrorGuaranteed>`. And safer, because it's difficult/impossible to set `recovered` to `Recovered::Yes` without having emitted an error.

r? `@oli-obk`
2024-05-09 19:09:30 +02:00
Matthias Krüger
ebeedf05cb
Rollup merge of #124893 - xldenis:public-region-apis, r=lcnr
Make a minimal amount of region APIs public

Tools like Creusot, Prusti or Gillian-Rust need to access information about the loans and regions that exist in MIR programs. While `rustc` provides information about loans, there is currently no public way to reason about the regions present in a MIR program. In particular, we to know which regions are actually equal to each other and which ones outlive each other. Currently, `rustc` provides access to `RegionInferenceContext` but the public api hides that last portion of the information.

This PR proposes to make a few apis public, allowing verifiers to reason about the lifetimes present in Rust programs:
- [eval_equal](https://doc.rust-lang.org/beta/nightly-rustc/rustc_borrowck/region_infer/struct.RegionInferenceContext.html#method.eval_equal)
- [eval_outlives](https://doc.rust-lang.org/beta/nightly-rustc/rustc_borrowck/region_infer/struct.RegionInferenceContext.html#method.eval_outlives)
- (Optional) [constraint_sccs](https://doc.rust-lang.org/beta/nightly-rustc/rustc_borrowck/region_infer/struct.RegionInferenceContext.html#method.constraint_sccs)

The first two functions would allow us to compare regions and from this we can construct the set of `RegionVid` which are actually equal to each other, and then recover the inclusions between those regions, while the second allows for more direct, but _low level_ access to that information.
2024-05-09 19:09:29 +02:00
bors
238c1e798d Auto merge of #124773 - Marcondiro:master, r=joboet
fix #124714 str.to_lowercase sigma handling

Hello,
This PR fixes issue #124714 about 'Σ' handling in `str.to_lowercase()`.
The fix consists in considering the full original string during 'Σ' handling instead of considering just the substring left after the optimized ascii handling.
A new test is added to avoid regression.
Thanks!
2024-05-09 16:59:56 +00:00
Ralf Jung
95582e6fcb codegen: memmove/memset cannot be non-temporal 2024-05-09 18:59:00 +02:00
Michael Goulet
dbdef68ddf Make sure we consume a generic arg when checking mistyped turbofish 2024-05-09 10:47:14 -04:00
klensy
39159a3629 opt-dist: use xz2 instead of xz crate
xz crate consist of simple reexport of xz2 crate. Why? Idk.
2024-05-09 16:43:14 +03:00
bors
8c7c151a7a Auto merge of #124706 - Zalathar:revision-checker, r=jieyouxu
Tidy check for test revisions that are mentioned but not declared

If a `[revision]` name appears in a test header directive or error annotation, but isn't declared in the `//@ revisions:` header, that is almost always a mistake.

In cases where a revision needs to be temporarily disabled, adding it to an `//@ unused-revision-names:` header will suppress these checks for that name.

Adding the wildcard name `*` to the unused list will suppress these checks for the entire file.

(None of the tests actually use `*`; it's just there because it was easy to add and could be handy as an escape hatch when dealing with other problems.)

---

Most of the existing problems discovered by this check were fairly straightforward to fix (or ignore); the trickiest cases are in `borrowck` tests.
2024-05-09 13:06:40 +00:00
goofylfg
5120010b02 chore: remove repetitive words 2024-05-09 12:41:48 +00:00
Alex Macleod
3c52553912 Make #![feature] suggestion MaybeIncorrect 2024-05-09 13:18:09 +01:00
Ralf Jung
41d36a0951 interpret/miri: better errors on failing offset_from 2024-05-09 13:09:47 +02:00
bors
6f7e00a3e6 Auto merge of #124743 - Kobzol:arbitrary-try-build, r=pietroalbini
CI: enable arbitrary try builds, take two

Fixed version of https://github.com/rust-lang/rust/pull/124631, which hopefully won't completely break our CI this time 🤦‍♂️ Sorry once again. Only the last commit is new.

r? `@pietroalbini`
2024-05-09 10:39:50 +00:00
bors
d3f4d06c15 Auto merge of #3591 - RalfJung:win-symlink-trouble, r=RalfJung
do not run symlink tests on Windows hosts

Fixes https://github.com/rust-lang/miri/issues/3587
2024-05-09 10:30:11 +00:00
Ralf Jung
1edd3d59b0 do not run symlink tests on Windows hosts 2024-05-09 12:28:53 +02:00
Nicholas Nethercote
d6c63bdb21 Fix up DescriptionCtx::new.
The comment mentions that `ReBound` and `ReVar` aren't expected here.
Experimentation with the full test suite indicates this is true, and
that `ReErased` also doesn't occur. So the commit introduces `bug!` for
those cases. (If any of them show up later on, at least we'll have a
test case.)

The commit also remove the first sentence in the comment.
`RePlaceholder` is now handled in the match arm above this comment and
nothing is printed for it, so that sentence is just wrong. Furthermore,
issue #13998 was closed some time ago.
2024-05-09 20:15:44 +10:00
Nicholas Nethercote
609b9a67c9 Correct a comment.
I tried simplifying `RegionCtxt`, which led me to finding that the
fields are printed in `sccs_info`.
2024-05-09 20:15:42 +10:00
Nicholas Nethercote
fd91925bce Add ErrorGuaranteed to Recovered::Yes and use it more.
The starting point for this was identical comments on two different
fields, in `ast::VariantData::Struct` and `hir::VariantData::Struct`:
```
    // FIXME: investigate making this a `Option<ErrorGuaranteed>`
    recovered: bool
```
I tried that, and then found that I needed to add an `ErrorGuaranteed`
to `Recovered::Yes`. Then I ended up using `Recovered` instead of
`Option<ErrorGuaranteed>` for these two places and elsewhere, which
required moving `ErrorGuaranteed` from `rustc_parse` to `rustc_ast`.

This makes things more consistent, because `Recovered` is used in more
places, and there are fewer uses of `bool` and
`Option<ErrorGuaranteed>`. And safer, because it's difficult/impossible
to set `recovered` to `Recovered::Yes` without having emitted an error.
2024-05-09 20:12:07 +10:00
bors
3028864a53 Auto merge of #3590 - RalfJung:miri-test-target, r=RalfJung
make MIRI_TEST_TARGET and RUSTC_BLESS entirely an internal thing

They are just used to communicate between `./miri test`/`./x.py test miri` and the test harness, but should not be used by users.
2024-05-09 09:45:46 +00:00
Ralf Jung
cb44843900 make RUSTC_BLESS entirely an internal thing 2024-05-09 11:27:22 +02:00
Ralf Jung
e16f46cdab make MIRI_TEST_TARGET entirely an internal thing 2024-05-09 11:27:22 +02:00
bors
cb93c24bf3 Auto merge of #124157 - wutchzone:partial_eq, r=estebank
Do not add leading asterisk in the `PartialEq`

I think we should address this issue, however I am not exactly sure, if this is the right way to do it. It is related to the #123056.

Imagine the simplified code:

```rust
trait MyTrait {}

impl PartialEq for dyn MyTrait {
    fn eq(&self, _other: &Self) -> bool {
        true
    }
}

#[derive(PartialEq)]
enum Bar {
    Foo(Box<dyn MyTrait>),
}
```

On the nightly compiler, the `derive` produces invalid code with the weird error message:
```
error[E0507]: cannot move out of `*__arg1_0` which is behind a shared reference
  --> src/main.rs:11:9
   |
9  | #[derive(PartialEq)]
   |          --------- in this derive macro expansion
10 | enum Things {
11 |     Foo(Box<dyn MyTrait>),
   |         ^^^^^^^^^^^^^^^^ move occurs because `*__arg1_0` has type `Box<dyn MyTrait>`, which does not implement the `Copy` trait
   |
   = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
```

It may be related to the perfect derive problem, although requiring the _type_ to be `Copy` seems unfortunate because it is not necessary. Besides, we are adding the extra dereference only for the diagnostics?
2024-05-09 08:34:14 +00:00
Ralf Jung
fd2af9bf00 reachable computation: extend explanation of what this does, and why 2024-05-09 09:55:43 +02:00
bors
42d9b6890e Auto merge of #3588 - RossSmyth:CliTarget, r=RalfJung
Allow test targets to be set via CLI args

Fixes #3584

I'm not a pro shell script reader as I am a Windows user, but we shall see if the CI script broke.
2024-05-09 07:41:43 +00:00
Ralf Jung
d43cb7121e minor tweaks 2024-05-09 09:40:13 +02:00
bors
5f8c17dcc0 Auto merge of #124916 - matthiaskrgr:rollup-vmpmt4u, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #124777 (Fix Error Messages for `break` Inside Coroutines)
 - #124837 (Migrate `run-make/rustdoc-map-file` to rmake)
 - #124875 (Fix more ICEs in `diagnostic::on_unimplemented`)
 - #124908 (Handle field projections like slice indexing in invalid_reference_casting)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-09 06:14:00 +00:00
Zalathar
14d56e8338 Fix test problems discovered by the revision check
Most of these changes either add revision names that were apparently missing,
or explicitly mark a revision name as currently unused.
2024-05-09 14:47:09 +10:00
Zalathar
be590d3887 Tidy check for test revisions that are mentioned but not declared
If a `[revision]` name appears in a test header directive or error annotation,
but isn't declared in the `//@ revisions:` header, that is almost always a
mistake.

In cases where a revision needs to be temporarily disabled, adding it to an
`//@ unused-revision-names:` header will suppress these checks for that name.

Adding the wildcard name `*` to the unused list will suppress these checks for
the entire file.
2024-05-09 14:47:09 +10:00
Zalathar
1fbabc622f Include the line number in tidy's iter_header 2024-05-09 14:38:25 +10:00
Matthias Krüger
48b1e1a280
Rollup merge of #124908 - saethlin:ref-casting_bigger_place_projection, r=fee1-dead
Handle field projections like slice indexing in invalid_reference_casting

r? `@Urgau`

I saw the implementation in https://github.com/rust-lang/rust/pull/124761, and I was wondering if we also need to handle field access. We do. Without this PR, we get this errant diagnostic:
```
error: casting references to a bigger memory layout than the backing allocation is undefined behavior, even if the reference is unused
  --> /home/ben/rust/tests/ui/lint/reference_casting.rs:262:18
   |
LL |         let r = &mut v.0;
   |                      --- backing allocation comes from here
LL |         let ptr = r as *mut i32 as *mut Vec3<i32>;
   |                   ------------------------------- casting happend here
LL |         unsafe { *ptr = Vec3(0, 0, 0) }
   |                  ^^^^^^^^^^^^^^^^^^^^
   |
   = note: casting from `i32` (4 bytes) to `Vec3<i32>` (12 bytes)
```
2024-05-09 06:04:40 +02:00
Matthias Krüger
c49436df4c
Rollup merge of #124875 - compiler-errors:more-diagnostics-ices, r=estebank
Fix more ICEs in `diagnostic::on_unimplemented`

There were 8 other calls to `expect_local` left in `on_unimplemented.rs` -- all of which (afaict) could be turned into ICEs.

I would really like to see validation of `on_unimplemented` separated from parsing, so we only emit errors here:
a60f077c38/compiler/rustc_hir_analysis/src/check/check.rs (L836-L839)
...And gracefully fail instead when emitting trait predicate failures, not *ever* even trying to emit an error or a lint. But that's left for a separate PR.

r? `@estebank`
2024-05-09 06:04:39 +02:00
Matthias Krüger
4510ee3af3
Rollup merge of #124837 - GuillaumeGomez:migrate-rustdoc-map-file, r=jieyouxu
Migrate `run-make/rustdoc-map-file` to rmake

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

r? `@jieyouxu`
2024-05-09 06:04:39 +02:00
Matthias Krüger
9b834d01e5
Rollup merge of #124777 - veera-sivarajan:bugfix-124495-identify-gen-block, r=compiler-errors
Fix Error Messages for `break` Inside Coroutines

Fixes #124495

Previously, `break` inside `gen` blocks and functions
were incorrectly identified to be enclosed by a closure.

This PR fixes it by displaying an appropriate error message
for async blocks, async closures, async functions, gen blocks,
gen closures, gen functions, async gen blocks, async gen closures
and async gen functions.

Note: gen closure and async gen closure are not supported by the
compiler yet but I have added an error message here assuming that
they might be implemented in the future.

~~Also, fixes grammar in a few places by replacing
`inside of a $coroutine` with `inside a $coroutine`.~~
2024-05-09 06:04:38 +02:00
bors
37dc766378 Auto merge of #124831 - nnethercote:rustc_data_structures-cleanups, r=michaelwoerister
`rustc_data_structures` cleanups

Some improvements I found while looking through this code.

r? `@michaelwoerister`
2024-05-09 04:04:09 +00:00
Scott McMurray
c38f75c21f Make SSA aggregates without needing an alloca 2024-05-08 20:38:04 -07:00
Scott McMurray
7448c24e02 Aggregating arrays can always take the place path 2024-05-08 20:36:11 -07:00
Scott McMurray
443bdc0946 Add a codegen test for transparent aggregates 2024-05-08 20:36:11 -07:00
bors
ee9a9f84c5 Auto merge of #124793 - scottmcm:simplify-as-chunks, r=Nilstrieb
Implement `as_chunks` with `split_at_unchecked`

We were discussing various ways to do [this on Discord](https://discord.com/channels/273534239310479360/273541522815713281/1236946363120619521), and in the process I noticed that <https://rust.godbolt.org/z/1P16P37Go> is emitting a panic path inside `as_chunks`.  It optimizes out in release, but we could just not do that in the first place.

We're already doing unsafe code that depends on this value being calculated correctly, so might as well call `split_at_unchecked` instead of `split_at`.
2024-05-09 01:55:46 +00:00
Oneirical
304c183d4f correct comments 2024-05-08 21:44:57 -04:00
Nicholas Nethercote
69b86f6cae Remove unused LinkSelfContainedDefault::is_linker_enabled method. 2024-05-09 10:54:38 +10:00
Nicholas Nethercote
58a06b6a99 Remove enum_from_u32.
It's a macro that just creates an enum with a `from_u32` method. It has
two arms. One is unused and the other has a single use.

This commit inlines that single use and removes the whole macro. This
increases readability because we don't have two different macros
interacting (`enum_from_u32` and `language_item_table`).
2024-05-09 09:01:59 +10:00
Nicholas Nethercote
d3d01e1cd3 Remove vec_linked_list.
It provides a way to effectively embed a linked list within an
`IndexVec` and also iterate over that list. It's written in a very
generic way, involving two traits `Links` and `LinkElem`. But the
`Links` trait is only impl'd for `IndexVec` and `&IndexVec`, and the
whole thing is only used in one module within `rustc_borrowck`. So I
think it's over-engineered and hard to read. Plus it has no comments.

This commit removes it, and adds a (non-generic) local iterator for the
use within `rustc_borrowck`. Much simpler.
2024-05-09 08:13:24 +10:00
Nicholas Nethercote
f5d7d346a4 Remove TinyList.
It is optimized for lists with a single element, avoiding the need for
an allocation in that case. But `SmallVec<[T; 1]>` also avoids the
allocation, and is better in general: more standard, log2 number of
allocations if the list exceeds one item, and a much more capable API.

This commit removes `TinyList` and converts the two uses to
`SmallVec<[T; 1]>`. It also reorders the `use` items in the relevant
file so they are in just two sections (`pub` and non-`pub`), ordered
alphabetically, instead of many sections. (This is a relevant part of
the change because I had to decide where to add a `use` item for
`SmallVec`.)
2024-05-09 08:13:24 +10:00
Nicholas Nethercote
d7814e72eb Document Pu128.
And move the `repr` line after the `derive` line, where it's harder to
overlook. (I overlooked it initially, and didn't understand how this
type worked.)
2024-05-09 08:13:24 +10:00
Ross Smyth
620bf348e1 Update documentation for miri-script test changes 2024-05-08 18:05:28 -04:00
Ross Smyth
6e564ed9fd Update CI script for the miri-script test changes 2024-05-08 18:05:28 -04:00