1579 Commits

Author SHA1 Message Date
Paul Murphy c340e8a2ba Allow section override when using patchable-function-entries
Sometimes it is necessary to group patchable function entrypoint
records in distinct linker sections. This is the case for some bpf
functions within the linux kernel which shouldn't be visible to
ftrace.

Extend `-Zpatchable-function-entry` to accept an argument of the form
`prefix_nops,total_nops,record_section`, which places all entry
record into a user specified section.

Likewise, extend the `patchable_function_entry` attribute to accept an
optional `section="name"` option to place a function into a specific
section.

This is made possible by llvm attribute `patchable-function-entry-section`
added in llvm 21.
2026-06-29 08:52:28 -05:00
Jonathan Brouwer 4631799a4a Rollup merge of #158185 - xmakro:perf/stable-crate-ids-lockfree, r=mu001999
perf: Make stable_crate_ids reads lock-free after crate loading
2026-06-26 20:22:20 +02:00
Jacob Pratt a82172d9ca Rollup merge of #158036 - pmur:murp/add-fentry, r=folkertdev
Add -Zinstrument-mcount=fentry to -Zinstrument-mcount

fentry is essentially a simpler version of mcount where the counting function is called before any other function prologue actions happen.

fentry is still used by the linux x86-64 kernel. It's unclear if or when patchable-function-entry will replace it. It is also used by clang for some x86-64 mingw toolchains.

This is only supported on some x86, x86-64, and s390x targets.
2026-06-25 17:53:53 -04:00
bors 973ad0d0ab Auto merge of #158239 - nnethercote:rework-lint-pass-running, r=Urgau
Rework lint pass running



Some cleanups relating to the running of lint passes.

r? @Urgau
2026-06-25 08:22:49 +00:00
aerooneqq 3d19869935 Refactor proc_macro_decls_static 2026-06-22 10:22:53 +03:00
Nicholas Nethercote 9b420de3f7 Rework check_ast_node_inner
It's called in two cases: pre-expansion lists, and early lints. The
appropriate builtin pass is specified at the call site but the
appropriate other passes are chosen within, which is inconsistent.

This commit changes it so everything is chosen within, based on the
boolean `pre_expansion_lint` parameter. `check_ast_node_inner` is split
into `run_passes` and `run_pass`; the extra function is needed because
the genericness of `builtin_lints` is pushed down one level below
`check_ast_node`.
2026-06-22 16:03:45 +10:00
Jonathan Brouwer 45e0dedeaf Rollup merge of #158193 - JonathanBrouwer:late-lint-experiment, r=jdonszelmann
Remove `has_delayed_lints` optimization

Keeping track of `has_delayed_lints` doesn't seem to have a perf effect anymore so let's not make the code more complicated than needed. These flags were previously used so we don't have to iterate over all hir owners, but iterating over all hir owners seems fast enough

cc @jdonszelmann
2026-06-21 14:52:10 +02:00
Jonathan Brouwer 2668f36a40 Rollup merge of #155439 - ranger-ross:cargo-new-build-dir-layout, r=bjorn3,kobzol
Enable Cargo's new build-dir layout

This PR enables the new Cargo `build-dir` layout in boostrap builds with `-Zbuild-dir-new-layout`.

See: [#t-infra/bootstrap > Has anyone tested `./x` with the new build-dir layout?](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Has.20anyone.20tested.20.60.2E.2Fx.60.20with.20the.20new.20build-dir.20layout.3F/with/581660716)

Tracked in: https://github.com/rust-lang/cargo/issues/15010

r? @bjorn3

cc: @epage
2026-06-21 14:52:08 +02:00
Ross Sullivan 61f3e086ac fix: Only add native paths to PATH during macro expansion on windows
This reduces the size of PATH on windows during macro expansion to avoid
hitting windows limits. With the new Cargo build-dir layout this becomes
more important as Cargo now passes more `-L` args which end up bloating
PATH.
2026-06-21 18:44:24 +09:00
Jonathan Brouwer 7a14504a86 Remove has_delayed_lints optimization 2026-06-21 10:01:09 +02:00
xmakro 7c96471b6f perf: Make stable_crate_ids reads lock-free after crate loading 2026-06-20 11:38:00 -07:00
Nicholas Nethercote 43a9857143 Change EarlyCheckNode from a trait to an enum.
It only has two impls, both of which are tuples, which is ugly. An enum
is much simpler and clearer.

Also, `EarlyContextAndPass` doesn't need to be public.
2026-06-19 08:49:59 +10:00
Paul Murphy 6ce0650633 Add -Zinstrument-mcount=fentry to -Zinstrument-mcount
fentry is essentially a simpler version of mcount where the
counting function is called before any other function prologue
actions happen.

fentry is still used by the linux x86-64 kernel. It's unclear if
or when patchable-function-entry will replace it. It is also used
by clang for some x86-64 mingw toolchains.

This is only supported on some x86, x86-64, and s390x targets.
2026-06-17 13:09:33 -05:00
Jonathan Brouwer 3aa45f9798 Rollup merge of #156950 - cezarbbb:staticlib-rename-internal-symbols, r=petrochenkov
Staticlib rename internal symbols

Follow-up to rust-lang/rust#155338.

`-Zstaticlib-rename-internal-symbols` appends a crate-specific suffix (`_rs{StableCrateId}`) to non-exported symbols, resolving duplicate symbol conflicts when linking multiple Rust staticlibs into the same binary.

The implementation collects all defined `GLOBAL/WEAK` symbol names not in the exported set across all .o files, then renames them by extending the strtab and patching symbol name offsets. When combined with `-Zstaticlib-hide-internal-symbols`, the renamed symbols also receive `STV_HIDDEN` visibility.

Supported on ELF targets (Linux, BSD, etc.) and Apple targets (macOS, iOS, etc.). On unsupported targets (Windows), a warning is emitted and the flag has no effect.

r?@bjorn3 @petrochenkov
2026-06-16 22:11:02 +02:00
cezarbbb 796bc58860 add -Zstaticlib-rename-internal-symbols 2026-06-16 09:41:25 +08:00
Camille Gillot 0e9f9312c3 Steal ResolverAstLowering when indexing AST. 2026-06-16 00:10:08 +00:00
Camille GILLOT 5464994cdd Split-up the AST to index it. 2026-06-16 00:10:07 +00:00
Camille Gillot 334a95f9f4 Make lowering incremental.
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
2026-06-16 00:08:10 +00:00
Camille Gillot bfe40ed753 Stop stealing ResolverAstLowering. 2026-06-15 23:24:10 +00:00
Guillaume Gomez d4b2610172 Rename rustc_interface/src/errors.rs into rustc_interface/src/diagnostics.rs 2026-06-13 14:51:05 +02:00
Jonathan Brouwer c756ac4695 Rollup merge of #157348 - ashi009:remap-cwd-prefix-incremental, r=davidtwco,Urgau
Don't track cwd for `-Zremap-cwd-prefix` in incremental compilation

## Summary

`-Zremap-cwd-prefix=<to>` defeats incremental compilation whenever the build directory changes (Bazel sandboxes, CI checkouts with per-build paths), even though the remapped output is identical:

```
[incremental] completely ignoring cache because of differing commandline arguments
```

This fixes the cwd half of rust-lang/rust#132132.

### Root cause

`-Zremap-cwd-prefix` and `--remap-path-prefix` have two separate options (`remap_cwd_prefix` and `remap_path_prefix`), but `parse_remap_path_prefix` *merges* them: it resolves `std::env::current_dir()` and pushes `(cwd, to)` onto `remap_path_prefix`, which is `[TRACKED_NO_CRATE_HASH]`. The **absolute** cwd thus enters `dep_tracking_hash(false)` (compared in `rustc_incremental::persist::load`), so the same build from a different directory purges the whole incremental session.

### Fix: apply the cwd prefix where the mapping is built, not where options are tracked

Keep each option holding exactly its own flag, and apply `-Zremap-cwd-prefix` in `file_path_mapping` — i.e. while building the (untracked) applied `FilePathMapping` — instead of in `parse_remap_path_prefix`. The absolute cwd then lives only in the runtime mapping and never in a tracked option.

**Behaviour-preserving for output:** the applied mapping is identical (the cwd entry is still appended last, so it keeps taking precedence over `--remap-path-prefix` as documented), and all emitted paths (debuginfo, diagnostics, metadata) are unchanged.

**Sound for tracking:** the cwd's effect is still tracked, by the two options that *should* carry it —

* `remap_cwd_prefix` (`[TRACKED]`) — the target prefix baked into output;
* `working_dir` (`[TRACKED]`) — and `RealFileName`'s hash already includes the real local path **only** when the path was not fully remapped (`was_fully_remapped()` = `scopes.is_all()`):

  ```rust
  if !self.was_fully_remapped() { self.local.hash(state); }
  self.maybe_remapped.hash(state);
  ```

  So under a restrictive `-Zremap-path-scope` (where the cwd can still leak into output) the real cwd stays tracked via `working_dir`; under full remapping (where it cannot leak) it is correctly ignored. Dropping the cwd from `remap_path_prefix`'s hash is therefore sound in **every** scope.

The **stable** `--remap-path-prefix` flag is entirely unchanged in data and in tracking. No SVH/crate-hash change (`remap_path_prefix` is `TRACKED_NO_CRATE_HASH`); no new types and no special-case hashing.

### Notes

* A unit test (`tests/ui`-style, in `rustc_interface`) guards against the cwd being merged back into the tracked `remap_path_prefix`, while asserting it is still applied via `file_path_mapping`.
* The unstable book entry for `-Zremap-cwd-prefix` is updated to document the incremental-cache behaviour across build directories.
* A `tests/run-make` end-to-end test (build the same sources from two directories sharing one `-Cincremental` dir, asserting cache reuse) would be a good follow-up; happy to add it here if preferred.

### Relation to stabilization (tracking issue rust-lang/rust#89434)

This is a behaviour fix to an unstable flag and does not depend on or block stabilization. It is, however, mildly relevant to one of the open questions in the tracking issue (rust-lang/rust#89434) — *"Will this always be defined to be the same as `--remap-path-prefix=$(pwd)=VALUE`?"*. After this PR the two are **no longer** equivalent for incremental compilation: a literal `--remap-path-prefix=$(pwd)=.` still bakes the absolute cwd into the tracked hash, whereas `-Zremap-cwd-prefix=.` no longer does. Worth keeping in mind whenever that question is revisited (e.g. alongside RFC 3127).

r? compiler
2026-06-12 20:40:49 +02:00
Jacob Pratt fbc2411811 Rollup merge of #157601 - aerooneqq:delegation-glob-useless-target-expr-error, r=petrochenkov
Emit error for unused target expression in glob and list delegations

This PR emits error if unuse  target expression is specified for glob delegation. Second part of rust-lang/rust#156798.

Part of rust-lang/rust#118212.
r? @petrochenkov
2026-06-11 00:34:02 -04:00
aerooneqq 67081117f0 Emit error for unused target expression in glob and list delegations 2026-06-10 14:07:39 +03:00
Jonathan Brouwer d7bcfdb13f Rollup merge of #155338 - cezarbbb:staticlib-symbol-hygiene, r=petrochenkov
Staticlib hide internal symbols

According to issue rust-lang/rust#104707, when building a staticlib, all Rust internal symbols — mangled symbols, `#[rustc_std_internal_symbol]` items, allocator shims, etc. — leak out of the static archive. In contrast, cdylib correctly exports only `#[no_mangle]` symbols via a linker version script.

`-Zstaticlib-hide-internal-symbols` directly post-processes ELF object files in the archive: parsing the `SHT_SYMTAB` sections and setting `STV_HIDDEN` visibility on any `GLOBAL/WEAK` defined symbol that is not in the exported symbol set, without changing the binding. This is an in-place modification (only writing the st_other byte per matching entry), with zero overhead.

Supported on ELF targets (Linux, BSD, etc.) and Apple targets (macOS, iOS, etc.). On unsupported targets (Windows), a warning is emitted and the flag has no effect.

**Update**: The rename counterpart (`-Zstaticlib-rename-internal-symbols`) is in rust-lang/rust#156950.

The test code are as follows:

1.a std rust staticlib:
```rust
use std::collections::HashMap;
use std::panic::{catch_unwind, AssertUnwindSafe};

#[no_mangle]
pub extern "C" fn my_add(a: i32, b: i32) -> i32 { a + b }

#[no_mangle]
pub extern "C" fn my_hash_lookup(key: u64) -> u64 {
    let mut map = HashMap::new();
    for i in 0..100u64 { map.insert(i, i.wrapping_mul(2654435761)); }
    *map.get(&key).unwrap_or(&0)
}

pub fn internal_reverse(s: &str) -> String { s.chars().rev().collect() }

#[no_mangle]
pub extern "C" fn my_format_number(n: i32) -> i32 {
    let s = format!("number: {}", n); s.len() as i32
}

#[no_mangle]
pub extern "C" fn my_safe_div(a: i32, b: i32) -> i32 {
    match catch_unwind(AssertUnwindSafe(|| {
        if b == 0 { panic!("division by zero!"); }
        a / b
    })) {
        Ok(result) => result,
        Err(_) => -1,
    }
}

#[no_mangle]
pub extern "C" fn my_uncaught_panic() { panic!("uncaught panic across FFI"); }
```

1.b downstream c program:
```c
extern int my_add(int a, int b);
extern unsigned long my_hash_lookup(unsigned long key);
extern int my_format_number(int n);
extern int my_safe_div(int a, int b);
extern void my_uncaught_panic(void);

int main() {
    int failures = 0;
    if (my_add(10, 20) != 30) failures++;
    if (my_hash_lookup(5) != 5UL * 2654435761UL) failures++;
    if (my_format_number(42) != 10) failures++;
    if (my_safe_div(100, 5) != 20) failures++;
    if (my_safe_div(100, 0) != -1) failures++;
    pid_t pid = fork();
    if (pid == 0) { alarm(5); my_uncaught_panic(); _exit(0); }
    else { waitpid(pid, &status, 0); }
    return failures;
}
```

The test results with different compiler flags(which might cause binary size reduction) are as follows:
1.c result with `-Zstaticlib-hide-internal-symbols`
```
  settings                   OFF        ON  -Zsave     ALL    OFF.dynsym ON.dynsym
  ------------------------------------------------------------------------
  default                 1.7M      1.5M  204K (12%)    1735       5    1730
  lto_thin                616K      584K  33K (5%)     246       5     241
  lto_fat                 525K      525K    0 (0%)       6       5       1
  opt_s                   1.7M      1.5M  204K (12%)    1735       5    1730
  opt_z                   1.7M      1.5M  204K (12%)    1735       5    1730
  lto_thin_z              602K      570K  32K (5%)     246       5     241
  lto_fat_z               514K      514K    0 (0%)       6       5       1
  full                    514K      514K    0 (0%)       6       5       1
```

1.d result with `-Zstaticlib-hide-internal-symbols + -Zstaticlib-rename-internal-symbols`
```
  settings                   OFF        ON  -Zsave     ALL    OFF.dynsym ON.dynsym
  ------------------------------------------------------------------------
  default                 1.7M      1.5M  162K (9%)    1735       5    1730
  lto_thin                616K      599K  18K (2%)     246       5     241
  lto_fat                 525K      535K  -1% (-1%)       6       5       1
  opt_s                   1.7M      1.5M  162K (9%)    1735       5    1730
  opt_z                   1.7M      1.5M  162K (9%)    1735       5    1730
  lto_thin_z              602K      585K  18K (2%)     246       5     241
  lto_fat_z               514K      524K  -1% (-1%)       6       5       1
  full                    514K      523K  -1% (-1%)       6       5       1
```

2.a no_std rust staticlib
```rust
#![no_std]
#![feature(core_intrinsics)]

use core::panic::PanicInfo;

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! { loop {} }

#[no_mangle]
pub extern "C" fn embedded_add(a: i32, b: i32) -> i32 { a.wrapping_add(b) }

#[no_mangle]
pub extern "C" fn embedded_checksum(data: *const u8, len: usize) -> u8 {
    if data.is_null() { return 0; }
    let slice = unsafe { core::slice::from_raw_parts(data, len) };
    let mut sum: u8 = 0;
    for &byte in slice { sum = sum.wrapping_add(byte); }
    sum
}

fn internal_helper() -> i32 { 42 }
#[no_mangle]
pub extern "C" fn call_internal() -> i32 { internal_helper() }

#[no_mangle]
pub extern "C" fn embedded_trigger_abort() { core::intrinsics::abort(); }
```
2.b downstream c program
```c
extern int embedded_add(int a, int b);
extern unsigned char embedded_checksum(const unsigned char *data, unsigned long len);
extern int call_internal(void);
extern void embedded_trigger_abort(void);

int main() {
    int failures = 0;
    if (embedded_add(10, 20) != 30) failures++;
    unsigned char data[] = {1, 2, 3};
    if (embedded_checksum(data, 3) != 6) failures++;
    if (call_internal() != 42) failures++;
    pid_t pid = fork();
    if (pid == 0) { embedded_trigger_abort(); _exit(0); }
    else { waitpid(pid, &status, 0); }
    return failures;
}
```

The test results with different compiler flags(which might cause binary size reduction) are as follows:
2.c result with `-Zstaticlib-hide-internal-symbols`
```
  settings                   OFF        ON  -Zsave     ALL    OFF.dynsym ON.dynsym
  ------------------------------------------------------------------------
  default                 485K      429K  56K (11%)     490       4     486
  lto_thin                180K      180K    0 (0%)       4       4       0
  lto_fat                 179K      179K    0 (0%)       4       4       0
  opt_s                   485K      429K  56K (11%)     490       4     486
  opt_z                   485K      429K  56K (11%)     490       4     486
  lto_thin_z              180K      180K    0 (0%)       4       4       0
  lto_fat_z               179K      179K    0 (0%)       4       4       0
  full                    179K      179K    0 (0%)       4       4       0
```

2.d result with `-Zstaticlib-hide-internal-symbols + -Zstaticlib-rename-internal-symbols`
```
  settings                   OFF        ON  -Zsave     ALL    OFF.dynsym ON.dynsym
  ------------------------------------------------------------------------
  default                 485K      447K  39K (7%)     490       4     486
  lto_thin                180K      189K  -5% (-5%)       4       4       0
  lto_fat                 179K      189K  -5% (-5%)       4       4       0
  opt_s                   485K      448K  38K (7%)     490       4     486
  opt_z                   485K      448K  38K (7%)     490       4     486
  lto_thin_z              180K      189K  -5% (-5%)       4       4       0
  lto_fat_z               179K      189K  -5% (-5%)       4       4       0
  full                    179K      189K  -5% (-5%)       4       4       0
```

Test results show that this compiler option is beneficial for scenarios where LTO cannot be enabled.

r? @bjorn3 @petrochenkov
2026-06-08 09:41:54 +02:00
cezarbbb 6caae67115 add -Zstaticlib-hide-internal-symbols 2026-06-08 08:33:13 +08:00
bjorn3 f484629863 Assert incr comp in copy_cgu_workproduct_to_incr_comp_cache_dir
It was already only called when incr comp is enabled and this allows
cleaning up the callers a bit.
2026-06-07 13:24:14 +00:00
bjorn3 9419baeee8 Use WorkProductMap instead of FxIndexMap
This is an UnordMap internally. Iteration order for the work product map
should not matter aside from the place it is serialized where sorting by
WorkProductId is sufficient.
2026-06-07 13:24:12 +00:00
Jonathan Brouwer 8ae06c8e46 Rollup merge of #157296 - aerooneqq:delegation-extract-resolve, r=petrochenkov
delegation: split resolution and lowering

This PR splits delegation's AST -> HIR lowering and its resolution. Now we resolve all delegations and then lower them. This should have benefits:

- ~For rust-lang/rust#156798, where it will be convenient to insert diagnostics about specifying target expressions for glob reuses of only static functions (the `delegations_resolutions` map will contain information whether to lower or delete target expression)~
- For rust-lang/rust#155337 and delegations to inherent methods resolution, as from what I tested up until now we should resolve them in iterative manner before AST -> HIR lowering.

Part of rust-lang/rust#118212.
r? @petrochenkov
2026-06-04 15:33:23 +02:00
aerooneqq cf34955dbe Split delegation resolution and lowering 2026-06-04 15:07:31 +03:00
bors 49b19d32b9 Auto merge of #157404 - jhpratt:rollup-npYd5Y2, r=jhpratt
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#156210 (Emit retags in codegen to support BorrowSanitizer (part 2))
 - rust-lang/rust#157317 (Fix ICE when wrong intra-doc link on type alias)
 - rust-lang/rust#157391 (Reorganize `tests/ui/issues` [4/N])
2026-06-04 03:56:06 +00:00
Jacob Pratt fa82c8dc3e Rollup merge of #156210 - BorrowSanitizer:codegen-emit-retag-2, r=saethlin
Emit retags in codegen to support BorrowSanitizer (part 2)

Tracking issue: rust-lang/rust#154760
[Zulip Thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Staging.20for.20emitting.20retags.20in.20codegen/with/593004012)

This is one of several PRs that will add experimental support for emitting retags as function calls in codegen. Each PR will be a minimal, improved slice of the changes in rust-lang/rust#155965.

This PR adds a new unstable flag `-Zcodegen-emit-retag`, which will enable experimental retag calls in generated code. This flag is a nop for now, but the relevant methods have been added to codegen_ssa, and they are called wherever retags are necessary. Subsequent PRs will complete this implementation.

This does not depend on rust-lang/rust#156208.

r? @RalfJung
2026-06-03 21:49:45 -04:00
bors 76dfce2cb2 Auto merge of #145477 - cjgillot:codegen-mode, r=oli-obk
Introduce `TypingMode::Codegen` to avoid layout cycles on coroutines



Computing layout of coroutines depends on their `optimized_mir`. At the same time, MIR opts can require using layouts to work. For instance to evaluate constants. This leads to cycles and clumsy workarounds.

This PR creates a new typing mode for layout computations:
- when a coroutine's layout is requested with `TypingMode::PostAnalysis` or earlier, return `LayourError::TooGeneric`;
- when a coroutine's layout is requested with `TypingMode::Codegen`, actually compute it.

`TypingMode::Codegen` is meant be be used by codegen code, and analyses that require coroutine layout, like transmute check and coroutine recursion check.

With this PR, we can remove all `is_coroutine` checks from `rustc_mir_transform` and unlock simplifying coroutine MIR.

Perf is not terrific. This PR causes recomputation of a few queries, and I had to insert workarounds.
2026-06-03 23:14:30 +00:00
Xiaoyi Shi 5886a51840 rustc_session: apply -Zremap-cwd-prefix when building the file mapping
`-Zremap-cwd-prefix=<to>` was applied inside `parse_remap_path_prefix`, which
resolved `std::env::current_dir()` and pushed `(cwd, to)` onto
`remap_path_prefix`. That option is `[TRACKED_NO_CRATE_HASH]`, so the absolute
working directory entered the incremental command-line-args hash, and building
the same sources from a different directory (e.g. a Bazel sandbox, whose path
contains a per-action counter) purged the whole incremental cache even though the
remapped output is identical.

`--remap-path-prefix` and `-Zremap-cwd-prefix` already have separate options
(`remap_path_prefix` and `remap_cwd_prefix`). Keep each option holding exactly its
own flag, and apply `-Zremap-cwd-prefix` in `file_path_mapping` -- i.e. when
building the (untracked) applied `FilePathMapping` -- rather than when
parsing/tracking options. The absolute cwd then lives only in the runtime mapping,
never in a tracked field.

Output is unchanged (the cwd entry is still appended last). Tracking stays sound:
the cwd's effect is tracked via `remap_cwd_prefix` (the target prefix baked into
output) and `working_dir` (whose `RealFileName` hash includes the real path only
when it was not fully remapped, i.e. exactly when the cwd can leak into output).
The stable `--remap-path-prefix` flag is unchanged in data and in tracking.

A unit test guards against the cwd being merged back into `remap_path_prefix`.
2026-06-04 00:17:26 +08:00
Camille Gillot 4b6f78da0b Do not compute coroutine layout in non-Codegen typing mode. 2026-06-03 14:16:36 +00:00
bjorn3 9b7623a162 Remove -Zemscripten-wasm-eh
This was necessary when transitioning from JS to wasm exception handling
on Emscripten. Enough time has probably passed that we no longer need to
support JS exception handling on Emscripten. This enables cleaning up a
fair bit of code.
2026-06-02 19:56:40 +02:00
Jonathan Brouwer a5f745740f Rollup merge of #156887 - zamazan4ik:rename-debuginfo-for-profiling-switch, r=folkertdev
Rename `-Zdebuginfo-for-profiling` switch

The PR was raised from this [comment](https://github.com/rust-lang/rust/pull/155942#discussion_r3188023601) from another stabilization PR: https://github.com/rust-lang/rust/pull/155942

I renamed `-Zdebug-info-for-profiling` into `-Zdebuginfo-for-profiling` before stabilization to be consistent with other `debuginfo`-related Rustc flags like `-C split-debuginfo` and `-C debuginfo`.

One important note is that Clang has the [flag](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fdebug-info-for-profiling) under `-fdebug-info-for-profiling`. I decided that consistency with other Rustc flags is more important here than to be consistent with Clang.

r? folkertdev (as was proposed [here](https://github.com/rust-lang/rust/pull/155942#issuecomment-4527927374))
2026-05-30 18:01:55 +02:00
Guillaume Gomez dc05df7ebe Rollup merge of #157022 - RalfJung:inline-intrinsics-v2, r=oli-obk
MIR inlining: allow backends to opt-in to inlining intrinsics

This is the same as https://github.com/rust-lang/rust/pull/156398. Github stopped processing updates on that other branch.

r? @oli-obk
2026-05-27 20:45:10 +02:00
Ralf Jung 59428e76e8 MIR inlining: allow backends to opt-in to inlining intrinsics 2026-05-27 13:59:25 +02:00
bors 77a4fb62f7 Auto merge of #155678 - aerooneqq:single-owners-query-exp, r=oli-obk
Merge several HIR-level queries into one



Now four queries (`local_def_id_to_hir_id`, `opt_hir_owner_nodes`, `opt_ast_lowering_delayed_lints`, `in_scope_traits_map`) were replaced with regular methods which acts like getters. 
An `hir_owner` query was added that returns a `ProjectedMaybeOwner` that contains all those fields. `hir_attr_map` remains a separate query as adding attributes to `ProjectedMaybeOwner` led to [perf regressions](https://github.com/rust-lang/rust/pull/155678#issuecomment-4304597871). 
There is a similar issue with `in_scopes_trait_map`, but according to the comments from https://github.com/rust-lang/rustc-perf/pull/2436 it is a rare case.
Most of the changes in incremental tests are renames from `opt_hir_owner_nodes` -> `hir_owner`, but there are few cases when new dirty queries were added.

r? @petrochenkov
r? @oli-obk
2026-05-27 11:45:44 +00:00
Alexander Zaitsev bcf900133d feat: rename debug-info-for-profiling switch 2026-05-24 20:17:07 +02:00
Ian McCormack c8d945e346 Add missing import. 2026-05-19 22:14:50 -04:00
Ian McCormack a22eaef5e5 Add -Zcodegen-emit-retag with nop retags. 2026-05-19 22:14:50 -04:00
aerooneqq f3b0a0e266 Comments cleanup 2026-05-18 10:41:15 +03:00
aerooneqq 1f60130485 Add hir_ prefixes for queries 2026-05-18 08:51:08 +03:00
Stephen 8477a690b1 add support for Zprint-codegen-stats-json 2026-05-11 16:28:51 -04:00
Jonathan Brouwer c6fbd9f8a7 Rollup merge of #154498 - RalfJung:option-deprecations, r=fmease
turn some long-deprecated -C options into errors

- `-Car` has been documented to do nothing for more than 8 years (https://github.com/rust-lang/rust/commit/691ab6c5bf597e98a4bae94b9a433f029f9ca9c1)  and causes a warning for more than a year (https://github.com/rust-lang/rust/pull/135126).
- `-Cno-stack-check` has been made a NOP and deprecated with a warning more than 9 years ago (https://github.com/rust-lang/rust/commit/c670293630611cdf677cfc5bc9a17ba378f78b84)
- `-Cinline-threshold` has been made a NOP and deprecated with a warning almost 2 years ago (https://github.com/rust-lang/rust/pull/124712).

With them being ignored there's always a risk someone thinks they'll do something and they don't notice the warning. I think these have been deprecated for long enough that we can turn them into hard errors.

Also change the type of these fields to `()` so there's no information here that the rest of the compiler could use. This supersedes the `rustc_lint_opt_deny_field_access` trick.

MCP: https://github.com/rust-lang/compiler-team/issues/978
2026-05-08 11:35:31 +02:00
Ralf Jung e35da4efa1 turn some long-deprecated options into errors 2026-05-08 08:27:08 +02:00
Jonathan Brouwer 05c012fff5 Rollup merge of #156198 - Zoxc:threads-sync, r=folkertdev
Add `sync` option to `-Z threads` to force synchronization on one thread

This adds a `sync` option to `-Z threads` to force synchronization while still using one thread. This is useful to measure overhead of synchronization without the noise of additional threads.
2026-05-07 22:44:06 +02:00
Jonathan Brouwer a48901b65b Rollup merge of #156245 - bjorn3:move_invocation_temp, r=oli-obk
Move invocation_temp into OutputFilenames

While it was previously defined in Session, it is only ever used with OutputFilenames methods.
2026-05-07 14:13:54 +02:00
John Kåre Alsaker 8aafed8a17 Add sync option to -Z threads to force synchronization on one thread 2026-05-07 02:06:18 +02:00