Commit Graph

1557 Commits

Author SHA1 Message Date
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
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 (691ab6c5bf)  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 (c670293630)
- `-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
bjorn3
9297586cb9 Move invocation_temp into OutputFilenames
While it was previously defined in Session, it is only ever used with
OutputFilenames methods.
2026-05-06 15:01:54 +00:00
bjorn3
da6e4d4890 Move CrateInfo computation after codegen_crate
CrateInfo is only necessary during linking and non-local LTO.
2026-05-06 14:51:38 +00:00
Guillaume Gomez
e4097f672e Rollup merge of #156092 - susitsm:needs-hir-hash, r=petrochenkov
Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.

While reviewing `crate_hash` query usage for https://github.com/rust-lang/rust/pull/155871, the `needs_crate_hash` function turned out to be the cause of unnecessary calls to the query. The `needs_crate_hash` name is easy to mistake for the functionality of "needs the crate_hash query". This PR removes the usage of `needs_crate_hash` where it was not appropriate and renames the function to `needs_hir_hash` which better reflects its functionality.
2026-05-05 02:50:11 +02:00
Jacob Pratt
c3afa21a40 Rollup merge of #156065 - mejrs:spanculler, r=JonathanBrouwer
Remove unused spans from AttributeKind

Recently I noticed some spans in diagnostic attributes were never used. I went through and checked the other variants too.
2026-05-03 00:25:33 -04:00
Matyas Susits
a34cb767be Only include crate_hash in Linker if incremental compilation is enabled, not when needs_crate_hash is true.
Exactly as the comment on the `crate_hash` field of `Linker` says, that
field is only used when incremental compilation is enabled.
`needs_crate_hash` returns true in some other cases too.
2026-05-02 17:53:50 +02:00
mejrs
4a13f36265 Remove more spans from AttributeKind 2026-05-02 17:41:30 +02:00
Ralf Jung
e402c1edf0 miri: remove retag statements, make typed copies retag implicitly instead 2026-05-02 17:40:33 +02:00
Jacob Pratt
a89e69e21d Rollup merge of #156002 - GuillaumeGomez:diagnostic-instead-of-closure, r=JonathanBrouwer
Allow to use `Diagnostic` directly in `SharedContext::emit_lint`

Part of https://github.com/rust-lang/rust/issues/153099.

r? @JonathanBrouwer
2026-04-30 22:28:35 -04:00
Jacob Pratt
894bdf298e Rollup merge of #155980 - nnethercote:mv-feature-methods, r=TaKO8Ki
Move `feature*` methods from `parse` mod to `errors` mod.

As the FIXME comment says, these no longer use `ParseSess` and so the `parse` mod is not a good place for them. The `errors` mod is a better home.

r? @TaKO8Ki
2026-04-30 22:28:33 -04:00
Jacob Pratt
4e12409c82 Rollup merge of #155991 - lqd:in-flight-query-profiling, r=bjorn3
Catch unwinds from the global ctxt callback to complete queries profiling data in more cases

The driver/compiler interface provides multiple callbacks, and we sometimes catch unwinds to flush diagnostics, ensure ICEs appear, and so on even when fatal errors occur.

When these panics happen, we don't `finish` the `TyCtxt`, and there's a fixme about that. Unfortunately this is where we also allocate the self-profile strings: query events for example start as virtual and are turned into real strings by this finalization process; they are _invalid_ without this step. When fatal errors happen, the in-flight query name will be `<unknown>`, event counts will be inaccurate, etc.

This PR catches panics from another of these callbacks, where the `TyCtxt` is available, to allow for the self-profiling data to be computed before continuing the unwinding process as before. `finish` does more things, that I don't want to introduce here.

I remember seeing this discussed in GH issues in the past, but can't find any open ones now. It may also have been only mentioned while trying to profile existing slowness issues. I stumbled upon this again recently when looking into `tests/ui/try-trait/deep-try-chain-issue-153583.rs`, where the slowest query is `<unknown>`.

```
> rm *.mm_profdata ; rustc +nightly -Zself-profile tests/ui/try-trait/deep-try-chain-issue-153583.rs ; summarize summarize *.mm_profdata | head -n 5

error[E0277]: the `?` operator can only be applied to values that implement `Try`
 --> tests/ui/try-trait/deep-try-chain-issue-153583.rs:6:5
  |
6 |     0?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
  |     ^^ the `?` operator cannot be applied to type `{integer}`
  |
  = help: the nightly-only, unstable trait `Try` is not implemented for `{integer}`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.
+------------------------------------------------------+-----------+-----------------+----------+------------+
| Item                                                 | Self time | % of total time | Time     | Item count |
+------------------------------------------------------+-----------+-----------------+----------+------------+
| <unknown>                                            | 1.55s     | 99.416          | 3.21s    | 15230      |
+------------------------------------------------------+-----------+-----------------+----------+------------+
```

This PR fixes that case at least. In general, it should fix the invalid profiling records for fatal errors happening while a query is running.

```
+------------------------------------------------------+-----------+-----------------+----------+------------+
| Item                                                 | Self time | % of total time | Time     | Item count |
+------------------------------------------------------+-----------+-----------------+----------+------------+
| typeck_root                                          | 5.04s     | 95.588          | 5.08s    | 1          |
+------------------------------------------------------+-----------+-----------------+----------+------------+
```

r? @bjorn3
2026-04-30 22:28:29 -04:00
Guillaume Gomez
f51cf6398b Allow to use Diagnostic directly in SharedContext::emit_lint 2026-04-30 16:01:12 +02:00
Rémy Rakic
e4eb91ca0f catch callback unwinding to finalize in-flight self-profiling events from queries
fatal errors currently abort the compiler process without allocating the self-profile
strings: query events aren't always correctly recorded, and will show up as <unknown>
in the data.

catching the unwinding panic allows us to finalize the self-profiling process correctly
before continuing unwinding as before.
2026-04-30 15:14:55 +02:00
Nicholas Nethercote
6d79bc6f01 Move feature* methods from parse mod to errors mod.
As the FIXME comment says, these no longer use `ParseSess` and so the
`parse` mod is not a good place for them. The `errors` mod is a better
home.
2026-04-30 12:02:33 +10:00
Jonathan Brouwer
c208e0e1aa Rollup merge of #155949 - GuillaumeGomez:steal-lints, r=JonathanBrouwer,kivooeo
Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lints, allowing to use `FnOnce` instead of `Fn`

Part of https://github.com/rust-lang/rust/issues/153099.

This is needed for https://github.com/rust-lang/rust/compare/main...GuillaumeGomez:rust:diagnostic-instead-of-closure?expand=1 which will allow to pass `Diagnostic` instead of a closure.

As asked by @JonathanBrouwer, I make this as a stand-alone PR. :)

r? @JonathanBrouwer
2026-04-29 23:51:41 +02:00
bors
0424cc1673 Auto merge of #155775 - JonathanBrouwer:cleanup_stage, r=jdonszelmann,petrochenkov
Remove attribute parsing `Stage`



I discovered that it is surprisingly easy to remove the concept of `Stage` in the attribute parsers, imo this makes the code a lot cleaner.

r? @jdonszelmann 
cc @mejrs @Bryntet
2026-04-29 07:39:46 +00:00
Jonathan Brouwer
67cf0dee49 Remove most usages of Stage 2026-04-29 07:41:14 +02:00
Nicholas Nethercote
01e933f888 Move four fields from ParseSess to Session.
`ParseSess` is separate from, but sits within, `Session`. The separation
is because there are some places (e.g. `Parser` methods) where
`ParseSess` is available but `Session` is not.

However, `ParseSess` has four fields that are only accessed from places
where `Session` is also available. This commit moves those fields to
`Session`. This means that `ParseSess` only contains the fields it
genuinely needs, and various `sess.psess.foo` occurrences are reduced to
`sess.foo`.
2026-04-29 09:27:04 +10:00
Guillaume Gomez
fffc4b5781 Update opt_ast_lowering_delayed_lints query to allow "stealing" lints, allowing to use FnOnce instead of Fn 2026-04-29 01:21:54 +02:00
Guillaume Gomez
faecc47eab Update triagebot.toml file to take into account the moved file
Create a new `SharedContext::emit_dyn_lint_with_sess` method to simplify code when `Session` is not needed
Remove crate name from `UnexpectedCfgCargoMacroHelp`
2026-04-27 17:57:55 +02:00
Guillaume Gomez
e7b9d94435 Remove unused diagnostic types 2026-04-25 04:20:04 +02:00
Guillaume Gomez
b80d0b8894 Remove remaining AttributeLintKind variants 2026-04-25 04:13:16 +02:00
Guillaume Gomez
36459d9914 Make it possible to have access to Session and crates name in attr_parsing lints 2026-04-25 04:12:23 +02:00