Commit Graph

19780 Commits

Author SHA1 Message Date
Matthias Krüger
b11e9e31dd Rollup merge of #143446 - usamoi:export-executable-symbols, r=bjorn3,oli-obk
use `--dynamic-list` for exporting executable symbols

closes rust-lang/rust#101610
cc rust-lang/rust#84161

https://sourceware.org/binutils/docs-2.39/ld/VERSION.html:

> --dynamic-list=dynamic-list-file
Specify the name of a dynamic list file to the linker. This is typically used when creating shared libraries to specify a list of global symbols whose references shouldn’t be bound to the definition within the shared library, or creating dynamically linked executables to specify a list of symbols which should be added to the symbol table in the executable. This option is only meaningful on ELF platforms which support shared libraries.

`ld.lld --help`:

>   --dynamic-list=<file>: Similar to --export-dynamic-symbol-list. When creating a shared object, this additionally implies -Bsymbolic but does not set DF_SYMBOLIC

>  --export-dynamic-symbol-list=file: Read a list of dynamic symbol patterns. Apply --export-dynamic-symbol on each pattern

>  --export-dynamic-symbol=glob: (executable) Put matched symbols in the dynamic symbol table. (shared object) References to matched non-local STV_DEFAULT symbols shouldn't be bound to definitions within the shared object. Does not imply -Bsymbolic.

>  --export-dynamic: Put symbols in the dynamic symbol table

Use `--dynamic-list` because it's older than `--export-dynamic-symbol-list` (binutils 2.35)

try-job: dist-i586-gnu-i586-i686-musl
2025-07-10 20:28:46 +02:00
León Orell Valerian Liehr
341f12df67 Properly track the depth when expanding free alias types 2025-07-10 19:49:32 +02:00
Esteban Küber
d6924441cd Update test 2025-07-10 17:34:39 +00:00
Esteban Küber
0674eca2f0 Make Diag::multipart_suggestions always verbose 2025-07-10 17:23:29 +00:00
Esteban Küber
7dfc3e9af4 Rework borrowing suggestions to use Expr instead of just Span
In the suggestion machinery for borrowing expressions and types, always use the available obligation `Span` to find the appropriate `Expr` to perform appropriateness checks no the `ExprKind` instead of on the textual snippet corresponding to the `Span`.

Unify the logic for the case where `&` *and* `&mut` are appropriate with the logic for only one of those cases.

Handle the case when `S::foo()` should have been `<&S>::foo()` (instead of suggesting the prior `&S::foo()`.
2025-07-10 17:23:29 +00:00
Scott McMurray
f5fc8727db Add BuilderMethods::unreachable_nonterminator
So places that need `unreachable` but in the middle of a basic block can call that instead of figuring out the best way to do it.
2025-07-10 09:17:28 -07:00
Mu001999
889582e704 Check assoc consts and tys later like assoc fns 2025-07-10 23:39:54 +08:00
Ed Page
a11ee5614c fix: Include frontmatter in -Zunpretty output
In the implementation (#140035), this was left as an open question for
the tracking issue (#136889).  My assumption is that this should be
carried over.

Thankfully, either way, `-Zunpretty` is unstable and we can always
change it even if we stabilize frontmatter.
2025-07-10 10:26:02 -05:00
Scott Schafer
d67bf6095a chore: Improve how the other suggestions message gets rendered 2025-07-10 08:00:20 -06:00
Scott Schafer
61b172a34c test: Make one multi suggestion test unicode 2025-07-10 08:00:15 -06:00
Kivooeo
259512e3b6 cleaned up some tests 2025-07-10 18:50:35 +05:00
Kivooeo
3ad95cccf9 cleaned up some tests 2025-07-10 18:47:20 +05:00
Matthias Krüger
b5b35f1aa4 Rollup merge of #143683 - jieyouxu:rms-cleanup, r=Kobzol
Assorted `run-make-support` maintenance

This PR should contain no functional changes.

- Commit 1: Removes the support library's CHANGELOG. In the very beginning, I thought maybe we would try to version this library. But this is a purely internal test support library, and it's just extra busywork trying to maintain changelog/versions. It's also hopelessly outdated.
- Commit 2: Resets version number to `0.0.0`. Ditto on busywork.
- Commit 3: Bump `run-make-support` to Edition 2024. The support library was already "compliant" with Edition 2024.
- Commit 4: Slightly organizes the support library dependencies.
- Commit 5: Previously, I tried hopelessly to maintain some manual formatting, but that was annoying because it required skipping rustfmt (so export ordering etc. could not be extra formatted). Give up, and do some rearrangements / module prefix tricks to get the `lib.rs` looking at least *reasonable*. IMO this is not a strict improvement, but I rather regain the ability to auto-format it with rustfmt.
- Commit {6,7}: Noticed in rust-lang/rust#143669 that we apparently had *both* {`is_msvc`, `is_windows_msvc`}. This PR removes `is_msvc` in favor of `is_windows_msvc` to make it unambiguous (and only retain one way of gating) as there are some UEFI targets which are MSVC but not Windows.

Best reviewed commit-by-commit.

r? `@Kobzol`
2025-07-10 15:19:35 +02:00
Matthias Krüger
90ead986d5 Rollup merge of #143666 - nilehmann:nested_bodies_in_consumers, r=lcnr
Re-expose nested bodies in rustc_borrowck::consumers

After https://github.com/rust-lang/rust/pull/138499, it's not possible anymore to get borrowck information for nested bodies via `get_body_with_borrowck_facts`. This PR re-exposes nested bodies by returning a map containing the typeck root and all its nested bodies. To collect the bodies, a map is added to `BorrowCheckRootCtxt`, and a body is inserted every time `do_mir_borrowck` is called.

r? ``@lcnr``
2025-07-10 15:19:32 +02:00
Matthias Krüger
a0c7887199 Rollup merge of #136906 - chenyukang:yukang-fix-136741-closure-body, r=oli-obk
Add checking for unnecessary delims in closure body

Fixes #136741
2025-07-10 15:19:29 +02:00
Kivooeo
81a6f18940 added error for invalid char cast 2025-07-10 15:44:36 +05:00
bors
119574f835 Auto merge of #143721 - tgross35:rollup-sjdfp6r, r=tgross35
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#141996 (Fix `proc_macro::Ident`'s handling of `$crate`)
 - rust-lang/rust#142950 (mbe: Rework diagnostics for metavariable expressions)
 - rust-lang/rust#143011 (Make lint `ambiguous_glob_imports` deny-by-default and report-in-deps)
 - rust-lang/rust#143265 (Mention as_chunks in the docs for chunks)
 - rust-lang/rust#143270 (tests/codegen/enum/enum-match.rs: accept negative range attribute)
 - rust-lang/rust#143298 (`tests/ui`: A New Order [23/N])
 - rust-lang/rust#143396 (Move NaN tests to floats/mod.rs)
 - rust-lang/rust#143398 (tidy: add support for `--extra-checks=auto:` feature)
 - rust-lang/rust#143644 (Add triagebot stdarch mention ping)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-10 10:08:08 +00:00
Guillaume Gomez
086b13d170 Add regression test for #143107 2025-07-10 11:41:50 +02:00
Tomasz Miąsko
9681786409 Propagate from borrowed locals in CopyProp 2025-07-10 09:36:20 +02:00
Trevor Gross
7ad90964dd Rollup merge of #143298 - Kivooeo:tf23, r=tgross35
`tests/ui`: A New Order [23/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? ``@tgross35``
2025-07-10 03:23:55 -04:00
Trevor Gross
a2fe1bcf70 Rollup merge of #143270 - TimNN:fix-enum-match, r=nikic
tests/codegen/enum/enum-match.rs: accept negative range attribute

The test current fails when `rustc` is built with HEAD LLVM: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/38097/steps/canvas?sid=0197c492-5661-4c42-8ae7-3d789e85c6ca

I suspect the change was caused by 545cdca488

``@rustbot`` label llvm-main
2025-07-10 03:23:55 -04:00
Trevor Gross
6bcc39c7fe Rollup merge of #143011 - LorrensP-2158466:warn-ambiguity-into-error, r=petrochenkov
Make lint `ambiguous_glob_imports` deny-by-default and report-in-deps

This pr aims to finish the second part of rust-lang/rust#114095. It converts the `ambiguous_glob_imports` lint from a warning to an error.

Currently, only the lint definition and the related tests are changed, a crater run should provide us with information on whether we should go for this.
2025-07-10 03:23:53 -04:00
Trevor Gross
643efdaa82 Rollup merge of #142950 - tgross35:metavariable-expr-rework, r=petrochenkov
mbe: Rework diagnostics for metavariable expressions

Make the diagnostics for metavariable expressions more user-friendly. This mostly addresses syntactic errors; I will be following up with improvements to `concat(..)`.
2025-07-10 03:23:53 -04:00
Trevor Gross
73d3adc67b Rollup merge of #141996 - Daniel-Aaron-Bloom:dollar_crate, r=petrochenkov
Fix `proc_macro::Ident`'s handling of `$crate`

This PR is addresses a few minor bugs, all relating to `proc_macro::Ident`'s support for `$crate`. `Ident` currently supports `$crate` (as can be seen in the `mixed-site-span` test), but:
* `proc_macro::Symbol::can_be_raw` is out of sync with `rustc_span::Symbol::can_be_raw`
  * former doesn't cover `$crate` while the latter does cover `kw::DollarCrate`
* `Ident::new` rejects `$crate`
  * This conflicts with the [reference definition](https://doc.rust-lang.org/nightly/reference/macros-by-example.html#r-macro.decl.meta.specifier) of `ident` which includes `$crate`.
  * This also conflicts with the documentation on [`Display for Ident`](https://doc.rust-lang.org/proc_macro/struct.Ident.html#impl-Display-for-Ident) which says the output "should be losslessly convertible back into the same identifier".

This PR fixes the above issues and extends the `mixed-site-span` test to exercise these fixed code paths, as well as validating the different possible spans resolve `$crate`  as expected (for both the new and old `$crate` construction code paths).
2025-07-10 03:23:52 -04:00
bors
cf3fb768db Auto merge of #143696 - oli-obk:constable-type-id2, r=RalfJung
Add opaque TypeId handles for CTFE

Reopen of https://github.com/rust-lang/rust/pull/142789#issuecomment-3053155043 after some bors insta-merge chaos

r? `@RalfJung`
2025-07-10 07:04:03 +00:00
Jieyou Xu
3f4f23af61 Use is_windows_msvc instead of is_msvc in run-make tests 2025-07-10 13:55:04 +08:00
Scott McMurray
58d7c2d5a7 Make UB transmutes really UB in LLVM
Ralf suggested in <https://github.com/rust-lang/rust/pull/143410#discussion_r2184928123> that UB transmutes shouldn't be trapping, which happened for the one path that PR was changing, but there's another path as well, so this PR changes that other path to match.
2025-07-09 22:30:15 -07:00
yukang
93db9e7ee0 Remove uncessary parens in closure body with unused lint 2025-07-10 09:25:56 +08:00
Trevor Gross
87e981996f mbe: Refactor the diagnostic for unrecognized metavariable expressions
Change to a structural diagnostic, update the valid list, and move the
valid list to a note.
2025-07-09 21:11:09 -04:00
Trevor Gross
e7ef31d651 mbe: Refactor diagnostics for invalid metavar expression syntax
Give a more user-friendly diagnostic about the following:

* Trailing tokens within braces, e.g. `${foo() extra}`
* Missing parentheses, e.g. `${foo}`
* Incorrect number of arguments, with a hint about correct usage.
2025-07-09 21:11:09 -04:00
Predrag Gruevski
27fb02c947 Add rustdoc JSON tests for #[doc(hidden)] handling of items. 2025-07-10 00:19:03 +00:00
LorrensP-2158466
b286bc3141 fix aux-build failures 2025-07-09 23:18:32 +02:00
Ed Page
425cd0f571 test: Verify frontmatter unpretty behavior 2025-07-09 14:55:53 -05:00
Ralf Jung
925789456a miri: fix out-of-bounds error for ptrs with negative offsets 2025-07-09 20:20:07 +02:00
Michael Goulet
728017ea8f Make AsyncDrop check that it's being implemented on a local ADT 2025-07-09 17:07:04 +00:00
bors
e3fccdd4a1 Auto merge of #143502 - scottmcm:aggregate-simd, r=oli-obk
Let `rvalue_creates_operand` return true for *all* `Rvalue::Aggregate`s

~~Draft for now because it's built on Ralf's rust-lang/rust#143291~~

Inspired by https://github.com/rust-lang/rust/pull/138759#discussion_r2156375342 where I noticed that we were nearly at this point, plus the comments I was writing in rust-lang/rust#143410 that reminded me a type-dependent `true` is fine.

This PR splits the `OperandRef::builder` logic out to a separate type, with the updates needed to handle SIMD as well.  In doing so, that makes the existing `Aggregate` path in `codegen_rvalue_operand` capable of handing SIMD values just fine.

As a result, we no longer need to do layout calculations for aggregate result types when running the analysis to determine which things can be SSA in codegen.
2025-07-09 16:37:20 +00:00
Oli Scherer
486ffda9dc Add opaque TypeId handles for CTFE 2025-07-09 16:37:11 +00:00
usamoi
bf6d29d558 use --dynamic-list for exporting executable symbols 2025-07-09 22:40:11 +08:00
bors
6b3ae3f6e4 Auto merge of #143472 - dianne:deref-pat-column-check, r=Nadrieril
`rustc_pattern_analysis`: always check that deref patterns don't match on the same place as normal constructors

In rust-lang/rust#140106, deref pattern validation was tied to the `deref_patterns` feature to temporarily avoid affecting perf. However:
- As of rust-lang/rust#143414, box patterns are represented as deref patterns in `rustc_pattern_analysis`. Since they can be used by enabling `box_patterns` instead of `deref_patterns`, it was possible for them to skip validation, resulting in an ICE. This fixes that and adds a regression test.
- External tooling (e.g. rust-analyzer) will also need to validate matches containing deref patterns, which was not possible. This fixes that by making `compute_match_usefulness` validate deref patterns by default.

In order to avoid doing an extra pass for anything with patterns, the second commit makes `RustcPatCtxt` keep track of whether it encounters a deref pattern, so that it only does the check if so. This is purely for performance. If the perf impact of the first commit is negligible and the complexity cost introduced by the second commit is significant, it may be worth dropping the latter.

r? `@Nadrieril`
2025-07-09 09:45:36 +00:00
Martin Nordholts
54cc45d5b4 tests: Don't check for self-printed output in std-backtrace.rs test
The `Display` implementation for `Backtrace` used to print

    stack backtrace:

but that print was later removed. To make the existing test pass, the
print was added to the existing test. But it doesn't make sense to check
for something that the test itself does since that will not detect any
regressions in the implementation of `Backtrace`. Fully remove the
checks.
2025-07-09 08:43:56 +02:00
bors
558d25371f Auto merge of #143667 - tgross35:rollup-yqitltm, r=tgross35
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#142357 (Simplify LLVM bitcode linker in bootstrap and add tests for it)
 - rust-lang/rust#143177 (Remove false label when `self` resolve failure does not relate to macro)
 - rust-lang/rust#143339 (Respect endianness correctly in CheckEnums test suite)
 - rust-lang/rust#143426 (clippy fix: indentation)
 - rust-lang/rust#143475 (tests: Use `cfg_target_has_reliable_f16_f128` in `conv-bits-runtime-const`)
 - rust-lang/rust#143499 (Don't call `predicates_of` on a dummy obligation cause's body id)
 - rust-lang/rust#143520 (Fix perf regression caused by tracing)
 - rust-lang/rust#143532 (More carefully consider span context when suggesting remove `&mut`)
 - rust-lang/rust#143606 (configure.py: Write last key in each section)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-09 06:43:41 +00:00
Trevor Gross
5f9a70ec9f Rollup merge of #143532 - compiler-errors:mut-ref-sugg, r=davidtwco
More carefully consider span context when suggesting remove `&mut`

Use `find_ancestor_inside` to compute a relative span that is macro-aware, rather than falling back to using BytePos arithmetic which is wrong for `&mut`.

Fixes https://github.com/rust-lang/rust/issues/143523
2025-07-08 22:50:29 -05:00
Trevor Gross
f1517ddae8 Rollup merge of #143499 - compiler-errors:predicates-of-crate, r=davidtwco
Don't call `predicates_of` on a dummy obligation cause's body id

See the test for a brief explanation

Fixes rust-lang/rust#143481.
2025-07-08 22:50:28 -05:00
Trevor Gross
4a4985a924 Rollup merge of #143475 - tgross35:runtime-test-config, r=jieyouxu
tests: Use `cfg_target_has_reliable_f16_f128` in `conv-bits-runtime-const`

`conv-bits-runtime-const` gates `f16` and `f128` tests behind `x86_64`, but this isn't always accurate. In particular, x86 `MinGW` has an ABI bug [1] which means things work when linked to our Rust math libraries but don't work with host libraries. RUST-143405 slightly adjusts which targets we provide `f16` and `f128` symbols for and effectively removes MinGW from that list, meaning host libraries start getting linked, meaning `f16` and `f128` tests start to fail.

Account for this by changing the gates in one such test to `cfg(target_has_reliable_{f16,f128})` which is the way we should be gating all behavior related to the types going forward.

`rustfmt` also seems to have formatted the macros which is fine.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054
2025-07-08 22:50:28 -05:00
Trevor Gross
3940dc7eb4 Rollup merge of #143339 - 1c3t3a:issue-143332, r=RalfJung
Respect endianness correctly in CheckEnums test suite

The endianness can change the test expectation for the enum check. This change is fixing the failing tests on big endian by changing the tests so that they behave the same as on little endian.

Fixes rust-lang/rust#143332.
2025-07-08 22:50:27 -05:00
Trevor Gross
a71dbcd679 Rollup merge of #143177 - xizheyin:143134, r=lcnr
Remove false label when `self` resolve failure does not relate to macro

Fixes rust-lang/rust#143134

In the first commit, I did some code-clean, moving `suggest*` to `suggestions/` dir.
In the second, commit, I added ui test.
In the third, I change the code, and present the test result.

r? compiler
2025-07-08 22:50:26 -05:00
bors
d350797b7e Auto merge of #142707 - ashivaram23:drop_wildcard, r=dianqk
Apply effects to `otherwise` edge in dataflow analysis

This allows `ElaborateDrops` to remove drops when a `match` wildcard arm covers multiple no-Drop enum variants. It modifies dataflow analysis to update the `MaybeUninitializedPlaces` and `MaybeInitializedPlaces` data for a block reached through an `otherwise` edge.

Fixes rust-lang/rust#142705.
2025-07-09 03:42:01 +00:00
Nico Lehmann
3c7bf9fe01 Expose nested bodies in rustc_borrowck::consumers 2025-07-08 19:09:14 -07:00
Amogh Shivaram
c7ef03aeb7 Apply effects to otherwise edge in dataflow analysis 2025-07-08 18:15:05 -05:00
Folkert de Vries
6fc5d4edda emit .att_syntax when global/naked asm use that option 2025-07-09 01:09:55 +02:00