Commit graph

1624 commits

Author SHA1 Message Date
Edvin Bryntesson
5692064521
Port #[rustc_never_returns_null_ptr] to attribute parser 2025-12-17 12:35:32 +01:00
Jacob Pratt
656d4e8a96
Rollup merge of #150072 - Bryntet:parse_no_link, r=JonathanBrouwer
Port #[no_link] to use attribute parser

Adds `#[no_link]` to the attribute parser, as well as adds tests making sure to FCW warn on `field`, `arm`, and `macrodef `
2025-12-16 23:10:12 -05:00
Jacob Pratt
66155a7df6
Rollup merge of #150000 - Bryntet:brynte/parse_legacy_const_generic_args, r=jonathanbrouwer,jdonszelmann
Port `#[rustc_legacy_const_generics]` to use attribute parser

Small PR that ports the `#[rustc_legacy_const_generics]` to use the new attribute parser!

r? JonathanBrouwer
2025-12-16 23:10:10 -05:00
Edvin Bryntesson
52bcaabdb8
Port #[no_link] to use attribute parser 2025-12-16 22:45:32 +01:00
Edvin Bryntesson
4bd0e65bde
Port #[rustc_legacy_const_generics] to use attribute parser 2025-12-16 20:29:01 +01:00
Jubilee Young
0004d8d421 Remove deny of manual-let-else 2025-12-16 08:42:04 -08:00
David Wood
78b06057ef
attr: parse rustc_scalable_vector(N)
Extend parsing of `ReprOptions` with `rustc_scalable_vector(N)` which
optionally accepts a single literal integral value - the base multiple of
lanes that are in a scalable vector. Can only be applied to structs.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@arm.com>
2025-12-16 11:00:11 +00:00
bors
3f4dc1e02d Auto merge of #146348 - jdonszelmann:eiiv3, r=lcnr,oli-obk
Externally implementable items

Supersedes https://github.com/rust-lang/rust/pull/140010
Tracking issue: https://github.com/rust-lang/rust/issues/125418

Getting started:

```rust
#![feature(eii)]

#[eii(eii1)]
pub fn decl1(x: u64)
// body optional (it's the default)
{
    println!("default {x}");
}

// in another crate, maybe
#[eii1]
pub fn decl2(x: u64) {
    println!("explicit {x}");
}

fn main() {
    decl1(4);
}
```

- tiny perf regression, underlying issue makes multiple things in the compiler slow, not just EII, planning to solve those separately.
- No codegen_gcc support, they don't have bindings for weak symbols yet but could
- No windows support yet for weak definitions

This PR merges the implementation of EII for just llvm + not windows, doesn't yet contain like a new panic handler implementation or alloc handler. With this implementation, it would support implementing the panic handler in terms of EII already since it requires no default implementation so no weak symbols

The PR has been open in various forms for about a year now, but I feel that having some implementation merged to build upon
2025-12-14 04:20:26 +00:00
Esteban Küber
a49c175380 #![deny(clippy::manual_let_else)] in some rustc modules 2025-12-12 17:53:19 +00:00
Jana Dönszelmann
5768b234de
use our own alternative to STD_INTERNAL_SYMBOL and make sure we mangle EIIs properly 2025-12-12 12:14:54 +01:00
Jana Dönszelmann
b732030025
make EII iteration faster 2025-12-12 11:28:58 +01:00
Jana Dönszelmann
33df6ccb21
EII lowering 2025-12-12 11:28:58 +01:00
Guillaume Gomez
64aaeacd71 Update to new API, allowing to remove check_doc_cfg.rs file from librustdoc 2025-12-10 12:28:08 +01:00
Guillaume Gomez
4191e94715 Improve spans for auto_cfg(hide/show) errors 2025-12-10 12:28:08 +01:00
Guillaume Gomez
1da7684c7d Improve code and add more comments 2025-12-10 12:28:07 +01:00
Guillaume Gomez
06238bd93e Update rustdoc JSON output to new attribute API 2025-12-10 12:28:07 +01:00
Guillaume Gomez
2340f8054c Update to new lint API 2025-12-10 12:28:07 +01:00
Guillaume Gomez
348d9d98e0 Correctly iterate doc comments in intra-doc resolution in rustc_resolve 2025-12-10 12:28:07 +01:00
Guillaume Gomez
9c8c67bfdd Fix warning messages 2025-12-10 12:27:34 +01:00
Guillaume Gomez
57870b7242 Fix doc(auto_cfg) attribute parsing 2025-12-10 12:27:34 +01:00
Guillaume Gomez
d35ec316c5 Keep a list of CfgEntry instead of just one 2025-12-10 12:27:33 +01:00
Guillaume Gomez
368a103902 Fix Cfg add/or operations 2025-12-10 12:27:33 +01:00
Guillaume Gomez
148e522112 Correctly differentiate between sugared and raw doc comments 2025-12-10 12:27:33 +01:00
Guillaume Gomez
acb32df7b1 Continue migration to new Attribute API for doc attribute 2025-12-10 12:27:33 +01:00
Jana Dönszelmann
3f08e4dcd9 start using parsed doc attributes everywhere 2025-12-10 12:27:33 +01:00
Jana Dönszelmann
df007cf800 rewrite doc attribute (non-doc-comments) 2025-12-10 12:27:33 +01:00
Matthias Krüger
ece99775da
Rollup merge of #149215 - JonathanBrouwer:cfg_lints2, r=jdonszelmann
Emit `check-cfg` lints during attribute parsing rather than evaluation

The goal of this PR is to make the `eval_config_entry` not have any side effects, by moving the check-cfg lints to the attribute parsing. This also helps ensure we do emit the lint in situations where the attribute happens to be parsed, but never evaluated.

cc ``@jdonszelmann`` ``@Urgau`` for a vibe check if you feel like it
2025-12-09 06:17:22 +01:00
Jana Dönszelmann
f8bbf2ca06
split out blob decode trait 2025-12-08 00:24:28 +01:00
Jonathan Brouwer
71b093fd2c
Emit check-cfg lints during attribute parsing rather than evaluation#149215 2025-12-06 10:22:13 +01:00
Jonathan Brouwer
8f59eb0177
Move attribute lints to rustc_lint 2025-12-05 14:22:52 +01:00
bors
3e2dbcdd3a Auto merge of #149646 - matthiaskrgr:rollup-jbfeow8, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#147224 (Emscripten: Turn wasm-eh on by default)
 - rust-lang/rust#149405 (Recover on misspelled item keyword)
 - rust-lang/rust#149443 (Tidying up UI tests [6/N])
 - rust-lang/rust#149524 (Move attribute safety checking to attribute parsing)
 - rust-lang/rust#149593 (powf, powi: point out SNaN non-determinism)
 - rust-lang/rust#149605 (Use branch name instead of HEAD when unshallowing)
 - rust-lang/rust#149612 (Apply the `bors` environment also to the `outcome` job)
 - rust-lang/rust#149623 (Don't require a normal tool build of clippy/rustfmt when running their test steps)
 - rust-lang/rust#149627 (Point to the item that is incorrectly annotated with `#[diagnostic::on_const]`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-04 22:04:03 +00:00
Jonathan Brouwer
31d289c9bc
Lower spans in AttrPath correctly 2025-12-03 17:00:20 +01:00
Jonathan Brouwer
884fb5aef2
Move attribute safety checking to rustc_attr_parsing 2025-12-03 17:00:06 +01:00
Waffle Lapkin
e4f02e40b6
fix guard patterns interaction with never type 2025-12-03 16:01:38 +01:00
Waffle Lapkin
62f7cf415b
move expr_guaranteed_to_constitute_read_for_never and pat_guaranteed_to_constitute_read_for_never to more accessible locations 2025-12-02 18:13:02 +01:00
bors
c86564c412 Auto merge of #149397 - matthiaskrgr:rollup-go79y6a, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#147071 (constify from_fn, try_from_fn, try_map, map)
 - rust-lang/rust#148930 (tweak editor configs)
 - rust-lang/rust#149320 (-Znext-solver: normalize expected function input types when fudging)
 - rust-lang/rust#149363 (Port the `#![windows_subsystem]` attribute to the new attribute system)
 - rust-lang/rust#149378 (make run-make tests use 2024 edition by default)
 - rust-lang/rust#149381 (Add `impl TrustedLen` on `BTree{Map,Set}` iterators)
 - rust-lang/rust#149388 (remove session+blob decoder construction)
 - rust-lang/rust#149390 (`rust-analyzer` subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-27 19:24:40 +00:00
Matthias Krüger
d67a12dfff
Rollup merge of #148256 - lcnr:orphan-check, r=spastorino,WaffleLapkin
remove support for `typeof`

see https://github.com/rust-lang/compiler-team/issues/940 closes https://github.com/rust-lang/rust/issues/148700

This also enables checks for invariants previously broken by `typeof` again.

r? types
2025-11-27 15:59:11 +01:00
Sasha Pourcelot
2ab2090937 Port the #![windows_subsystem] attribute to the new attribute system 2025-11-27 00:17:48 +01:00
bors
99ca3fc4ec Auto merge of #149351 - Zalathar:rollup-ee06zha, r=Zalathar
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#147936 (Offload intrinsic)
 - rust-lang/rust#148358 (Fix some issues around `rustc_public`)
 - rust-lang/rust#148452 (Mangle symbols with a mangled name close to PDB limits with v0 instead of legacy mangling to avoid linker errors)
 - rust-lang/rust#148751 (Build gnullvm toolchains on Windows natively)
 - rust-lang/rust#148951 (rustc_target: aarch64: Remove deprecated FEAT_TME)
 - rust-lang/rust#149149 ([rustdoc] misc search index cleanups)
 - rust-lang/rust#149173 (Use rust rather than LLVM target features in the target spec)
 - rust-lang/rust#149307 (Deny const auto traits)
 - rust-lang/rust#149312 (Mark riscv64gc-unknown-linux-musl as tier 2 target)
 - rust-lang/rust#149317 (Handle inline asm in has_ffi_unwind_calls)
 - rust-lang/rust#149326 (Remove unused `Clone` derive on `DelayedLint`)
 - rust-lang/rust#149341 (Add `Copy` to some AST enums.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-11-26 15:10:08 +00:00
Stuart Cook
25a861a21a
Rollup merge of #149326 - JonathanBrouwer:remove_clone, r=lcnr
Remove unused `Clone` derive on `DelayedLint`
2025-11-26 23:32:10 +11:00
bors
c797096598 Auto merge of #149140 - oli-obk:more-encoder-minimization, r=jdonszelmann
More encoder minimizations

follow-up to https://github.com/rust-lang/rust/pull/149054
2025-11-26 11:57:29 +00:00
Jonathan Brouwer
7693c0a3d1
Remove unused Clone derive on DelayedLint 2025-11-25 21:16:31 +01:00
Oli Scherer
b93f2d8b26 Add a macro for defaulted enum encoding, use it for hir::Defaultness and deduplicate the logic for other similar enums 2025-11-25 11:19:52 +00:00
lcnr
feb13036ef remove support for type-of 2025-11-25 10:19:44 +01:00
Urgau
e2a69cea60 Add #[rustc_should_not_be_called_on_const_items] attribute 2025-11-22 14:27:28 +01:00
Oli Scherer
a3062aac12 Only encode hir::Safety::Safe in metadata.
While `Unsafe` is much less common, a failure to encode it would make downstream crates default to `Safe` and think a thing marked as unsafe is actually safe
2025-11-20 12:01:31 +00:00
bors
07bdbaedc6 Auto merge of #149054 - oli-obk:min-encode, r=fee1-dead
Avoid encoding non-constness or non-asyncness in metadata

r? `@fee1-dead`

Let's see if we can get any benefit (even just metadata size) from not encoding the common case.

Inspired by https://github.com/rust-lang/rust/pull/148434#discussion_r2491732811
2025-11-19 12:06:14 +00:00
bors
6159a44067 Auto merge of #148434 - oli-obk:inherent-const-impl, r=fee1-dead
Inherent const impl

Some constifications are annoying because we need to repeat `T: Trait` bounds from an impl block on the individual constified `const fn`s as `T: [const] Trait`. We've brainstormed solutions before, and one would be to have separate `const impl` blocks or sth. However the final syntax will look, I decided to just impl this syntax and either have sth nice on nightly to work with or at least move the discussion along.

Also interacts with the discussion around `impl const Trait for Type` vs `const impl Trait for Type`, as we may want to use the latter to keep inherent and trait impls in sync (unless we come up with even another scheme).

* [ ] rustdoc + tests
* [ ] macro stability /regression tests

r? `@fee1-dead`

cc `@traviscross` `@rust-lang/project-const-traits`
2025-11-19 02:23:56 +00:00
Oli Scherer
357fd66c04 Avoid encoding non-constness or non-asyncness in metadata 2025-11-18 10:12:13 +00:00
Oli Scherer
2a36d33930 Give all impls a constness 2025-11-18 09:20:21 +00:00