Commit Graph

266574 Commits

Author SHA1 Message Date
Nicholas Nethercote
108f8c8164 Remove unneeded bounds from CodegenMethods and BuilderMethods.
Some of these are pulled in indirectly, e.g. `MiscMethods` via
`TypeMethods`.
2024-09-17 10:24:43 +10:00
Nicholas Nethercote
410a2de0c0 Rename {ArgAbi,IntrinsicCall}Methods.
They both are part of `BuilderMethods`, and so should have `Builder` in
their name like all the other traits in `BuilderMethods`.
2024-09-17 10:24:43 +10:00
Nicholas Nethercote
6a35b5c9ed Remove BackendTypes constraint from traits that don't need it. 2024-09-17 10:24:43 +10:00
Nicholas Nethercote
928d8e6951 Remove Backend.
It's a trait that aggregates five other traits. But consider the places
that use it.
- `BuilderMethods`: requires three of the five traits.
- `CodegenMethods`: requires zero(!) of the five traits.
- `BaseTypeMethods`: requires two of the five traits.
- `LayoutTypeMethods`: requires three of the five traits.
- `TypeMembershipMethods`: requires one of the five traits.

This commit just removes it, which makes everything simpler.
2024-09-17 10:24:43 +10:00
Nicholas Nethercote
5f98943b5a Merge HasCodegen into BuilderMethods.
It has `Backend` and `Deref` boudns, plus an associated type
`CodegenCx`, and it has a single use. This commit "inlines" it into
`BuilderMethods`, which makes the complicated backend trait situation a
little simpler.
2024-09-17 10:24:43 +10:00
Nicholas Nethercote
47830edc33 Adjust supertrait of ArgAbiMethods.
It only needs `Self::Value` and `Self::Type`, so it can be a subtrait of
`BackendTypes`. That is a smaller and simpler trait than `HasCodegen`
(which includes `BackendTypes` and a lot more).
2024-09-17 10:24:02 +10:00
Tyler Mandry
472fef6a70 Revert "Rollup merge of #129749 - krasimirgg:llvm-20-lto, r=nikic"
This reverts commit 8c7a7e346b, reversing
changes made to a00bd75b6c.
2024-09-16 17:11:02 -07:00
Augie Fackler
86d67b7933 PassWrapper: clang-format has spoken 2024-09-16 20:06:50 -04:00
Michael Goulet
af1ca7794a Record synthetic MIR bodies in mir_keys 2024-09-16 20:06:16 -04:00
Michael Goulet
062ff4dfda Encode coroutine_by_move_body_def_id in crate metadata 2024-09-16 19:59:04 -04:00
Augie Fackler
ad0ecebf43 rustc_llvm: adapt to flattened CLI args in LLVM
This changed in
llvm/llvm-project@e190d074a0. I decided to
stick with more duplication between the ifdef blocks to make the code
easier to read for the next two years before we can plausibly drop LLVM
19.

@rustbot label: +llvm-main
2024-09-16 19:58:05 -04:00
Augie Fackler
1e68f05109 rustc_llvm: update for llvm/llvm-project@2ae968a0d9
Just a simple header move.

@rustbot label: +llvm-main
2024-09-16 19:53:13 -04:00
Nicole LeGare
1b252980ba Update Trusty target maintainers 2024-09-16 16:24:01 -07:00
bors
bde6bf2b07 Auto merge of #127633 - SamuelMarks:eq-exit-code, r=dtolnay
[library/std/src/process.rs] `PartialEq` for `ExitCode`

Converting a third-party CLI to a library so started passing around [`std::process::ExitCode`](https://doc.rust-lang.org/std/process/struct.ExitCode.html) in an `Either`. Then I realised the tests can't be modified to compare equality of `ExitCode`s.

This PR fixes this oversight.
2024-09-16 22:55:33 +00:00
Nicholas Nethercote
6daf40e219 Use trait aliases to shorten some code. 2024-09-17 08:12:31 +10:00
Lukas Markeffsky
20d2414925 get rid of an old hack
For structs that cannot be unsized, the layout algorithm sometimes moves
unsized fields to the end of the struct, which circumvented the error
for unexpected unsized fields and returned an unsized layout anyway.

This commit makes it so that the unexpected unsized error is always
returned for structs that cannot be unsized, allowing us to remove an
old hack and fixing some old ICE.
2024-09-17 00:09:21 +02:00
Lukas Markeffsky
3db930a463 assert that unexpectedly unsized fields are sized in the param env 2024-09-17 00:06:56 +02:00
Andrew Lilley Brinker
23e4e98d2c fix: Remove duplicate LazyLock example.
The top-level docs for `LazyLock` included two lines of code, each
with an accompanying comment, that were identical and with nearly-
identical comments. This looks like an oversight from a past edit
which was perhaps trying to rewrite an existing example but ended
up duplicating rather than replacing, though I haven't gone back
through the Git history to check.

This commit removes what I personally think is the less-clear of
the two examples.

Signed-off-by: Andrew Lilley Brinker <alilleybrinker@gmail.com>
2024-09-16 14:21:05 -07:00
Oli Scherer
e04dc624a7 Automatically add/remove labesl when github review (requests) are used 2024-09-16 23:09:32 +02:00
Oli Scherer
4dabcc3ab4 Fix run --dep 2024-09-16 23:05:42 +02:00
Oli Scherer
987702f6b9 Refator DependencyBuilder construction 2024-09-16 23:05:42 +02:00
Oli Scherer
9f9f19810f Bump ui test 2024-09-16 23:05:42 +02:00
bors
c52c23b6f4 Auto merge of #130444 - matthiaskrgr:rollup-onlrjva, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #130033 (Don't call `fn_arg_names` query for non-`fn` foreign items in resolver)
 - #130282 (Do not report an excessive number of overflow errors for an ever-growing deref impl)
 - #130437 (Avoid crashing on variadic functions when producing arg-mismatch errors)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-16 20:01:52 +00:00
Matthias Krüger
14ee69c250
Rollup merge of #130437 - jder:issue-130372, r=compiler-errors
Avoid crashing on variadic functions when producing arg-mismatch errors

Fixes #130372 by accommodating how variadic functions change the argument list length between HIR body and FnDecls.

Also degrades the zip_eq to a debug_assert! to match other asserts in the area to avoid being disruptive to users. There is at least one other crash in this area I am working on in #130400 and also considering how we might refactor some of this code to hoist some of this logic up higher.

r? `@compiler-errors`
2024-09-16 21:53:07 +02:00
Matthias Krüger
852e08e9bc
Rollup merge of #130282 - compiler-errors:over-overflow, r=BoxyUwU
Do not report an excessive number of overflow errors for an ever-growing deref impl

Check that we don't first hit the recursion limit in `get_field_candidates_considering_privacy` before probing for methods when we have a method lookup failure and we want to see if `.field.method()` exists. We also silence overflow error messages if we're probing for methods for diagnostics.

Also renames some functions to make it clearer that they're only for diagnostics, and sprinkle some `Autoderef::silence_errors` around to silence unnecessary overflow errors that come from diagnostics.

Fixes #130224.
2024-09-16 21:53:07 +02:00
Matthias Krüger
7be15b850f
Rollup merge of #130033 - compiler-errors:foreign-fn-types, r=BoxyUwU
Don't call `fn_arg_names` query for non-`fn` foreign items in resolver

Fixes #130015
2024-09-16 21:53:06 +02:00
Jesse Rusak
45eceb2c57 Avoid crashing on variadic functions when producing arg-mismatch errors 2024-09-16 14:51:56 -04:00
bors
fd2c811d25 Auto merge of #130439 - matthiaskrgr:rollup-1lkzo74, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #123436 (linker: Allow MSVC to use import libraries following the Meson/MinGW convention)
 - #130410 (Don't ICE when generating `Fn` shim for async closure with borrowck error)
 - #130412 (Don't ICE when RPITIT captures more method args than trait definition)
 - #130436 (Ignore reduce-fadd-unordered on SGX platform)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-16 17:41:17 +00:00
tiif
f392648c15 Refactor FileDescription::read/write 2024-09-17 00:37:16 +08:00
Michael Goulet
6e982f59ab Don't ICE in opaque_hidden_inferred_bound lint for RPITIT in trait with no default method body 2024-09-16 12:35:54 -04:00
Matthias Krüger
1807fdadb4
Rollup merge of #130436 - fortanix:raoul/fix_reduce_add_unordered_test, r=RalfJung
Ignore reduce-fadd-unordered on SGX platform

#130325 added the `tests/assembly/simd/reduce-fadd-unordered.rs` test. Unfortunately, the use of `CHECK: ret` makes that this test is not compatible with LVI mitigations applied for the SGX target. This PR makes sure this test is ignored for the SGX target, until a nicer solution is available.
2024-09-16 18:34:02 +02:00
Matthias Krüger
4e68d06b52
Rollup merge of #130412 - compiler-errors:rpitit-overcapture, r=jieyouxu
Don't ICE when RPITIT captures more method args than trait definition

Make sure we don't ICE when an RPITIT captures more method args than the trait definition, which is not allowed. This was because we were using the wrong def id for error reporting.

Due to the default lifetime capture rules of RPITITs (capturing everything in scope), this is only doable if we use precise capturing, which isn't currently allowed for RPITITs anyways but we still end up reaching the relevant codepaths.

Fixes #129850
2024-09-16 18:34:01 +02:00
Matthias Krüger
9a1004c259
Rollup merge of #130410 - compiler-errors:shim-borrowck-err, r=jieyouxu
Don't ICE when generating `Fn` shim for async closure with borrowck error

Turn an assumption that I had originally written as an assert into a delayed bug, because this shim code is reachable even if we have borrowck errors via the MIR inliner.

Fixes #129262.
2024-09-16 18:34:01 +02:00
Matthias Krüger
eac6f07380
Rollup merge of #123436 - amyspark:allow-msvc-to-use-meson-and-mingw-import-libraries, r=petrochenkov
linker: Allow MSVC to use import libraries following the Meson/MinGW convention

Hi all,

This PR implements support for `MsvcLinker` to use import libraries following Meson and the MinGW toolchain's naming convention. Meson [follows the `libfoo.dll.a` naming convention](https://mesonbuild.com/FAQ.html#why-does-building-my-project-with-msvc-output-static-libraries-called-libfooa) to disambiguate between static and import libraries.

This support already existed for static libraries (see #100101), but not for dynamic libraries. The latter case was added by duplicating the logic in `native_libs::find_native_static_library`, but a separate case was added in `link_dylib_by_name` for the Windows CRT libraries which must be handled by the linker itself.

See for prerequisites #129366, #126094, and #128370.

All feedback is appreciated!

Fixes #122455

cc `@sdroege` `@nirbheek`
2024-09-16 18:34:00 +02:00
bors
3a22be33db Auto merge of #130414 - compiler-errors:precise-capturing-arg-valid, r=jieyouxu
Do precise capturing arg validation in resolve

Moves the validation of precise capturing args (`use<T, N>`) out of `resolve_bound_vars` and into `rustc_resolve`. This both simplifies the impl and fixes a bug when we have `use<arg>` where `arg` is one of the function args.

This also introduces new error codes specifically for precise capturing, to avoid reusing the other error codes which are not as accurate.

Fixes #130399
2024-09-16 14:59:29 +00:00
Michael Goulet
57a7e514a4 Don't ICE when generating Fn shim for async closure with borrowck error 2024-09-16 10:57:58 -04:00
Michael Goulet
1e9fa7eb79 Don't ICE when RPITIT captures more method args than trait definition 2024-09-16 10:57:06 -04:00
Michael Goulet
ae8b4607c6 Introduce distinct error codes for precise capturing 2024-09-16 10:56:22 -04:00
Michael Goulet
26bdfefae1 Do precise capturing arg validation in resolve 2024-09-16 10:56:22 -04:00
Michael Goulet
05483d5602 Relate receiver invariantly in method probe for Mode::Path 2024-09-16 10:55:07 -04:00
Raoul Strackx
11b42d2763 Ignore reduce-fadd-unordered on SGX platform 2024-09-16 16:54:48 +02:00
Lukas Markeffsky
697450151c layout computation: eagerly error for unexpected unsized fields 2024-09-16 15:53:21 +02:00
Lukas Markeffsky
16be6666d4 make LayoutCx not generic 2024-09-16 15:53:17 +02:00
许杰友 Jieyou Xu (Joe)
7d764283b4 tests/run-make: update for symlink helper changes 2024-09-16 21:31:41 +08:00
Mattias Wallin
5230e8fbe6 Non-panicking Display for Path 2024-09-16 09:29:53 -04:00
许杰友 Jieyou Xu (Joe)
1b86340218 run_make_support: rectify symlink handling
Avoid confusing Unix symlinks and Windows symlinks, and since their
semantics are quite different we should avoid trying to make it to
automagic in how symlinks are created and deleted. Notably, the tests
should reflect what type of symlinks are to be created to match what std
does to make it less surprising for test readers.
2024-09-16 12:57:44 +00:00
bors
13b5a4e43b Auto merge of #129716 - compiler-errors:closure-debuginfo, r=cjgillot
Don't use `typeck_root_def_id` in codegen for finding closure's root

Generating debuginfo in codegen currently peels off all the closure-specific generics (which presumably is done because they're redundant). This doesn't currently work correctly for the bodies we synthesize for async closures's returned coroutines (#128506), leading to #129702.

Specifically, `typeck_root_def_id` for some `DefKind::SyntheticCoroutineBody` just returns itself (because it loops while `is_typeck_child` is `true`, and that returns `false` for this defkind), which means we don't end up peeling off the coroutine-specific generics, and we end up encountering an otherwise unreachable `CoroutineWitness` type leading to an ICE.

This PR fixes `is_typeck_child` to consider `DefKind::SyntheticCorotuineBody` to be a typeck child, fixing `typeck_root_def_id` and suppressing this debuginfo bug.

Fixes #129702
2024-09-16 10:16:32 +00:00
bors
170d6cb845 Auto merge of #130426 - workingjubilee:rollup-63xnjry, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #127879 (Document futility of printing temporary pointers)
 - #130325 (Use -0.0 in `intrinsics::simd::reduce_add_unordered`)
 - #130336 (simplify `Build::update_existing_submodule`)
 - #130398 (Add system libs for LLVM when cross compiling for Windows)
 - #130420 (Register tool docs for `src/tools/build_helper`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-16 07:14:55 +00:00
Jubilee
f64d1c1f8f
Rollup merge of #130420 - jieyouxu:build_helpers_docs, r=onur-ozkan
Register tool docs for `src/tools/build_helper`

Fixes #130355.
2024-09-15 23:51:26 -07:00
Jubilee
7142e0db60
Rollup merge of #130398 - ChrisDenton:win-cross, r=jieyouxu
Add system libs for LLVM when cross compiling for Windows

Windows uses "import libraries" to link to system libraries. These are a kind of static lib that are distributed with the Windows SDK and therefore they don't rely on the host. All that matters is you have the right SDK installed for the target.
2024-09-15 23:51:26 -07:00