Commit Graph

267236 Commits

Author SHA1 Message Date
Ralf Jung
1151eb1c84 fix some cfg logic around optimize_for_size and 16-bit targets 2024-09-25 15:21:08 +02:00
Antoni Boucher
7d4d356bdd Enable the cfg stdarch_intel_sde to fix the segfault when running the tests under SDE 2024-09-25 09:15:55 -04:00
bors
38352b01ae Auto merge of #130778 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`

Really delayed sync (2 1/2 weeks), because of a `debug_assertion` we hit, and I didn't have the time to investigate earlier.

It would be nice to merge this PR with some priority, as it includes a lot of formatting changes due to the rustfmt bump.

Include Cargo.lock update due to Clippy version bump and ui_test bump in Clippy.
2024-09-25 11:40:41 +00:00
León Orell Valerian Liehr
01a063f9df
Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
Virginia Senioria
986e20d5bb Fixed diagnostics for coroutines with () as input. 2024-09-25 08:45:40 +00:00
bors
2933f68abe Auto merge of #130816 - matthiaskrgr:rollup-jy25phv, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #130549 (Add RISC-V vxworks targets)
 - #130595 (Initial std library support for NuttX)
 - #130734 (Fix: ices on virtual-function-elimination about principal trait)
 - #130787 (Ban combination of GCE and new solver)
 - #130809 (Update llvm triple for OpenHarmony targets)
 - #130810 (Don't trap into the debugger on panics under Linux)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-25 08:43:14 +00:00
Gabriel Bjørnager Jensen
b466fa6db8 Add 'must_use' attribute to 'char::len_utf8' and 'char::len_utf16'; 2024-09-25 10:42:43 +02:00
Matthias Krüger
9d134cc26a
Rollup merge of #130810 - kromych:master, r=workingjubilee
Don't trap into the debugger on panics under Linux

This breaks `rr`, see https://github.com/rust-lang/rust/pull/129019#issuecomment-2369361278 for the discussion

CC `@khuey` `@workingjubilee`
2024-09-25 10:09:24 +02:00
Matthias Krüger
18cdc5e257
Rollup merge of #130809 - heiher:update-triple-ohos, r=jieyouxu
Update llvm triple for OpenHarmony targets

The `ohos` triple has been supported since LLVM 17, so it's time to update them.
2024-09-25 10:09:24 +02:00
Matthias Krüger
e5b9d93579
Rollup merge of #130787 - compiler-errors:next-solver-gce, r=BoxyUwU
Ban combination of GCE and new solver

These do not work together. I don't want anyone to have the impression that they do.

I reused the conflicting features diagnostic but I guess I could make it more tailored to the new solver? OTOH I don't really about the presentation of diagnostics here; these are nightly features after all.

r? `@BoxyUwU` thoughts on this?
2024-09-25 10:09:23 +02:00
Matthias Krüger
0e439090cb
Rollup merge of #130734 - Luv-Ray:fix_vfe, r=lcnr
Fix: ices on virtual-function-elimination about principal trait

Extract `load_vtable` function to ensure the `virtual_function_elimination` option is always checked.
It's okay not to use `llvm.type.checked.load` to load the vtable if there is no principal trait.

Fixes #123955
Fixes #124092
2024-09-25 10:09:23 +02:00
Matthias Krüger
5b727870fa
Rollup merge of #130595 - no1wudi:master, r=ibraheemdev
Initial std library support for NuttX

This PR add the initial libstd support for NuttX platform (Tier 3), currently it depends on https://github.com/rust-lang/libc/pull/3909 which provide the essential libc definitions.
2024-09-25 10:09:22 +02:00
Matthias Krüger
508b433e27
Rollup merge of #130549 - biabbas:riscv32_wrs_vxworks, r=nnethercote
Add RISC-V vxworks targets

Risc-V 32 and RISC-V 64 targets are to be added in the target list.
2024-09-25 10:09:22 +02:00
Laurențiu Nicola
35bc50fc85 Add missing rustc_private 2024-09-25 10:56:37 +03:00
bors
34aff74fb0 Auto merge of #18183 - lnicola:sync-from-rust, r=lnicola
internal: Sync from downstream
2024-09-25 06:41:56 +00:00
bors
938c7b1162 Auto merge of #18184 - Veykril:veykril/push-wsqsyxynttps, r=Veykril
fix: Pass all-targets for build scripts in more cli commands

Without this, build scripts don't run for tests and as such any proc-macros in dev-deps fail to resolve
2024-09-25 06:27:31 +00:00
Laurențiu Nicola
8be19465ec Run rustfmt 2024-09-25 09:26:15 +03:00
Ralf Jung
1fe049ad57 add link from random() helper fn to extensive DefaultRandomSource docs 2024-09-25 08:25:36 +02:00
Lukas Wirth
78680acf9c Pass all-targets for build scripts in more cli commands
Without this, build scripts don't run for tests and as such any proc-macros in dev-deps fail to resolve
2024-09-25 08:23:09 +02:00
Laurențiu Nicola
329eef0018 Add more LayoutError variants 2024-09-25 09:15:11 +03:00
Laurențiu Nicola
62aac8dd4f Bump rustc crates 2024-09-25 09:05:38 +03:00
Laurențiu Nicola
ed7150f2af Merge from rust-lang/rust 2024-09-25 09:00:53 +03:00
Laurențiu Nicola
96736aeaee Preparing for merge from rust-lang/rust 2024-09-25 09:00:31 +03:00
bors
4c62024cd5 Auto merge of #130803 - cuviper:file-buffered, r=joshtriplett
Add `File` constructors that return files wrapped with a buffer

In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers.

ACP: https://github.com/rust-lang/libs-team/issues/446
Tracking Issue: #130804
2024-09-25 04:57:12 +00:00
B I Mohammed Abbas
6d229f89ba Vxworks riscv target specs: remove redundant zicsr feature 2024-09-25 09:46:15 +05:30
kromych
49d1c3b433 Don't trap into the debugger on panics under Linux
This breaks `rr`, see https://github.com/rust-lang/rust/pull/129019#issuecomment-2369361278
for the discussion

CC @khuey @workingjubilee
2024-09-24 19:52:14 -07:00
WANG Rui
7a966b9188 Update llvm triple for OpenHarmony targets
The `ohos` triple has been supported since LLVM 17, so it's time to
update them.
2024-09-25 10:42:40 +08:00
bors
1b5aa96d60 Auto merge of #130807 - tgross35:rollup-p304vzf, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - #130234 (improve compile errors for invalid ptr-to-ptr casts with trait objects)
 - #130752 (Improve assembly test for CMSE ABIs)
 - #130764 (Separate collection of crate-local inherent impls from error tracking)
 - #130788 (Pin memchr to 2.5.0 in the library rather than rustc_ast)
 - #130789 (add InProgress ErrorKind gated behind io_error_inprogress feature)
 - #130793 (Mention `COMPILETEST_VERBOSE_CRASHES` on crash test failure)
 - #130798 (rustdoc: inherit parent's stability where applicable)

Failed merges:

 - #130735 (Simple validation for unsize coercion in MIR validation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-25 02:06:55 +00:00
Antoni Boucher
79a6e4eaa3 Add documentation for stdarch tests 2024-09-24 20:12:41 -04:00
Trevor Gross
9737f923e2
Rollup merge of #130798 - lukas-code:doc-stab, r=notriddle
rustdoc: inherit parent's stability where applicable

It is currently not possible for a re-export to have a different stability (https://github.com/rust-lang/rust/issues/30827). Therefore the standard library uses a hack when moving items like `std::error::Error` or `std::net::IpAddr` into `core` by marking the containing module (`core::error` / `core::net`) as unstable or stable in a later version than the items the module contains.

Previously, rustdoc would always show the *stability as declared* for an item rather than the *stability as publicly reachable* (i.e. the features required to actually access the item), which could be confusing when viewing the docs. This PR changes it so that we show the stability of the first unstable parent or the most recently stabilized parent instead, to hopefully make things less confusing.

fixes https://github.com/rust-lang/rust/issues/130765

screenshots:
![error in std](https://github.com/user-attachments/assets/2ab9bdb9-ed81-4e45-a832-ac7d3ba1be3f) ![error in core](https://github.com/user-attachments/assets/46f46182-5642-4ac5-b92e-0b99a8e2496d)
2024-09-24 19:47:52 -04:00
Trevor Gross
7de108277b
Rollup merge of #130793 - jieyouxu:mention-crashes-verbose, r=matthiaskrgr
Mention `COMPILETEST_VERBOSE_CRASHES` on crash test failure

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

r? `@matthiaskrgr` (or compiler/bootstrap)
2024-09-24 19:47:51 -04:00
Trevor Gross
147aa8611a
Rollup merge of #130789 - aviramha:add_inprogress, r=Noratrieb
add InProgress ErrorKind gated behind io_error_inprogress feature

Follow up on https://github.com/rust-lang/libs-team/issues/92#issuecomment-2371666560
2024-09-24 19:47:51 -04:00
Trevor Gross
9bdef3c928
Rollup merge of #130788 - tgross35:memchr-pinning, r=Noratrieb,Mark-Simulacrum
Pin memchr to 2.5.0 in the library rather than rustc_ast

The latest versions of `memchr` experience LTO-related issues when compiling for windows-gnu [1], so needs to be pinned. The issue is present in the standard library.

`memchr` has been pinned in `rustc_ast`, but since the workspace was recently split, this pin no longer has any effect on library crates.

Resolve this by adding `memchr` as an _unused_ dependency in `std`, pinned to 2.5. Additionally, remove the pin in `rustc_ast` to allow non-library crates to upgrade to the latest version.

Link: https://github.com/rust-lang/rust/issues/127890 [1]

try-job: x86_64-mingw
try-job: x86_64-msvc
2024-09-24 19:47:50 -04:00
Trevor Gross
3b45f8f310
Rollup merge of #130764 - compiler-errors:inherent, r=estebank
Separate collection of crate-local inherent impls from error tracking

#119895 changed the return type of the `crate_inherent_impls` query from `CrateInherentImpls` to `Result<CrateInherentImpls, ErrorGuaranteed>` to avoid needing to use the non-parallel-friendly `track_errors()` to track if an error was reporting from within the query... This was mostly fine until #121113, which stopped halting compilation when we hit an `Err(ErrorGuaranteed)` in the `crate_inherent_impls` query.

Thus we proceed onwards to typeck, and since a return type of `Result<CrateInherentImpls, ErrorGuaranteed>` means that the query can *either* return one of "the list inherent impls" or "error has been reported", later on when we want to assemble method or associated item candidates for inherent impls, we were just treating any `Err(ErrorGuaranteed)` return value as if Rust had no inherent impls defined anywhere at all! This leads to basically every inherent method call failing with an error, lol, which was reported in #127798.

This PR changes the `crate_inherent_impls` query to return `(CrateInherentImpls, Result<(), ErrorGuaranteed>)`, i.e. returning the inherent impls collected *and* whether an error was reported in the query itself. It firewalls the latter part of that query into a new `crate_inherent_impls_validity_check` just for the `ensure()` call.

This fixes #127798.
2024-09-24 19:47:50 -04:00
Trevor Gross
1f52c07528
Rollup merge of #130752 - tdittr:cmse-assembly-tests, r=jieyouxu
Improve assembly test for CMSE ABIs

Tracking issues: #75835 #81391

This ensures the code-gen for these ABIs does not change silently. There is a small chance that this code-gen might change, however even GCC (https://godbolt.org/z/16arxab5x and https://godbolt.org/z/16arxab5x) generates almost the same assembly for these ABIs. I hope the notes in the comments should help fix the tests if it ever breaks.
2024-09-24 19:47:49 -04:00
Trevor Gross
75296fc721
Rollup merge of #130234 - lukas-code:ptr-cast-errors, r=WaffleLapkin
improve compile errors for invalid ptr-to-ptr casts with trait objects

This is a follow-up to https://github.com/rust-lang/rust/pull/120248 to improve some of its error messages.

1. Make the borrowcheck error for "type annotation requires that x must outlive y" actually point at the type annotation, i.e. the type `T` in a `x as T` cast. This makes the error more consistent with other errors caused by type annotation in other places, such as
```text
error: lifetime may not live long enough
 --> src/lib.rs:4:12
  |
3 | fn bar(a: &i32) {
  |           - let's call the lifetime of this reference `'1`
4 |     let b: &'static i32 = a;
  |            ^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`
```

2. Don't say "cast" when we actually mean "coercion" and give borrowcheck errors from actual casts (which is currently just the check added in https://github.com/rust-lang/rust/pull/120248) a higher priority than ones from coercions. This can improve the errors for ptr-to-ptr cast between trait objects because they are are lowered as an upcast "unsizing" coercion if possible (which may be the identity upcast) followed by the actual cast.

3. Bring back the old "casting X as Y is invalid" message for type mismatch in the principals and reword the "vtable kinds may not match" message to more accurately describe the pointer metadata and not refer to "vtables" if the metadata is unknown.

fixes https://github.com/rust-lang/rust/issues/130030

r? `@WaffleLapkin` but feel free to reassign
2024-09-24 19:47:48 -04:00
bors
3f99982c63 Auto merge of #130739 - jieyouxu:stage0_run_make, r=Kobzol
Fix cargo staging for run-make tests

Follow-up to https://github.com/rust-lang/rust/pull/130642#issuecomment-2366891866 to make sure that when

```
$ COMPILETEST_FORCE_STAGE0=1 ./x test run-make --stage 0
```

is used, bootstrap cargo is used in order to avoid building stage 1 rustc. Note that run-make tests are usually not written with `--stage 0` in mind and some tests may rely on stage1 rustc (nightly) behavior, and it is expected that some tests will fail under this invocation.

This PR also fixes `tool::Cargo` staging in compiletest when preparing for `run-make` test mode, by chopping off a stage from the `compiler` passed to `tool::Cargo` such that when the user invokes with stage `N`

```
./x test run-make --stage N
```

the `run-make` test suite will be tested against the cargo built by stage `N` compiler. Let's take `N=1`, i.e. `--stage 1`, without chopping off a stage, previously `./x test run-make --stage 1` will cause stage 1 rustc + std to be built, then stage 2 rustc, and cargo will be produced by the stage 2 rustc, which is clearly not what we want. By chopping off a stage, it means that cargo will be produced by the stage 1 rustc.

cc #119946, #59864.
See discussions regarding the tool staging at https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/.E2.9C.94.20stage1.20run-make.20tests.20now.20need.20stage2.20rustc.20built.20for.20c.2E.2E.2E.
2024-09-24 22:51:43 +00:00
Josh Stone
458537ebc0 Add a tracking issue for file_buffered 2024-09-24 15:06:55 -07:00
Josh Stone
0999b019f8 Dogfood feature(file_buffered) 2024-09-24 14:25:16 -07:00
Lukas Markeffsky
b62e72ce8c update doc comment 2024-09-24 23:12:02 +02:00
Lukas Markeffsky
39f66baa68 improve errors for invalid pointer casts 2024-09-24 23:12:02 +02:00
Lukas Markeffsky
bd31e3ed70 be even more precise about "cast" vs "coercion" 2024-09-24 23:12:02 +02:00
Josh Stone
1e9a50dde8 Pre-allocate buffers in File::open_buffered and create_buffered 2024-09-24 13:33:31 -07:00
Josh Stone
ee129b12ed Add File::open_buffered and create_buffered 2024-09-24 13:32:29 -07:00
Antoni Boucher
0a52b65113 Update to Ubuntu 24.04 to get a more recent GNU as 2024-09-24 16:31:46 -04:00
Lukas Markeffsky
5e60d1f87e replace "cast" with "coercion" where applicable
This changes the remaining span for the cast, because the new `Cast`
category has a higher priority (lower `Ord`) than the old `Coercion`
category, so we no longer report the region error for the "unsizing"
coercion from `*const Trait` to itself.
2024-09-24 22:20:46 +02:00
Lukas Markeffsky
d1e82d438f use more accurate spans for user type ascriptions 2024-09-24 22:20:42 +02:00
Lukas Markeffsky
b52dea8230 add another test 2024-09-24 22:18:00 +02:00
Lukas Markeffsky
46ecb23198 unify dyn* coercions with other pointer coercions 2024-09-24 22:17:55 +02:00
bors
363ae41883 Auto merge of #129587 - Voultapher:opt-for-size-variants-of-sort-impls, r=cuviper
Add `optimize_for_size` variants for stable and unstable sort as well as select_nth_unstable

- Stable sort uses a simple merge-sort that re-uses the existing - rather gnarly - merge function.
- Unstable sort jumps directly to the branchless heapsort fallback.
- select_nth_unstable jumps directly to the median_of_medians fallback, which is augmented with a custom tiny smallsort and partition impl.

Some code is duplicated but de-duplication would bring it's own problems. For example `swap_if_less` is critical for performance, if the sorting networks don't inline it perf drops drastically, however `#[inline(always)]` is also a poor fit, if the provided comparison function is huge, it gives the compiler an out to only instantiate `swap_if_less` once and call it. Another aspect that would suffer when making `swap_if_less` pub, is having to cfg out dozens of functions in in smallsort module.

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

r​? `@Kobzol`
2024-09-24 18:48:08 +00:00