Commit Graph

291081 Commits

Author SHA1 Message Date
Lukas Wirth
f67ee9c7de Merge pull request #19877 from tgross35/remove-concat-idents
chore: Remove support for `concat_idents!`
2025-05-28 04:17:42 +00:00
Trevor Gross
9f94b13d7a chore: Remove support for concat_idents!
`concat_idents!` was deprecated in [1] and will be removed in the near
future. rust-analyzer's support is independent of rustc's, so drop RA
support now to make syncing easier.

[1]: https://github.com/rust-lang/rust/pull/137653
2025-05-28 03:59:32 +00:00
yukang
adcd0bf5c3 Fix ICE in tokenstream with contracts from parser recovery 2025-05-28 09:35:10 +08:00
bors
04a67d5a05 Auto merge of #141668 - tgross35:rollup-03gg6lf, r=tgross35
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#140367 (add `asm_cfg`: `#[cfg(...)]` within `asm!`)
 - rust-lang/rust#140894 (Make check-cfg diagnostics work in `#[doc(cfg(..))]`)
 - rust-lang/rust#141252 (gvn: bail out unavoidable non-ssa locals in repeat)
 - rust-lang/rust#141517 (rustdoc: use descriptive tooltip if doctest is conditionally ignored)
 - rust-lang/rust#141551 (Make two transmute-related MIR lints into HIR lint)
 - rust-lang/rust#141591 (ci: fix llvm test coverage)
 - rust-lang/rust#141647 (Bump master `stage0` compiler)
 - rust-lang/rust#141659 (Add `Result::map_or_default` and `Option::map_or_default`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-28 01:20:50 +00:00
Khem Raj
56b669cd7a Disable libunwind cross-architecture unwinding
Building with _LIBUNWIND_IS_NATIVE_ONLY disables code for cross-architecture unwinding
it is disabled by default in LLVM [1], replicate the cmake behavior in bootstrap process

It also enables some additional code that handles PAC-specific unwind info
it helps compiling with the -mbranch-protection=pac or -mbranch-protection=standard flags

This fixes build with clang/musl on aarch64

[1] 85624c5de3

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2025-05-27 18:07:20 -07:00
Trevor Gross
da61494400 Rollup merge of #141659 - tkr-sh:map-or-default, r=Amanieu
Add `Result::map_or_default` and `Option::map_or_default`

Closes: https://github.com/rust-lang/rust/pull/138068

_This PR has been recreated because of the inactivity of the author (Cf. https://github.com/rust-lang/rust/pull/138068#issuecomment-2912412288)_
2025-05-27 20:28:34 -04:00
Trevor Gross
f953c6dc66 Rollup merge of #141647 - jieyouxu:bump-master-stage0, r=pietroalbini
Bump master `stage0` compiler

To include beta backport of revert rust-lang/rust#141024 which should undo linker warnings during bootstrapping of Windows MSVC targets due to rust-lang/rust#140176.

Closes rust-lang/rust#141395.

r? `@Mark-Simulacrum` (or release)
2025-05-27 20:28:33 -04:00
Trevor Gross
77ddf1ac6b Rollup merge of #141591 - marcoieni:fix-llvm-test-coverage, r=Kobzol
ci: fix llvm test coverage

try-job: x86_64-gnu-llvm-19-1
try-job: x86_64-gnu-llvm-20-1
2025-05-27 20:28:33 -04:00
Trevor Gross
e0278ed5af Rollup merge of #141551 - compiler-errors:hir-lints, r=BoxyUwU
Make two transmute-related MIR lints into HIR lint

Make `PTR_TO_INTEGER_TRANSMUTE_IN_CONSTS` (rust-lang/rust#130540) and `UNNECESSARY_TRANSMUTES` (rust-lang/rust#136083) into "normal" HIR-based lints.

Funny enough this came up in the review of the latter (https://github.com/rust-lang/rust/pull/136083#issuecomment-2614301413), but I guess it just was overlooked.

But anywyas, there's no reason for these to be MIR lints; in fact, it makes the suggestions for them a bit more complicated than necessary.

Note that there's probably a few more simplifications and improvements to be done here. Follow-ups can be done in a separate PR, especially if they're about the messaging and suggestions themselves, which I didn't write.
2025-05-27 20:28:32 -04:00
Trevor Gross
a8c7a1e29b Rollup merge of #141517 - lolbinarycat:rustdoc-doctest-tooltip-ignore-141092, r=notriddle
rustdoc: use descriptive tooltip if doctest is conditionally ignored

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

here's what it looks like now:
![screenshot](https://github.com/user-attachments/assets/71e679fe-8828-439d-a2ce-b9187ad3aeea)
2025-05-27 20:28:32 -04:00
Trevor Gross
ee4efa1f86 Rollup merge of #141252 - dianqk:gvn-repeat-index, r=saethlin
gvn: bail out unavoidable non-ssa locals in repeat

Fixes #141251.

We cannot transform `*elem` to `array[idx1]` in the following code, as `idx1` has already been modified.

```rust
    mir! {
        let array;
        let elem;
        {
            array = [*val; 5];
            elem = &array[idx1];
            idx1 = idx2;
            RET = *elem;
            Return()
        }
    }
```

Perhaps I could transform it to `array[0]`, but I prefer the conservative approach.

r? mir-opt
2025-05-27 20:28:31 -04:00
Trevor Gross
0c2fbe53a6 Rollup merge of #140894 - Urgau:check-cfg-rustdoc, r=GuillaumeGomez
Make check-cfg diagnostics work in `#[doc(cfg(..))]`

This PR makes it so that the check-cfg `unexpected_cfgs` lint, is correctly emitted in `rustdoc`'s `#[doc(cfg(..))]`.

This is achieved by adding a custom trait to `cfg_matches` (the method that emits the lint) which permits `rustc` and `rustdoc` to each have their way to emitting lints (via buffered lints/AST for `rustc` and via `TyCtxt`/HIR for `rustdoc`).

The reason this is required is because buffered lints operates on the AST but `rustdoc` uses the HIR and by the time `rustdoc` calls `cfg_matches` we are way passed the point where buffered lints have been drain and emitted.

Best reviewed commit by commit.

r? `@jieyouxu` (for the compiler part)
r? `@GuillaumeGomez` (for the rustdoc part)
2025-05-27 20:28:30 -04:00
Trevor Gross
743d2527a2 Rollup merge of #140367 - folkertdev:asm-cfg, r=nnethercote
add `asm_cfg`: `#[cfg(...)]` within `asm!`

tracking issue: https://github.com/rust-lang/rust/issues/140364
blocked on: https://github.com/rust-lang/rust/pull/140490

This feature was discussed in https://github.com/rust-lang/rust/issues/140279. It allows configuring templates and operands in the assembly macros, for example:

```rust
asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);
```

r? `@tgross35`

cc `@traviscross` `@Amanieu`

Now builds on https://github.com/rust-lang/rust/pull/140490, which should be merged first.
2025-05-27 20:28:30 -04:00
Chayim Refael Friedman
2c5d840fb0 Merge pull request #19875 from ShoyuVanilla/issue-19844
fix: Skip pattern analysis on type mismatches
2025-05-27 23:38:38 +00:00
Shoyu Vanilla
a55a3705f6 fix: Skip pattern analysis on type mismatches 2025-05-28 08:11:14 +09:00
bors
be42293944 Auto merge of #129658 - saethlin:spare-a-crumb, r=jhpratt
Add some track_caller info to precondition panics

Currently, when you encounter a precondition check, you'll always get the caller location of the implementation of the precondition checks. But with this PR, you'll be told the location of the invalid call. Which is useful.

I thought of this while looking at https://github.com/rust-lang/rust/pull/129642#issuecomment-2311703898.

The changes to `tests/ui/const*` happen because the const-eval interpreter skips `#[track_caller]` frames in its backtraces.

The perf implications of this are:
* Increased debug binary sizes. The caller_location implementation requires that the additional data we want to display here be stored in const allocations, which are deduplicated but not across crates. There is no impact on optimized build sizes. The panic path and the caller location data get optimized out.
* The compile time hit to opt-incr-patched bitmaps happens because the patch changes the line number of some function calls with precondition checks, causing us to go from 0 dirty CGUs to 1 dirty CGU.
* The other compile time hits are marginal but real, and due to doing a handful of new queries. Adding more useful data isn't completely free.
2025-05-27 22:11:53 +00:00
Rémy Rakic
ddeae148c5 switch dataflow test to a maybe-uninit analysis
This mir-opt test used the maybe-init dataflow analysis but it's now
lazy and doesn't emit the graphviz graph when it's not needed anymore.
2025-05-27 21:21:28 +00:00
Rémy Rakic
703e051f36 add perf fixme for MaybeInitializedPlaces domain 2025-05-27 21:21:28 +00:00
Rémy Rakic
430e230449 fast path: compute MaybeInitializedPlaces lazily
Only drop-liveness checks for maybe-initializedness of move paths, and
it does so only for the relevant live locals that have drop points.

This adds a fast path by computing this dataflow analysis only when checking for such
initializedness. This avoids this expensive computation for the common
case.

For example, it avoids computing initializedness for 20K locals in the
`cranelift-codegen` benchmark, it has 7K relevant live locals but none
with drop points. That saves 900ms on end-to-end compilation times.
2025-05-27 21:21:28 +00:00
Rémy Rakic
10d39f52a9 remove unneeded lifetime 2025-05-27 21:21:28 +00:00
Rémy Rakic
45197887cb move MaybeInitializedPlaces computation to where it's used
This dataflow analysis is only used by `liveness::trace`. We move it
there to make it lazy.
2025-05-27 21:21:28 +00:00
Tshepang Mbambo
097ca1478d Merge pull request #2419 from rust-lang/tshepang-patch-1
make link not inline
2025-05-27 21:21:44 +02:00
Tshepang Mbambo
ba91db386e make link not inline 2025-05-27 21:21:18 +02:00
bors
45f256d9d7 Auto merge of #141662 - matthiaskrgr:rollup-9kt4zj7, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#141312 (Add From<TryLockError> for io::Error)
 - rust-lang/rust#141495 (Rename `{GenericArg,Term}::unpack()` to `kind()`)
 - rust-lang/rust#141602 (triagebot: label LLVM submodule changes with `A-LLVM`)
 - rust-lang/rust#141632 (remove `visit_mt` from `ast::mut_visit`)
 - rust-lang/rust#141640 (test: convert version_check ui test to run-make)
 - rust-lang/rust#141645 (bump fluent-* crates)
 - rust-lang/rust#141650 (coverage: Revert "unused local file IDs" due to empty function names)
 - rust-lang/rust#141654 (tests: mark option-niche-eq as fixed on LLVM 21)

Failed merges:

 - rust-lang/rust#141430 (remove `visit_clobber` and move `DummyAstNode` to `rustc_expand`)
 - rust-lang/rust#141636 (avoid some usages of `&mut P<T>` in AST visitors)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-27 18:59:47 +00:00
Matthias Krüger
c7d0a61e22 Rollup merge of #141654 - durin42:randomly-fixed-test, r=jieyouxu
tests: mark option-niche-eq as fixed on LLVM 21

Some combination of recent Rust changes (between 3d86494a0d and aa57e46e24 from what I can tell) and changes in LLVM 21 (not recently, as best I can tell) have caused this test to start showing the behavior we want, so it's time to move this test to a proper place and mark it as fixed on LLVM 21.

~~Probably "fixes" rust-lang/rust#49892, but I'll let others make that call.~~

Closes rust-lang/rust#49892 unless we want to break out a dedicated issue for `Option<bool>::eq` on LLVM 20 (seems low-value).

`@rustbot` label llvm-main
2025-05-27 20:57:58 +02:00
Matthias Krüger
003fbf1fad Rollup merge of #141650 - Zalathar:revert-unused-local-file, r=Zalathar
coverage: Revert "unused local file IDs" due to empty function names

The changes to coverage metadata generation in rust-lang/rust#140847 appear to be the most likely cause of the `function name is empty` errors reported in rust-lang/rust#141577.

If that guess is correct, great. If not, no big deal.

---

This reverts commit 3b22c21dd8, reversing changes made to 5f292eea6d.

r? ghost
2025-05-27 20:57:57 +02:00
Matthias Krüger
043e498062 Rollup merge of #141645 - klensy:fluent-b, r=jieyouxu
bump fluent-* crates

This bumps fluent-* crates, switching to more up-to-date deps, reducing number of old ones.

changelogs is pure refactoring:
https://github.com/projectfluent/fluent-rs/blob/fluent-bundle%400.16.0/fluent-bundle/CHANGELOG.md
https://github.com/projectfluent/fluent-rs/blob/fluent-bundle%400.16.0/fluent-syntax/CHANGELOG.md
2025-05-27 20:57:57 +02:00
Matthias Krüger
09e643f963 Rollup merge of #141640 - Fabian-Gruenbichler:mr/test-version-check-rpath-false, r=jieyouxu
test: convert version_check ui test to run-make

else it breaks with `rpath=false`.

Fixes: rust-lang/rust#141579
2025-05-27 20:57:56 +02:00
Matthias Krüger
7807f5f0cb Rollup merge of #141632 - fee1-dead-contrib:push-txmttkxvwqxl, r=oli-obk
remove `visit_mt` from `ast::mut_visit`

doesn't look like anyone is using it.
2025-05-27 20:57:55 +02:00
Matthias Krüger
732f671c53 Rollup merge of #141602 - jieyouxu:llvm-submodule, r=apiraino
triagebot: label LLVM submodule changes with `A-LLVM`

Fixes rust-lang/rust#141601.

r? `@apiraino`
2025-05-27 20:57:55 +02:00
Matthias Krüger
16af814a4e Rollup merge of #141495 - compiler-errors:rename-unpack, r=fmease
Rename `{GenericArg,Term}::unpack()` to `kind()`

A well-deserved rename IMO.

r? `@oli-obk` or `@lcnr` (or anyone)

cc `@rust-lang/types,` but I'd be surprised if this is controversial.
2025-05-27 20:57:54 +02:00
Matthias Krüger
88b12f3649 Rollup merge of #141312 - cberner:filelock_from, r=joshtriplett
Add From<TryLockError> for io::Error

Adds a `From` impl to make error propagation easier, as discussed in the tracking issue

`TryLockError` is unstable under the "file_lock" feature. The related tracking issue is https://github.com/rust-lang/rust/issues/130994

This PR also cleanups the Windows implementation of `try_lock()` and `try_lock_shared()` as [discussed here](https://github.com/rust-lang/rust/pull/140718#discussion_r2076678485)
2025-05-27 20:57:53 +02:00
tk
eed065958b feat: map_or_default for result and option 2025-05-27 19:47:14 +02:00
Vadim Petrochenkov
043b164b3b bootstrap: Remove bin_root from PATH 2025-05-27 20:31:21 +03:00
Eric Huss
d562c46be0 CI: Add cargo tests to aarch64-apple-darwin
This adds running of cargo's tests to the aarch64-apple-darwin job. The
reason for this is that tier-1 targets are ostensibly supposed to run
tests for host tools, but we are not doing that here. We do have fairly
good coverage in Cargo's CI, but we don't have much coverage of beta or
stable. I think it would be good to have a fallback here.
2025-05-27 10:05:50 -07:00
bohan
e9080948c6 consider glob imports in cfg suggestion 2025-05-28 00:59:47 +08:00
León Orell Valerian Liehr
db21caf5ba Drive-by: Delete dead TyCtxtEnsureOk::const_eval_poly 2025-05-27 18:58:51 +02:00
León Orell Valerian Liehr
a83f8d02ea Always evaluate free lifetime-generic constants
Co-authored-by: Michael Goulet <michael@errs.io>
2025-05-27 18:58:51 +02:00
nora
a07a972e2d Merge pull request #2417 from smanilov/patch-16
Make links in coinduction.md clickable
2025-05-27 18:53:29 +02:00
nora
58e5e32fbe Merge pull request #2418 from smanilov/patch-17
Link to description of opaque types
2025-05-27 18:52:53 +02:00
Matthew Jasper
f6520673fc Warn on non-crate level text direction lints 2025-05-27 16:16:34 +00:00
Matthew Jasper
e5bfd02c5e Avoid including text direction codepoints in lint messages 2025-05-27 15:57:41 +00:00
Matthew Jasper
65bdb31a97 Report text_direction_codepoint_in_literal when parsing
- The lint is now reported in code that gets removed/modified/duplicated
  by macro expansion.
- Spans are more accurate
- Fixes #140281
2025-05-27 15:57:41 +00:00
Stan Manilov
a5c16e6cb8 Make links in coinduction.md clickable
Although they are clickable in the github preview, they aren't in the actual rendered HTML on https://rustc-dev-guide.rust-lang.org/.

This commit fixes that.
2025-05-27 18:53:30 +03:00
Stan Manilov
c3603c64ba Link to description of opaque types 2025-05-27 18:50:31 +03:00
bjorn3
026baa1c6f Do not get proc_macro from the sysroot in rustc
With the stage0 refactor the proc_macro version found in the sysroot
will no longer always match the proc_macro version that proc-macros get
compiled with by the rustc executable that uses this proc_macro. This
will cause problems as soon as the ABI of the bridge gets changed to
implement new features or change the way existing features work.

To fix this, this commit changes rustc crates to depend directly on the
local version of proc_macro which will also be used in the sysroot that
rustc will build.
2025-05-27 15:49:28 +00:00
bors
c583fa6d84 Auto merge of #141644 - compiler-errors:rollup-gl5hize, r=compiler-errors
Rollup of 17 pull requests

Successful merges:

 - rust-lang/rust#140591 (Fix malformed suggestion for E0061 when method is a macro token in macro context)
 - rust-lang/rust#141536 (Improve `ambiguous_wide_pointer_comparisons` lint compare diagnostics)
 - rust-lang/rust#141552 (Pull out dedicated `cfg_version` syntax test from feature gate test)
 - rust-lang/rust#141556 (bootstrap: translate Windows paths in a way that works for both Cygwin and MSYS2)
 - rust-lang/rust#141563 (Remove out-of-date `noop_*` names.)
 - rust-lang/rust#141568 (dist: make sure llvm-project submodule is present)
 - rust-lang/rust#141580 (Use more detailed spans in dyn compat errors within bodies)
 - rust-lang/rust#141582 (intrinsics, ScalarInt: minor cleanup)
 - rust-lang/rust#141584 (Support `opaque_types_defined_by` for `SyntheticCoroutineBody`)
 - rust-lang/rust#141587 (Add missing edition directives for async-await tests)
 - rust-lang/rust#141594 (Add `generic_arg_infer` test)
 - rust-lang/rust#141596 (rustc book: fix erratic sentence by making it more simple)
 - rust-lang/rust#141599 (Remove an unnecessary use of `Box::into_inner`.)
 - rust-lang/rust#141611 (Update mdbook to 0.4.51)
 - rust-lang/rust#141616 (Remove spastorino from vacations)
 - rust-lang/rust#141623 (use custom types to clarify arguments to `emit_ptr_va_arg`)
 - rust-lang/rust#141635 (further dedup `WalkItemKind` for `mut_visit` and `visit`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-05-27 15:43:55 +00:00
Sidney Cammeresi
8656d9e619 Unit test for Range parameter of BTreeMap::extract_if 2025-05-27 08:31:56 -07:00
Sidney Cammeresi
38c37eb3cb Update docs for new Range parameter to BTreeMap::extract_if etc. 2025-05-27 08:31:56 -07:00
Sidney Cammeresi
1ae96fcd79 Update tests with Range parameter to BTreeMap::extract_if etc. 2025-05-27 08:31:56 -07:00