Commit Graph

4461 Commits

Author SHA1 Message Date
León Orell Valerian Liehr
8d81d5a909
Validate crate name in CLI option --extern 2023-09-20 18:50:40 +02:00
bors
f0727758d1 Auto merge of #115139 - cjgillot:llvm-fragment, r=nikic
Do not forget to pass DWARF fragment information to LLVM.

Fixes https://github.com/rust-lang/rust/issues/115113 for the rustc part
2023-08-27 14:06:57 +00:00
Matthias Krüger
ce7993670b
Rollup merge of #114957 - loongarch-rs:fix-tests, r=Mark-Simulacrum
tests: Fix tests for LoongArch64

This PR fixes `lp64d abi` tests for LoongArch64.
2023-08-27 09:45:18 +02:00
Matthias Krüger
be416b99ed
Rollup merge of #114924 - Zalathar:tidy-tests, r=Mark-Simulacrum
coverage: Tidy up `run-coverage` tests in several small ways

Prior to #114875 (anonymized line numbers), these tests were very sensitive to lines being added/removed, since doing so would change the line numbers in every subsequent line of output. Therefore they ended up with a few small style issues that weren't worth the hassle of fixing.

Now that we can freely rearrange lines without needing to re-bless the entire output, we can tidy up the tests in various trivial ways.
2023-08-27 09:45:17 +02:00
Camille GILLOT
5529e2f893 Restrict test to x86_64. 2023-08-26 22:55:52 +00:00
bors
e877e2a2c9 Auto merge of #115219 - estebank:issue-105306, r=compiler-errors
Point at type parameter that introduced unmet bound instead of full HIR node

```
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
  --> $DIR/issue-87199.rs:18:15
   |
LL |     ref_arg::<[i32]>(&[5]);
   |               ^^^^^ doesn't have a size known at compile-time
```
instead of
```
error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
  --> $DIR/issue-87199.rs:18:22
   |
LL |     ref_arg::<[i32]>(&[5]);
   |     ---------------- ^^^^ doesn't have a size known at compile-time
   |     |
   |     required by a bound introduced by this call
```

------

```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/own-bound-span.rs:14:24
   |
LL |     let _: <S as D>::P<String>;
   |                        ^^^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `D::P`
  --> $DIR/own-bound-span.rs:4:15
   |
LL |     type P<T: Copy>;
   |               ^^^^ required by this bound in `D::P`
```
instead of
```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/own-bound-span.rs:14:12
   |
LL |     let _: <S as D>::P<String>;
   |            ^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `D::P`
  --> $DIR/own-bound-span.rs:4:15
   |
LL |     type P<T: Copy>;
   |               ^^^^ required by this bound in `D::P`
```
Fix #105306.
2023-08-26 22:31:53 +00:00
Esteban Küber
7411e25abe Account for Weak alias kinds when adding more targetted obligation 2023-08-26 20:10:19 +00:00
Esteban Küber
ef11db803c Remove unnecessary select_obligations_where_possible and redundant errors 2023-08-26 19:35:54 +00:00
Esteban Küber
b6494a7bb4 More accurately point at arguments 2023-08-26 19:25:46 +00:00
Camille GILLOT
930b2e72ee Do not produce fragment for ZST. 2023-08-26 16:54:28 +00:00
Camille GILLOT
f49494ecce Add test with non-ZST. 2023-08-26 14:21:10 +00:00
Camille GILLOT
b3bbc22cb7 Do not forget to pass DWARF fragment information to LLVM. 2023-08-26 14:21:10 +00:00
Matthias Krüger
f0bbc2593e
Rollup merge of #115244 - GuillaumeGomez:migrate-gui-test-color-36, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? `@notriddle`
2023-08-26 13:08:34 +02:00
Guillaume Gomez
a448468e28 Remove unneeded "background_color" parameter 2023-08-26 11:25:04 +02:00
Guillaume Gomez
e55ad9b0eb Migrate GUI colors test to original CSS color format 2023-08-26 11:23:54 +02:00
bors
42857db66d Auto merge of #115232 - wesleywiser:revert_114643, r=tmiasko
Revert "Use the same DISubprogram for each instance of the same inline function within the caller"

This reverts commit 687bffa493.

Reverting to resolve ICEs reported on nightly.

cc `@dpaoliello`

Fixes #115156
2023-08-26 07:47:26 +00:00
Zalathar
8d91e71e9a Various trivial formatting fixes in run-coverage tests
These changes were made by manually running `rustfmt` on all of the test files,
and then manually undoing all cases where the original formatting appeared to
have been deliberate.

  `rustfmt +nightly --config-path=/dev/null --edition=2021 tests/run-coverage*/**/*.rs`
2023-08-26 14:35:34 +10:00
Zalathar
4da38c31d2 Tidy up some awkwardly-placed comments in tests
Prior to #114875, these tests were very sensitive to lines being added/removed,
so the migration to `run-coverage` in #112300 tried hard to avoid disturbing
the existing line numbers. That resulted in some awkward reshuffling when
certain comments/directives needed to be added or moved.

Now that we don't have to worry about preserving line numbers, we can rearrange
those comments into a more conventional layout.
2023-08-26 14:35:34 +10:00
Zalathar
72b721f48e Resolve all warnings in run-coverage tests
When one of these tests fails, any compiler warnings will be printed to the
console, which makes it harder to track down the actual reason for failure.

(The outstanding warnings were found by temporarily adding `-Dwarnings` to the
compiler arguments for `RunCoverage` in `src/tools/compiletest/src/runtest.rs`.)
2023-08-26 14:35:34 +10:00
Scott McMurray
84e305dd93 Stop emitting non-power-of-two vectors in basic LLVM codegen 2023-08-25 20:06:57 -07:00
Esteban Küber
bac0e556f0 On let binding type point to type parameter that introduced unmet bound
On the following example, point at `String` instead of the whole type:

```
error[E0277]: the trait bound `String: Copy` is not satisfied
  --> $DIR/own-bound-span.rs:14:24
   |
LL |     let _: <S as D>::P<String>;
   |                        ^^^^^^ the trait `Copy` is not implemented for `String`
   |
note: required by a bound in `D::P`
  --> $DIR/own-bound-span.rs:4:15
   |
LL |     type P<T: Copy>;
   |               ^^^^ required by this bound in `D::P`
```
2023-08-26 02:23:25 +00:00
Esteban Küber
120c24dab5 Point at appropriate type parameter in more trait bound errors 2023-08-26 01:07:05 +00:00
Wesley Wiser
d0b2c4f727 Revert "Use the same DISubprogram for each instance of the same inlined function within the caller"
This reverts commit 687bffa493.

Reverting to resolve ICEs reported on nightly.
2023-08-25 19:49:10 -04:00
Michael Goulet
13e8b13e15 Handle Self in paths too 2023-08-25 19:05:38 +00:00
Michael Goulet
055452864e Walk through full path in point_at_path_if_possible 2023-08-25 19:05:38 +00:00
bors
a8b905cd78 Auto merge of #115158 - Enselic:break-rust-args, r=compiler-errors
Include compiler flags when you `break rust;`

Closes #70661

r? `@RalfJung` who requested this feature :)
2023-08-25 15:16:17 +00:00
bors
25ed43ddf3 Auto merge of #115138 - cjgillot:dse-move-packed, r=compiler-errors
Do not convert copies of packed projections to moves.

This code path was introduced in https://github.com/rust-lang/rust/pull/113758

After seeing https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/Packed.20fields.20and.20in-place.20function.20argument.2Freturn.20passing, this may be UB, so should be disallowed.

This should not appear in normally-built MIR, which introduces temporary copies for packed projections.
2023-08-25 13:27:21 +00:00
bors
b60f7b51a2 Auto merge of #115045 - RalfJung:unwind-terminate-reason, r=davidtwco
when terminating during unwinding, show the reason why

With this, the output on double-panic becomes something like that:
```
thread 'main' panicked at src/tools/miri/tests/fail/panic/double_panic.rs:15:5:
first
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at src/tools/miri/tests/fail/panic/double_panic.rs:10:9:
second
stack backtrace:
   0:           0xbe273a - std::backtrace_rs::backtrace::miri::trace_unsynchronized::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
                               at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:99:5
   1:           0xbe22e6 - std::backtrace_rs::backtrace::miri::trace::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
                               at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:62:14
   2:           0xbe1086 - std::backtrace_rs::backtrace::trace_unsynchronized::<[closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
                               at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   3:           0xba3afd - std::sys_common::backtrace::_print_fmt
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:67:5
   4:           0xba2471 - <std::sys_common::backtrace::_print::DisplayBacktrace as std::fmt::Display>::fmt
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:44:22
   5:           0xbcf754 - core::fmt::rt::Argument::<'_>::fmt
                               at /home/r/src/rust/rustc.3/library/core/src/fmt/rt.rs:138:9
   6:           0x9b8f81 - std::fmt::write
                               at /home/r/src/rust/rustc.3/library/core/src/fmt/mod.rs:1094:17
   7:           0x21391d - <std::sys::unix::stdio::Stderr as std::io::Write>::write_fmt
                               at /home/r/src/rust/rustc.3/library/std/src/io/mod.rs:1714:15
   8:           0xba37b1 - std::sys_common::backtrace::_print
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:47:5
   9:           0xba365b - std::sys_common::backtrace::print
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:34:9
  10:           0x143c67 - std::panic_hook_with_disk_dump::{closure#1}
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:278:22
  11:           0x144187 - std::panic_hook_with_disk_dump
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:312:9
  12:           0x143659 - std::panicking::default_hook
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:239:5
  13:           0x1482a7 - std::panicking::rust_panic_with_hook
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:729:13
  14:           0x1475d5 - std::rt::begin_panic::<&str>::{closure#0}
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:650:9
  15:           0xba496a - std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::rt::begin_panic<&str>::{closure#0}], !>
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:170:18
  16:           0x147599 - std::rt::begin_panic::<&str>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:649:12
  17:            0x31916 - <Foo as std::ops::Drop>::drop
                               at src/tools/miri/tests/fail/panic/double_panic.rs:10:9
  18:           0x1a2b5e - std::ptr::drop_in_place::<Foo> - shim(Some(Foo))
                               at /home/r/src/rust/rustc.3/library/core/src/ptr/mod.rs:497:1
  19:            0x202bf - main
                               at src/tools/miri/tests/fail/panic/double_panic.rs:16:1
  20:            0xcc6a8 - <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
                               at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:250:5
  21:           0xba47d9 - std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:154:18
  22:           0x141a6a - std::rt::lang_start::<()>::{closure#0}
                               at /home/r/src/rust/rustc.3/library/std/src/rt.rs:166:18
  23:            0xcca18 - std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
                               at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:284:13
  24:           0x146469 - std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
  25:           0x145e09 - std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
  26:            0x7b0ac - std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
                               at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
  27:           0x14189b - std::rt::lang_start_internal::{closure#2}
                               at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:48
  28:           0x146481 - std::panicking::try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
  29:           0x145e2c - std::panicking::try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
  30:            0x7b0d5 - std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
                               at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
  31:           0x1418b0 - std::rt::lang_start_internal
                               at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:20
  32:           0x141a97 - std::rt::lang_start::<()>
                               at /home/r/src/rust/rustc.3/library/std/src/rt.rs:165:17
thread 'main' panicked at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:126:5:
panic in a destructor during cleanup
stack backtrace:
   0:           0xe9f6d7 - std::backtrace_rs::backtrace::miri::trace_unsynchronized::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
                               at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:99:5
   1:           0xe9f27d - std::backtrace_rs::backtrace::miri::trace::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
                               at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:62:14
   2:           0xe9e016 - std::backtrace_rs::backtrace::trace_unsynchronized::<[closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
                               at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   3:           0xba3afd - std::sys_common::backtrace::_print_fmt
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:67:5
   4:           0xba2471 - <std::sys_common::backtrace::_print::DisplayBacktrace as std::fmt::Display>::fmt
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:44:22
   5:           0xbcf754 - core::fmt::rt::Argument::<'_>::fmt
                               at /home/r/src/rust/rustc.3/library/core/src/fmt/rt.rs:138:9
   6:           0x9b8f81 - std::fmt::write
                               at /home/r/src/rust/rustc.3/library/core/src/fmt/mod.rs:1094:17
   7:           0x4d0895 - <std::sys::unix::stdio::Stderr as std::io::Write>::write_fmt
                               at /home/r/src/rust/rustc.3/library/std/src/io/mod.rs:1714:15
   8:           0xba37b1 - std::sys_common::backtrace::_print
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:47:5
   9:           0xba365b - std::sys_common::backtrace::print
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:34:9
  10:           0x400bd4 - std::panic_hook_with_disk_dump::{closure#1}
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:278:22
  11:           0x144187 - std::panic_hook_with_disk_dump
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:312:9
  12:           0x143659 - std::panicking::default_hook
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:239:5
  13:           0x1482a7 - std::panicking::rust_panic_with_hook
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:729:13
  14:           0x40403b - std::panicking::begin_panic_handler::{closure#0}
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:619:13
  15:           0xe618b3 - std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:170:18
  16:           0x403fc8 - std::panicking::begin_panic_handler
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:617:5
  17:           0xee23e9 - core::panicking::panic_nounwind_fmt
                               at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:96:14
  18:           0xee29e6 - core::panicking::panic_nounwind
                               at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:126:5
  19:           0xee365e - core::panicking::panic_in_cleanup
                               at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:206:5
  20:            0x2028a - main
                               at src/tools/miri/tests/fail/panic/double_panic.rs:13:1
  21:           0x3895ee - <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
                               at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:250:5
  22:           0xe61725 - std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
                               at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:154:18
  23:           0x3fe9aa - std::rt::lang_start::<()>::{closure#0}
                               at /home/r/src/rust/rustc.3/library/std/src/rt.rs:166:18
  24:           0x389962 - std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
                               at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:284:13
  25:           0x4033b9 - std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
  26:           0x402d58 - std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
  27:           0x337ff7 - std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
                               at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
  28:           0x3fe7e7 - std::rt::lang_start_internal::{closure#2}
                               at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:48
  29:           0x4033d6 - std::panicking::try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
  30:           0x402d7f - std::panicking::try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>
                               at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
  31:           0x338028 - std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
                               at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
  32:           0x1418b0 - std::rt::lang_start_internal
                               at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:20
  33:           0x3fe9dc - std::rt::lang_start::<()>
                               at /home/r/src/rust/rustc.3/library/std/src/rt.rs:165:17
thread caused non-unwinding panic. aborting.
```
If we also land https://github.com/rust-lang/rust/pull/115020, the 2nd backtrace disappears, hopefully making the "panic in a destructor during cleanup" easier to see.

Fixes https://github.com/rust-lang/rust/issues/114954.
2023-08-25 08:47:18 +00:00
Matthias Krüger
d4b6cff42f
Rollup merge of #115169 - RalfJung:do-not-ignore-debug, r=cjgillot
remove some unnecessary ignore-debug clauses

ignore-debug is only needed when the debug assertions *in the standard library* somehow affect the test. This can happen with inlining but otherwise should be rare. ignore-debug is problematic since PR CI is only run with debug assertions.

r? `@cjgillot` since it looks like you added most of these
2023-08-25 09:00:14 +02:00
Matthias Krüger
adc0c914d4
Rollup merge of #115151 - rcvalle:rust-cfi-fix-115150, r=compiler-errors
Fix CFI: f32 and f64 are encoded incorrectly for cross-language CFI

Fix #115150 by encoding f32 and f64 correctly for cross-language CFI. I missed changing the encoding for f32 and f64 when I introduced the integer normalization option in #105452 as integer normalization does not include floating point. `f32` and `f64` should be always encoded as `f` and `d` since they are both FFI safe when their representation are the same (i.e., IEEE 754) for both the Rust compiler and Clang.
2023-08-25 09:00:13 +02:00
Ralf Jung
df5a248cb1 keep trying which flags we need for this test until it passes bors 2023-08-25 08:20:19 +02:00
Ramon de C Valle
5d6e2d7050 Fix CFI: f32 and f64 are encoded incorrectly for c
Fix #115150 by encoding f32 and f64 correctly for cross-language CFI. I
missed changing the encoding for f32 and f64 when I introduced the
integer normalization option in #105452 as integer normalization does
not include floating point. `f32` and `f64` should be always encoded as
`f` and `d` since they are both FFI safe when their representation are
the same (i.e., IEEE 754) for both the Rust compiler and Clang.
2023-08-24 21:02:06 -07:00
bors
c9228aeaba Auto merge of #115193 - weihanglo:rollup-6s3mz06, r=weihanglo
Rollup of 9 pull requests

Successful merges:

 - #114987 (elaborate a bit on the (lack of) safety in 'Mmap::map')
 - #115084 (Add smir `predicates_of`)
 - #115117 (Detect and report nix shell)
 - #115124 (kmc-solid: Import `std::sync::PoisonError` in `std::sys::solid::os`)
 - #115152 (refactor(lint): translate `RenamedOrRemovedLint`)
 - #115154 (Move some ui tests to subdirectories)
 - #115167 (Fix ub-int-array test for big-endian platforms)
 - #115172 (Add more tests for if_let_guard)
 - #115177 (Add symbols for Clippy usage)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-25 03:30:23 +00:00
bors
c75b6bdb37 Auto merge of #114397 - sebastiantoh:issue-85222, r=Nadrieril
Add note when matching on tuples/ADTs containing non-exhaustive types

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

r? `@Nadrieril`
2023-08-25 01:44:07 +00:00
bors
4354192429 Auto merge of #114201 - Centri3:explicit-repr-rust, r=WaffleLapkin
Allow explicit `#[repr(Rust)]`

This is identical to no `repr()` at all. For `Rust, packed` and `Rust, align(x)`, it should be the same as no `Rust` at all (as, afaik, `#[repr(align(16))]` uses the Rust ABI.)

The main use case for this is being able to explicitly say "I want to use the Rust ABI" in very very rare circumstances where the first obvious choice would be the C ABI yet is undesirable, which is already possible with functions as `extern "Rust"`. This would be useful for silencing https://github.com/rust-lang/rust-clippy/pull/11253. It's also more consistent with `extern`.

The lack of this also tripped me up a bit when I was new to Rust, as I expected this to be possible.
2023-08-25 00:02:54 +00:00
Weihang Lo
0c1f9c8c4f
Rollup merge of #115172 - matthewjasper:if-let-guard-tests, r=cjgillot
Add more tests for if_let_guard

Adds tests for borrow checking, name shadowing and interaction with macros.

cc #51114
2023-08-24 22:54:00 +01:00
Weihang Lo
c996197525
Rollup merge of #115167 - uweigand:ubintarray-endian-fix, r=RalfJung
Fix ub-int-array test for big-endian platforms

As of commit 7767cbb3b0, the tests/ui/consts/const-eval/ub-int-array.rs test is failing on big-endian platforms (in particular s390x), as the stderr output contains a hex dump that depends on endianness.

Since this point intentionally verifies the hex dump to check the uninitialized byte markers, I think we should not simply standardize away the hex dump as is done with some of the other tests in this directory.

However, most of the test is already endian-independent. The only exception is one line of hex dump, which can also be made endian-independent by choosing appropriate constants in the source code.

Since the 32bit and 64bit stderr outputs were already (and remain) identical, I've merged them and removed the stderr-per-bitwidth marker.

Fixes (again) https://github.com/rust-lang/rust/issues/105383.
2023-08-24 22:54:00 +01:00
Weihang Lo
d417ae5fda
Rollup merge of #115154 - olanti-p:move-issues-24-08-2023, r=compiler-errors
Move some ui tests to subdirectories

cc #73494
issue-2804 -> `macros/` (there's already the minified `issue-2804-2` there)
issue-17431 -> `structs-enums/struct-rec` and new `structs-enums/enum-rec` (original issue pertains to detection of recursive enums and structs)
issue-29181 and issue-66768 - moved according to the classifier tool
2023-08-24 22:53:59 +01:00
Olanti
8216f17d7d Move issue 29181, 2804, 17431, 66768 2023-08-24 20:44:08 +03:00
Matthew Jasper
d3c3c17abb Add more tests for if_let_guard 2023-08-24 16:29:08 +01:00
bors
aa5dbee3eb Auto merge of #115147 - estebank:issue-114311, r=davidtwco
Suggest mutable borrow on read only for-loop that should be mutable

```
error[E0596]: cannot borrow `*test` as mutable, as it is behind a `&` reference
  --> $DIR/suggest-mut-iterator.rs:22:9
   |
LL |     for test in &tests {
   |                 ------ this iterator yields `&` references
LL |         test.add(2);
   |         ^^^^ `test` is a `&` reference, so the data it refers to cannot be borrowed as mutable
   |
help: use a mutable iterator instead
   |
LL |     for test in &mut tests {
   |                  +++
```

Fix #114311.
2023-08-24 15:05:17 +00:00
Martin Nordholts
d5e79f2b8d Include compiler flags when you break rust; 2023-08-24 15:51:25 +02:00
bors
18be2728bd Auto merge of #115131 - frank-king:feature/unnamed-fields-lite, r=petrochenkov
Parse unnamed fields and anonymous structs or unions (no-recovery)

It is part of #114782 which implements #49804. Only parse anonymous structs or unions in struct field definition positions.

r? `@petrochenkov`
2023-08-24 12:52:35 +00:00
Ralf Jung
6f8ae03f9b make MIR less verbose 2023-08-24 14:26:26 +02:00
Ralf Jung
e4c4f9b9d9 remove some unnecessary ignore-debug clauses 2023-08-24 14:10:18 +02:00
Ralf Jung
290ce46252 bless more mir-opt tests by hand 2023-08-24 13:31:43 +02:00
Ralf Jung
af29a26378 add tests for both kinds of unwind-terminate messages 2023-08-24 13:28:26 +02:00
Ralf Jung
4c53783f3c when terminating during unwinding, show the reason why 2023-08-24 13:28:26 +02:00
Ulrich Weigand
2063067a81 Fix ub-int-array test for big-endian platforms
As of commit 7767cbb3b0,
the tests/ui/consts/const-eval/ub-int-array.rs test is
failing on big-endian platforms (in particular s390x),
as the stderr output contains a hex dump that depends
on endianness.

Since this point intentionally verifies the hex dump to
check the uninitialized byte markers, I think we should
not simply standardize away the hex dump as is done with
some of the other tests in this directory.

However, most of the test is already endian-independent.
The only exception is one line of hex dump, which can
also be made endian-independent by choosing appropriate
constants in the source code.

Since the 32bit and 64bit stderr outputs were already
(and remain) identical, I've merged them and removed
the stderr-per-bitwidth marker.

Fixes (again) https://github.com/rust-lang/rust/issues/105383.
2023-08-24 12:49:53 +02:00
bors
9bd60a60ce Auto merge of #115078 - camelid:tydef-to-alias, r=aDotInTheVoid,GuillaumeGomez
rustdoc: Rename typedef to type alias

This matches the name used by the [Rust Reference][1], which is also what
people usually call these items.

[1]: https://doc.rust-lang.org/reference/items/type-aliases.html

r? `@GuillaumeGomez`
2023-08-24 04:13:28 +00:00