2540 Commits

Author SHA1 Message Date
León Orell Valerian Liehr
092c6f3a18
Gate const trait syntax 2025-08-05 14:52:02 +02:00
Matthias Krüger
61285e211b
Rollup merge of #138554 - xizheyin:issue-138401, r=chenyukang
Distinguish delim kind to decide whether to emit unexpected closing delimiter

Fixes #138401
2025-07-18 19:14:42 +02:00
xizheyin
181c1bda0e
Deduplicate unmatched_delims in rustc_parse to reduce confusion
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-18 20:34:58 +08:00
Matthias Krüger
03734ae794
Rollup merge of #143891 - scrabsha:push-xxtttopqoprr, r=jdonszelmann
Port `#[coverage]` to the new attribute system

r? ``````@jdonszelmann``````
2025-07-18 04:27:52 +02:00
bors
9cd918bcbb Auto merge of #143879 - fee1-dead-contrib:push-lrlpoouyqqry, r=fmease
parse `const trait Trait`

r? oli-obk or anyone from project-const-traits

cc `@rust-lang/project-const-traits`
2025-07-17 15:54:33 +00:00
Deadbeef
69326878ee parse const trait Trait 2025-07-17 18:06:26 +08:00
Matthias Krüger
465ae94328
Rollup merge of #143631 - hkBst:update-escaper-2, r=compiler-errors
update to literal-escaper-0.0.5

Quoting from the changelog, this version brings:
- Use `NonZero<char/u8>` in `unescape_c_str` and `check_raw_c_str` to statically exclude nuls
- Add `#[inline]` to small functions for improved performance
2025-07-17 10:41:45 +02:00
Sasha Pourcelot
4e054fc4c4 Port #[coverage] to the new attribute system 2025-07-16 15:51:18 +02:00
bors
e27f16a499 Auto merge of #143958 - samueltardieu:rollup-lh1s143, r=samueltardieu
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#142301 (tests: Fix duplicated-path-in-error fail with musl)
 - rust-lang/rust#143630 (Drop `./x suggest`)
 - rust-lang/rust#143736 (Give all bytes of TypeId provenance)
 - rust-lang/rust#143752 (Don't panic if WASI_SDK_PATH not set when detecting compiler)
 - rust-lang/rust#143837 (Adjust `run_make_support::symbols` helpers)
 - rust-lang/rust#143878 (Port `#[pointee]` to the new attribute parsing infrastructure)
 - rust-lang/rust#143905 (Recover and suggest to use `;` to construct array type)
 - rust-lang/rust#143907 (core: make `str::split_at_unchecked()` inline)
 - rust-lang/rust#143910 (Add experimental `backtrace-trace-only` std feature)
 - rust-lang/rust#143927 (Preserve constness in trait objects up to hir ty lowering)
 - rust-lang/rust#143935 (rustc_type_ir/walk: move docstring to `TypeWalker` itself)
 - rust-lang/rust#143938 (Update books)
 - rust-lang/rust#143941 (update `cfg_select!` documentation)

Failed merges:

 - rust-lang/rust#143926 (Remove deprecated fields in bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-07-15 11:42:55 +00:00
Samuel Tardieu
010e3ef113
Rollup merge of #143941 - folkertdev:cfg-select-docs, r=traviscross
update `cfg_select!` documentation

tracking issue: https://github.com/rust-lang/rust/issues/115585

After rust-lang/rust#143461, and with an eye on a soon(ish) stabilization, I think the docs need some work.

The existing text read more like a motivation for the feature existing to me, so I've tried to now be a bit more descriptive. Still, suggestions are very welcome.

I also added a test for an empty `select! {}` because it's just the sort of thing that might break.

r? ``@traviscross``
2025-07-15 12:52:44 +02:00
Samuel Tardieu
281990eb16
Rollup merge of #143905 - xizheyin:143828, r=compiler-errors
Recover and suggest to use `;` to construct array type

Fixes rust-lang/rust#143828

r? compiler
2025-07-15 12:52:40 +02:00
Jonathan Brouwer
6133c676d7
Define attribute parser & config evaluator 2025-07-15 09:21:26 +02:00
xizheyin
ed88af2163
Recover and suggest use ; to construct array type
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-15 12:00:46 +08:00
Jonathan Brouwer
f0d0afab8e
Port #[pointee] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-14 23:16:31 +02:00
Folkert de Vries
d0153f5872
update cfg_select! documentation
and make internal terminology consistent

Co-authored-by: Travis Cross <tc@traviscross.com>
2025-07-14 22:29:28 +02:00
Samuel Tardieu
bbda0c9fb5
Rollup merge of #143855 - JonathanBrouwer:omit_gdb_pretty_printer_section, r=jdonszelmann
Port `#[omit_gdb_pretty_printer_section]` to the new attribute parsing

Ports `#[omit_gdb_pretty_printer_section]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163

r? ```@jdonszelmann```
2025-07-14 18:05:45 +02:00
Jakub Beránek
93c10272d0
Rollup merge of #143217 - Periodic1911:link-ordinal, r=jdonszelmann
Port #[link_ordinal] to the new attribute parsing infrastructure

Ports link_ordinal to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197
2025-07-14 11:04:52 +02:00
bors
ad635e5d06 Auto merge of #143779 - JonathanBrouwer:automatically_derived_parser, r=oli-obk
Port `#[automatically_derived]` to the new attribute parsing infrastructure

Ports `#[automatically_derived]` to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971351163

r? `@oli-obk`
cc `@jdonszelmann`
2025-07-14 04:29:53 +00:00
bors
e9182f195b Auto merge of #143461 - folkertdev:cfg-select-builtin-macro, r=petrochenkov
make `cfg_select` a builtin macro

tracking issue: https://github.com/rust-lang/rust/issues/115585

This parses mostly the same as the `macro cfg_select` version, except:

1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected.
2. in an expression context, the rhs is no longer wrapped in a block, so that this now works:
  ```rust
  fn main() {
      println!(cfg_select! {
          unix => { "foo" }
          _ => { "bar" }
      });
  }
  ```
3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works

I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule.

cc `@traviscross` if I'm missing any feature that should/should not be included
r? `@petrochenkov` for the macro logic details
2025-07-13 18:34:13 +00:00
Folkert de Vries
3689b80b75
make cfg_select a builtin macro 2025-07-13 14:34:40 +02:00
Anne Stijns
75561c446a Port #[link_ordinal] to the new attribute parsing infrastructure. 2025-07-13 11:51:01 +02:00
Jonathan Brouwer
86349e31dd
Port #[omit_gdb_pretty_printer_section] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12 22:55:48 +02:00
Jonathan Brouwer
ef82007ed7
Port #[automatically_derived] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12 17:48:50 +02:00
Matthias Krüger
c8780fff6a
Rollup merge of #143403 - GrigorenkoPV:attributes/traits, r=jdonszelmann
Port several trait/coherence-related attributes the new attribute system

Part of rust-lang/rust#131229

This ports:
- `#[const_trait]`
- `#[rustc_deny_explicit_impl]`
- `#[rustc_do_not_implement_via_object]`
- `#[rustc_coinductive]`
- `#[type_const]`
- `#[rustc_specialization_trait]`
- `#[rustc_unsafe_specialization_marker]`
- `#[marker]`
- `#[fundamental]`
- `#[rustc_paren_sugar]`
- `#[rustc_allow_incoherent_impl]`
- `#[rustc_coherence_is_core]`

This also changes `#[marker]` to error on duplicates instead of warning.
cc rust-lang/rust#142838, but I don't think it matters too much, since it's unstable.

r? ``@oli-obk``
2025-07-11 19:45:22 +02:00
yukang
93db9e7ee0 Remove uncessary parens in closure body with unused lint 2025-07-10 09:25:56 +08:00
Pavel Grigorenko
e584ed0de2 Port #[rustc_coherence_is_core] to the new attribute system 2025-07-09 01:26:39 +03:00
Pavel Grigorenko
e9e64954e6 Port #[rustc_allow_incoherent_impl] to the new attribute system 2025-07-09 01:26:39 +03:00
Pavel Grigorenko
1bdf703171 Port #[rustc_paren_sugar] to the new attribute system 2025-07-09 01:26:39 +03:00
Pavel Grigorenko
507ebced16 Port #[fundamental] to the new attribute system 2025-07-09 01:26:27 +03:00
Pavel Grigorenko
12f6487d79 Port #[marker] to the new attribute system 2025-07-09 01:18:28 +03:00
Pavel Grigorenko
a57a885abc Port #[rustc_unsafe_specialization_marker] to the new attribute system 2025-07-09 01:07:15 +03:00
Pavel Grigorenko
6193783961 Port #[rustc_specialization_trait] to the new attribute system 2025-07-09 01:07:12 +03:00
Pavel Grigorenko
813ec60744 Port #[type_const] to the new attribute system 2025-07-09 01:06:29 +03:00
Pavel Grigorenko
6f8e92d5aa Port #[rustc_coinductive] to the new attribute system 2025-07-09 01:06:29 +03:00
Pavel Grigorenko
adb325fc16 Port #[rustc_do_not_implement_via_object] to the new attribute system 2025-07-09 01:05:21 +03:00
Pavel Grigorenko
938916d220 Port #[rustc_deny_explicit_impl] to the new attribute system 2025-07-09 01:04:35 +03:00
Pavel Grigorenko
62f58dbb2d Port #[const_trait] to the new attribute system 2025-07-09 01:03:00 +03:00
Matthias Krüger
bc9b313cb5
Rollup merge of #143402 - GrigorenkoPV:attributes/link_attrs, r=jdonszelmann
Port several linking (linkage?) related attributes the new attribute system

This ports:
- `#[export_stable]`
- `#[ffi_const]`
- `#[ffi_pure]`
- `#[rustc_std_internal_symbol]`

Part of rust-lang/rust#131229

r? ``@oli-obk``
2025-07-08 19:29:37 +02:00
Marijn Schouten
d44dcd4513 update to literal-escaper-0.0.5 2025-07-08 10:16:44 +00:00
Matthias Krüger
65dded8387
Rollup merge of #143589 - RalfJung:const-pat, r=compiler-errors
const-block-as-pattern: do not refer to no-longer-existing nightly feature

Surely everyone who used this nightly feature has fixed their code by now. So let's not confused people on stable that try to use a const block as a pattern by referring to some dead nightly feature.
2025-07-08 03:09:58 +02:00
Ralf Jung
1a6eff747f const-block-as-pattern: do not refer to no-longer-existing nightly feature 2025-07-07 16:18:41 +02:00
Yotam Ofek
3b48407f93 Remove unused allow attrs 2025-07-07 12:58:16 +00:00
Pavel Grigorenko
4f0b0b0f01 Port #[rustc_std_internal_symbol] to the new attribute system 2025-07-07 14:59:52 +03:00
Pavel Grigorenko
5d7771e50d Port #[ffi_pure] to the new attribute system 2025-07-07 14:59:01 +03:00
Pavel Grigorenko
99a9fe1b22 Port #[ffi_const] to the new attribute system 2025-07-07 14:52:52 +03:00
Pavel Grigorenko
bb8b741c32 Port #[export_stable] to the new attribute system 2025-07-07 14:33:20 +03:00
Jacob Pratt
7eea141b87
Rollup merge of #143544 - workingjubilee:rename-bare-fn, r=fmease
compiler: rename BareFn to FnPtr

At some point "BareFn" was the chosen name for a "bare" function, without the niceties of `~fn`, `&fn`, or a few other ways of writing a function type. However, at some point the syntax for a "bare function" and any other function diverged even more. We started calling them what they are: function pointers, denoted by their own syntax.

However, we never changed the *internal* name for these, as this divergence was very gradual. Personally, I have repeatedly searched for "FnPtr" and gotten confused until I find the name is BareFn, only to forget this until the next time, since I don't routinely interact with the higher-level AST and HIR. But even tools that interact with these internal types only touch on them in a few places, making a migration easy enough. Let's use a more intuitive and obvious name, as this 12+ year old name has little to do with current Rust.
2025-07-07 03:26:09 +02:00
Jubilee Young
0a4f87a144 compiler: rename {ast,hir}::BareFn* to FnPtr*
Fix some comments and related types and locals where it is obvious, e.g.
- bare_fn -> fn_ptr
- LifetimeBinderKind::BareFnType -> LifetimeBinderKind::FnPtrType

Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2025-07-06 15:03:08 -07:00
Jonathan Brouwer
244d64e60b
Port #[path] to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 22:19:16 +02:00
Jonathan Brouwer
ef3d7741e5
Move check for new attribute to check_builtin_meta_item
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06 22:18:58 +02:00