Commit graph

250473 commits

Author SHA1 Message Date
Matthias Krüger 445507a19d add test for ice 83056 "bad input type for cast"
Fixes #83056
2024-03-24 09:23:12 +01:00
Matthias Krüger 19310ce2cc add test for str as extern "C" arg causes compiler panic #80125
Fixes #80125
2024-03-24 09:23:12 +01:00
Matthias Krüger a5ad0be52f add test for #64784 Declarative macros can create infinite glob import cycles
Fixes #64784
2024-03-24 09:23:12 +01:00
Matthias Krüger 14d05c4c4b add test for #52334
Fixes #52334
2024-03-24 09:23:12 +01:00
bors 548e14b439 Auto merge of #122966 - matthiaskrgr:rollup-20k8nsm, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #121281 (regression test for #103626)
 - #122168 (Fix validation on substituted callee bodies in MIR inliner)
 - #122217 (Handle str literals written with `'` lexed as lifetime)
 - #122379 (transmute: caution against int2ptr transmutation)
 - #122840 (`rustdoc --test`: Prevent reaching the maximum size of command-line by using files for arguments if there are too many)
 - #122907 (Uniquify `ReError` on input mode in canonicalizer)
 - #122942 (Add test in higher ranked subtype)
 - #122943 (add a couple more ice tests)
 - #122963 (core/panicking: fix outdated comment)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-24 02:30:17 +00:00
Matthias Krüger 6f16b41a4b
Rollup merge of #122963 - RalfJung:core-panicking, r=m-ou-se
core/panicking: fix outdated comment

Looks like this function got renamed/changed at some point and the comment did not get updated.

r? `@m-ou-se`
2024-03-24 01:05:54 +01:00
Matthias Krüger 2463ad0f5f
Rollup merge of #122943 - matthiaskrgr:ice-tests-9xxxx-to-12xxxx, r=fmease
add a couple more ice tests

Fixes rust-lang/rust#104779
Fixes rust-lang/rust#106423
Fixes rust-lang/rust#106444
Fixes rust-lang/rust#101852
Fixes rust-lang/rust#106874
Fixes rust-lang/rust#105047
Fixes rust-lang/rust#107228
Fixes rust-lang/rust#99945
2024-03-24 01:05:54 +01:00
Matthias Krüger d8c224267d
Rollup merge of #122942 - Luv-Ray:master, r=lcnr
Add test in higher ranked subtype

I'm a beginner in this repository, and there are some things I'm not sure about:

- Is it okay that there is a warning:
```
rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit) }
```
- Is it okay that there are two duplicate errors in the same line?
- Did I put the test in the right place?

Any suggestions would be appreciated.

Fixes #121649
2024-03-24 01:05:54 +01:00
Matthias Krüger cb03714e6f
Rollup merge of #122907 - compiler-errors:uniquify-reerror, r=lcnr
Uniquify `ReError` on input mode in canonicalizer

See test descr

Fixes #122861

r? lcnr
2024-03-24 01:05:53 +01:00
Matthias Krüger 73038c0874
Rollup merge of #122840 - GuillaumeGomez:rustdoc-test-too-many-args, r=notriddle,Urgau,jieyouxu
`rustdoc --test`: Prevent reaching the maximum size of command-line by using files for arguments if there are too many

Fixes #122722.

Thanks to this I discovered that rust was using ``@`` to add arguments from a file, quite convenient.

If there are too many `cfg` arguments given to `rustdoc --test`, it'll now put them into a temporary file and passing it as argument to the rustc command.

I added a test with 100_000 `cfg` arguments to ensure it'll not break again.

r? `@notrid`
2024-03-24 01:05:53 +01:00
Matthias Krüger 2dcc96883e
Rollup merge of #122379 - RalfJung:int2ptr-transmute, r=m-ou-se
transmute: caution against int2ptr transmutation

This came up in https://github.com/rust-lang/rust/pull/121282.
Cc ```@saethlin``` ```@scottmcm```

Eventually we'll add a proper description of provenance that we can reference, but that's a bunch of work and it's unclear who will have the time to do that when. Meanwhile, let's at least do what we can without mentioning provenance explicitly.
2024-03-24 01:05:52 +01:00
Matthias Krüger 1164c2725e
Rollup merge of #122217 - estebank:issue-119685, r=fmease
Handle str literals written with `'` lexed as lifetime

Given `'hello world'` and `'1 str', provide a structured suggestion for a valid string literal:

```
error[E0762]: unterminated character literal
  --> $DIR/lex-bad-str-literal-as-char-3.rs:2:26
   |
LL |     println!('hello world');
   |                          ^^^^
   |
help: if you meant to write a `str` literal, use double quotes
   |
LL |     println!("hello world");
   |              ~           ~
```
```
error[E0762]: unterminated character literal
  --> $DIR/lex-bad-str-literal-as-char-1.rs:2:20
   |
LL |     println!('1 + 1');
   |                    ^^^^
   |
help: if you meant to write a `str` literal, use double quotes
   |
LL |     println!("1 + 1");
   |              ~     ~
```

Fix #119685.
2024-03-24 01:05:51 +01:00
Matthias Krüger 3d9ee88ea2
Rollup merge of #122168 - compiler-errors:inline-coroutine-body-validation, r=cjgillot
Fix validation on substituted callee bodies in MIR inliner

When inlining a coroutine, we will substitute the MIR body with the args of the call. There is code in the MIR validator that attempts to prevent query cycles, and will use the coroutine body directly when it detects that's the body that's being validated. That means that when inlining a coroutine body that has been substituted, it may no longer be parameterized over the original args of the coroutine, which will lead to substitution ICEs.

Fixes #119064
2024-03-24 01:05:51 +01:00
Matthias Krüger 516758136e
Rollup merge of #121281 - kadiwa4:test_103626, r=estebank,lcnr
regression test for #103626

I don't know what a descriptive filename for this would be.

Fixes #103626
2024-03-24 01:05:50 +01:00
bors 9b8d12cf4c Auto merge of #122905 - dpaoliello:sync-portable-simd-2024-03-22, r=workingjubilee
Portable SIMD subtree update

Syncs nightly to the latest changes from rust-lang/portable-simd

r? `@calebzulawski`
2024-03-24 00:02:14 +00:00
bors 2f090c30dd Auto merge of #122629 - RalfJung:assert-unsafe-precondition, r=saethlin
refactor check_{lang,library}_ub: use a single intrinsic

This enacts the plan I laid out [here](https://github.com/rust-lang/rust/pull/122282#issuecomment-1996917998): use a single intrinsic, called `ub_checks` (in aniticpation of https://github.com/rust-lang/compiler-team/issues/725), that just exposes the value of `debug_assertions` (consistently implemented in both codegen and the interpreter). Put the language vs library UB logic into the library.

This makes it easier to do something like https://github.com/rust-lang/rust/pull/122282 in the future: that just slightly alters the semantics of `ub_checks` (making it more approximating when crates built with different flags are mixed), but it no longer affects whether these checks can happen in Miri or compile-time.

The first commit just moves things around; I don't think these macros and functions belong into `intrinsics.rs` as they are not intrinsics.

r? `@saethlin`
2024-03-23 21:11:00 +00:00
Ralf Jung e74b01e925 core/panicking: fix outdated comment 2024-03-23 21:36:22 +01:00
Guillaume Gomez bc4f1697fa Add regression test for #122722 2024-03-23 20:13:22 +01:00
Guillaume Gomez 5fab0162cc Add Rustdoc into run-make-support 2024-03-23 20:13:14 +01:00
bors e50ab29471 Auto merge of #122952 - RalfJung:miri, r=RalfJung
Miri subtree update

r? `@ghost`
2024-03-23 18:38:18 +00:00
Ralf Jung 6177530420 refactor check_{lang,library}_ub: use a single intrinsic, put policy into library 2024-03-23 18:45:05 +01:00
Ralf Jung 987ef4c922 move assert_unsafe_preconditions to its own file
These macros and functions are not intrinsics, after all.
2024-03-23 18:44:17 +01:00
Kalle Wachsmuth 188c46a65e
regression test for #103626 2024-03-23 17:48:57 +01:00
bors 020bbe46bd Auto merge of #122947 - matthiaskrgr:rollup-10j7orh, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #120577 (Stabilize slice_split_at_unchecked)
 - #122698 (Cancel `cargo update` job if there's no updates)
 - #122780 (Rename `hir::Local` into `hir::LetStmt`)
 - #122915 (Delay a bug if no RPITITs were found)
 - #122916 (docs(sync): normalize dot in fn summaries)
 - #122921 (Enable more mir-opt tests in debug builds)
 - #122922 (-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.)
 - #122927 (Change an ICE regression test to use the original reproducer)
 - #122930 (add panic location to 'panicked while processing panic')
 - #122931 (Fix some typos in the pin.rs)
 - #122933 (tag_for_variant follow-ups)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-23 15:58:17 +00:00
bors 59b29455c1 Auto merge of #3385 - Zoxc:read-types, r=RalfJung
Report retags as distinct from real memory accesses for data races

This changes the error reporting for data races such that reference invariants are no longer reported as real read and writes.

Before:
```
Data race detected between (1) non-atomic write on thread `unnamed-6` and (2) non-atomic read on thread `unnamed-5` at alloc1034971+0x10c. (2) just happened here
```

After:
```
Data race detected between (1) non-atomic write on thread `unnamed-8` and (2) shared reference invariant on thread `unnamed-6` at alloc1018329+0x190. (2) just happened here
```

Non-atomic read accesses from the *other* thread don't have this information tracked so those are called `some potential non-atomic read access` here.
2024-03-23 15:37:02 +00:00
Luv-Ray 246f7465b3 Add test in higher-ranked 2024-03-23 23:33:43 +08:00
Matthias Krüger 9aea37d3c1 address review feedback 2024-03-23 16:14:42 +01:00
John Kåre Alsaker 2d610f7473 Report retags as distinct from real memory accesses for data races 2024-03-23 15:29:05 +01:00
Guillaume Gomez 773084ff2f Rename RustdocTestOptions into IndividualTestOptions 2024-03-23 15:00:37 +01:00
Matthias Krüger fce80392d2
Rollup merge of #122933 - RalfJung:tag_for_variant, r=oli-obk
tag_for_variant follow-ups

Follow-up to https://github.com/rust-lang/rust/pull/122784, mostly to clarify the doc comment.
2024-03-23 15:00:21 +01:00
Matthias Krüger 9ff7a65752
Rollup merge of #122931 - herobs:patch-1, r=joboet
Fix some typos in the pin.rs
2024-03-23 15:00:21 +01:00
Matthias Krüger 691d5f533d
Rollup merge of #122930 - RalfJung:panic-in-panic-fmt, r=Amanieu
add panic location to 'panicked while processing panic'

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

r? `@Amanieu`
2024-03-23 15:00:20 +01:00
Matthias Krüger aaf5f3b53e
Rollup merge of #122927 - gurry:122199-ice-unexpected-node-2, r=workingjubilee
Change an ICE regression test to use the original reproducer

The ICE was fixed in PR https://github.com/rust-lang/rust/pull/122370, but the test used a different reproducer than the one originally reported. This PR changes it to the original one, giving us more confidence that the fix works.

Fixes #122199
2024-03-23 15:00:20 +01:00
Matthias Krüger 9418f69446
Rollup merge of #122922 - kpreid:print-async, r=compiler-errors
-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.

This should assist comprehending the size of coroutines. In particular, whenever a future is suspended while awaiting another future, the latter is given the special name `__awaitee`, and now the type of the awaited future will be printed, allowing identifying caller/callee — er, I mean, poller/pollee — relationships.

It would be possible to include the type name in more cases, but I thought that that might be overly verbose (`print-type-sizes` is already a lot of text) and ordinary named fields or variables are easier for readers to discover the types of.

This change will also synergize with my other PR #122923 which changes type printing to print the path of the `async fn` instead of the span.

Implementation note: I'm not sure if `Symbol::intern` is appropriate for this application, but it was the obvious way to not have to remove the `Copy` implementation from `FieldInfo`, or add a `'tcx` lifetime, while avoiding keeping a lot of possibly redundant strings in memory. I don't know what the proper tradeoff to make here is (though presumably it is not too important for a `-Z` debugging option).
2024-03-23 15:00:20 +01:00
Matthias Krüger fd8a8c1a7e
Rollup merge of #122921 - saethlin:mir-opt-tests-in-debug, r=Mark-Simulacrum
Enable more mir-opt tests in debug builds

This is https://github.com/rust-lang/rust/pull/121531 but for the mir-opt test suite.
2024-03-23 15:00:19 +01:00
Matthias Krüger eee0cd11a4
Rollup merge of #122916 - MultisampledNight:docs-sync-typo, r=jhpratt
docs(sync): normalize dot in fn summaries

All other functions in e.g. [`Mutex`](https://doc.rust-lang.org/std/sync/struct.Mutex.html) have a dot at the end of their first doc line, except for the newly stabilized [`Mutex::clear_poison`](https://doc.rust-lang.org/std/sync/struct.Mutex.html#method.clear_poison) (and its friend [`RwLock::clear_poison`](https://doc.rust-lang.org/std/sync/struct.RwLock.html#method.clear_poison)).

This PR remedies that by adding a normalizing dot.
2024-03-23 15:00:19 +01:00
Matthias Krüger f03326c579
Rollup merge of #122915 - fmease:lt-opaq-mismatch-delay-bug, r=compiler-errors
Delay a bug if no RPITITs were found

Fixes #122655. See the issue for context.

r? compiler-errors or compiler
2024-03-23 15:00:18 +01:00
Matthias Krüger 99e34b4f7a
Rollup merge of #122780 - GuillaumeGomez:rename-hir-local, r=oli-obk
Rename `hir::Local` into `hir::LetStmt`

Follow-up of #122776.

As discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Improve.20naming.20of.20.60ExprKind.3A.3ALet.60.3F).

I made this change into a separate PR because I'm less sure about this change as is. For example, we have `visit_local` and `LocalSource` items. Is it fine to keep these two as is (I supposed it is but I prefer to ask) or not? Having `Node::Local(LetStmt)` makes things more explicit but is it going too far?

r? ```@oli-obk```
2024-03-23 15:00:18 +01:00
Matthias Krüger 154d0962ee
Rollup merge of #122698 - clubby789:cancel-hourly-update, r=Mark-Simulacrum
Cancel `cargo update` job if there's no updates

Previously there were always updates so we didn't hit this. Since #122489, this job runs on a more frequent schedule and causes errors if there have been no changes in that timespan.

This led to a weird error on https://github.com/rust-lang/rust/pull/122646#issuecomment-2004339093 - because of this I've replaced the `exit 1`s here with `gh run cancel` so we don't have false 'failed' jobs in the logs.
2024-03-23 15:00:17 +01:00
Matthias Krüger 71ce3c26e6
Rollup merge of #120577 - wutchzone:slice_split_at_unchecked, r=m-ou-se
Stabilize slice_split_at_unchecked

Greetings!

I took the opportunity, and I tried to stabilize the `slice_split_at_unchecked` feature. I followed the guidelines, and I hope everything was done correctly 🤞 .

Closes #76014
2024-03-23 15:00:17 +01:00
bors d6eb0f5a09 Auto merge of #122582 - scottmcm:swap-intrinsic-v2, r=oli-obk
Let codegen decide when to `mem::swap` with immediates

Making `libcore` decide this is silly; the backend has so much better information about when it's a good idea.

Thus this PR introduces a new `typed_swap` intrinsic with a fallback body, and replaces that fallback implementation when swapping immediates or scalar pairs.

r? oli-obk

Replaces #111744, and means we'll never need more libs PRs like #111803 or #107140
2024-03-23 13:57:55 +00:00
Guillaume Gomez 86fe40021f Put temporary directory into one common function 2024-03-23 14:52:49 +01:00
Guillaume Gomez 33735d5913 Prevent cloning more than necessary RustdocOptions fields 2024-03-23 14:42:48 +01:00
Guillaume Gomez 0d3ef800b9 rustdoc --test: Prevent reaching the maximum size of command-line by using files for arguments if there are too many 2024-03-23 14:42:48 +01:00
Matthias Krüger 368bfb2c10 add test for #107228
Fixes #107228
2024-03-23 13:05:22 +01:00
Matthias Krüger f2bc9c5997 add test for #106874 ICE BoundUniversalRegionError
Fixes #106874
2024-03-23 12:50:21 +01:00
Matthias Krüger cc422cee97 add test for ICE #106444
Fixes #106444
2024-03-23 12:38:50 +01:00
Matthias Krüger f8aeac8a36 add test for #106423
Fixes #106423
2024-03-23 12:32:32 +01:00
Matthias Krüger f1f287fadb add test for ICE "raw ptr comparison should already be caught in the trait system" #105047
Fixes #105047
2024-03-23 12:24:40 +01:00
Matthias Krüger e54bff7109 add test for #104779 opaque types, patterns and subtyping ICE: IndexMap: key not found
Fixes #104779
2024-03-23 12:19:05 +01:00