Commit Graph

266394 Commits

Author SHA1 Message Date
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
Jubilee
9025fe9e64
Rollup merge of #130336 - onur-ozkan:simple-improvement, r=albertlarsan68
simplify `Build::update_existing_submodule`

`Build::update_existing_submodule` is already doing the same thing..
2024-09-15 23:51:25 -07:00
Jubilee
68758c0560
Rollup merge of #130325 - workingjubilee:plus-minus-zero-redux, r=RalfJung,jieyouxu
Use -0.0 in `intrinsics::simd::reduce_add_unordered`

-0.0 is the actual neutral additive float, not +0.0, and this matters to codegen.

try-job: aarch64-gnu
2024-09-15 23:51:25 -07:00
Jubilee
0151cbe6e8
Rollup merge of #127879 - kornelski:bad-pointer-printf, r=workingjubilee
Document futility of printing temporary pointers

In the user forum I've seen a few people trying to understand how borrowing and moves are implemented by peppering their code with printing of `{:p}` of references to variables and expressions. This is a bad idea. It gives misleading and confusing results, because of autoderef magic, printing pointers of temporaries on the stack, and/or causes LLVM to optimize code differently when values had their address exposed.
2024-09-15 23:51:24 -07:00
bors
a0f57d87aa Auto merge of #3892 - rust-lang:rustup-2024-09-16, r=RalfJung
Automatic Rustup
2024-09-16 06:33:50 +00:00
Ralf Jung
5b8a18f959 fix clippy lints 2024-09-16 08:32:19 +02:00
The Miri Cronjob Bot
1692d12c1c fmt 2024-09-16 05:07:31 +00:00
The Miri Cronjob Bot
4d824fd5b7 Merge from rustc 2024-09-16 05:06:25 +00:00
The Miri Cronjob Bot
ffcaa7fdde Preparing for merge from rustc 2024-09-16 04:58:35 +00:00
bors
39b7669347 Auto merge of #130220 - RalfJung:float-classify, r=workingjubilee
simplify float::classify logic

I played around with the float-classify test in the hope of triggering x87 bugs by strategically adding `black_box`, and still the exact expression `@beetrees` suggested [here](https://github.com/rust-lang/rust/pull/129835#issuecomment-2325661597) remains the only case I found where we get the wrong result on x87. Curiously, this bug only occurs when MIR optimizations are enabled -- probably the extra inlining that does is required for LLVM to hit the right "bad" case in the backend. But even for that case, it makes no difference whether `classify` is implemented in the simple bit-pattern-based version or the more complicated version we had before.

Without even a single testcase that can distinguish our `classify` from the naive version, I suggest we switch to the naive version.
2024-09-16 03:36:03 +00:00
bors
c16ff44537 Auto merge of #130377 - weihanglo:update-cargo, r=weihanglo
Update cargo

25 commits in c1fa840a85eca53818895901a53fae34247448b2..a9a418d1a22f29e7dfd034e3b93f15657e608a29
2024-08-29 21:03:53 +0000 to 2024-09-15 19:13:12 +0000
- chore: revert change to Cargo.lock in f25806c (rust-lang/cargo#14547)
- Disable the shell_completions tests (rust-lang/cargo#14546)
- fix(vendor): trust crate version only when coming from registries (rust-lang/cargo#14530)
- docs: Feature resolver version 2: clarify use of 'target' (rust-lang/cargo#14540)
- Update docs for how cargo is published (rust-lang/cargo#14539)
- feat: Add native comlpetion with CompleteEnv under the nightly (rust-lang/cargo#14493)
- fix(new): Add to workspace relative to manifest, not current-dir (rust-lang/cargo#14505)
- Fix parsing of comma separated values in --crate-type flag (rust-lang/cargo#14499)
- Include public/private dependency status in `cargo metadata` (rust-lang/cargo#14504)
- Remove unnecessary symbols (rust-lang/cargo#14519)
- docs: bin source can be `src/main.rs` and/or in `src/bin/` (rust-lang/cargo#14515)
- fix(toml): Don't require MSRV bump for pub/priv (rust-lang/cargo#14507)
- bail before packaging on same version (rust-lang/cargo#14448)
- Implement path-bases (RFC 3529) 2/n: `cargo [add|remove|update]` support (rust-lang/cargo#14427)
- Publish workspace (rust-lang/cargo#14433)
- Bump ci's version of cargo-semver-version (rust-lang/cargo#14503)
- Document -Zpackage-workspace (rust-lang/cargo#14496)
- uplift windows gnullvm import libraries (rust-lang/cargo#14451)
- Bump to 0.84.0; update changelog (rust-lang/cargo#14495)
- Fix cargo add behaving different when translating package name (rust-lang/cargo#13765)
- chore(deps): update rust crate core-foundation to 0.10.0 (rust-lang/cargo#14475)
- feat(resolve): Report MSRV compatible version instead of incomptible (rust-lang/cargo#14471)
- Don't automatically include the current crate when packaging (rust-lang/cargo#14488)
- Fix elided lifetime (rust-lang/cargo#14487)
- chore(deps): update rust crate pasetors to 0.7.0 (rust-lang/cargo#14478)
2024-09-16 01:00:19 +00:00
许杰友 Jieyou Xu (Joe)
1f48a67a25 bootstrap: register tool docs for src/tools/build_helper 2024-09-16 00:33:33 +00:00
Jubilee Young
ab8c202527 Use -0.0 in intrinsics::simd::reduce_add_unordered
-0.0 is the actual neutral additive float, not +0.0, and this matters to codegen.
2024-09-15 16:40:23 -07:00
bors
d696a27c13 Auto merge of #130415 - matthiaskrgr:rollup-xhsu9oq, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #130151 (Use a small runner for msvc-ext2 job)
 - #130394 (const: don't ICE when encountering a mutable ref to immutable memory)
 - #130409 (tests: more ice tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-15 22:37:06 +00:00
Matthias Krüger
0406f12af9
Rollup merge of #130409 - matthiaskrgr:ccccrashes, r=compiler-errors
tests: more ice tests

r? `@jieyouxu`
2024-09-15 23:56:35 +02:00
Matthias Krüger
62445f1ec8
Rollup merge of #130394 - RalfJung:mut-ref-to-immut, r=saethlin
const: don't ICE when encountering a mutable ref to immutable memory

Turns out that this can actually happen -- thanks to `@matthiaskrgr` for producing a testcase. :)

Fixes https://github.com/rust-lang/rust/issues/130392
2024-09-15 23:56:35 +02:00
Matthias Krüger
21df3ff19e
Rollup merge of #130151 - ChrisDenton:slow-ci, r=Mark-Simulacrum
Use a small runner for msvc-ext2 job

Hopefully this should eliminate the errors from this job. The only question is how long it takes.

try-job: x86_64-msvc-ext2
2024-09-15 23:56:34 +02:00
Ralf Jung
7dfffe7e70 const: don't ICE when encountering a mutable ref to immutable memory 2024-09-15 22:53:04 +02:00
Weihang Lo
db19d43e42
Update cargo 2024-09-15 15:50:49 -04:00
bors
04a318787b Auto merge of #130407 - matthiaskrgr:rollup-vo2gmf4, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #129897 (deprecate -Csoft-float because it is unsound (and not fixable))
 - #130339 (Add `core::panic::abort_unwind`)
 - #130384 (compiler: Document AbiAndPrefAlign)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-09-15 19:35:19 +00:00
Matthias Krüger
9d761eac40 tests: more ice tests 2024-09-15 21:18:41 +02:00
Matthias Krüger
b3686b56c2
Rollup merge of #130384 - workingjubilee:document-what-abi-and-pref-align-is, r=compiler-errors
compiler: Document AbiAndPrefAlign

The mere existence of this struct is confusing, and the second field doubly so. It's easy to mistake the "preferred" alignment as semantically relevant somehow. Insofar as I am aware, it is not, and certainly not for Rust code.
2024-09-15 20:55:13 +02:00
Matthias Krüger
f0fb411969
Rollup merge of #130339 - CAD97:unwind-choice, r=dtolnay
Add `core::panic::abort_unwind`

`abort_unwind` is like `catch_unwind` except that it aborts the process if it unwinds, using the `#[rustc_nounwind]` mechanism also used by `extern "C" fn` to abort unwinding. The docs attempt to make it clear when to (rarely) and when not to (usually) use the function.

Although usage of the function is discouraged, having it available will help to normalize the experience when abort_unwind shims are hit, as opposed to the current ecosystem where there exist multiple common patterns for converting unwinding into a process abort.

For further information and justification, see the linked ACP.

- Tracking issue: https://github.com/rust-lang/rust/issues/130338
- ACP: https://github.com/rust-lang/libs-team/issues/441
2024-09-15 20:55:13 +02:00
Matthias Krüger
0daa636b93
Rollup merge of #129897 - RalfJung:soft-float-ignored, r=Urgau
deprecate -Csoft-float because it is unsound (and not fixable)

See  https://github.com/rust-lang/rust/issues/129893 for details. The general sentiment there seems to be that this flag has no use and sound alternatives exist, so let's add this warning and see if anyone out there disagrees.

Also show a different warning on targets where it does nothing (as documented since https://github.com/rust-lang/rust/pull/36261): it seems to correspond to `-mfloat-abi` in GCC/clang, which is an ARM-specific option. To be really sure it does nothing, only forward the flag to LLVM for eabihf targets. This should not change behavior but makes me sleep better ;)
2024-09-15 20:55:12 +02:00
Christopher Durham
42a44a04ee
simplify abort_unwind
Co-authored-by: David Tolnay <dtolnay@gmail.com>
2024-09-15 14:27:24 -04:00