about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
AgeCommit message (Collapse)AuthorLines
2025-07-13Auto merge of #143461 - folkertdev:cfg-select-builtin-macro, r=petrochenkovbors-1/+78
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-13make `cfg_select` a builtin macroFolkert de Vries-1/+78
2025-07-13Port `#[link_ordinal]` to the new attribute parsing infrastructure.Anne Stijns-0/+1
2025-07-12Port `#[omit_gdb_pretty_printer_section]` to the new attribute parsing ↵Jonathan Brouwer-0/+1
infrastructure Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-12Port `#[automatically_derived]` to the new attribute parsing infrastructureJonathan Brouwer-0/+1
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-11Rollup merge of #143403 - GrigorenkoPV:attributes/traits, r=jdonszelmannMatthias Krüger-0/+12
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-10Remove uncessary parens in closure body with unused lintyukang-1/+1
2025-07-09Port `#[rustc_coherence_is_core]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[rustc_allow_incoherent_impl]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[rustc_paren_sugar]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[fundamental]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[marker]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[rustc_unsafe_specialization_marker]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[rustc_specialization_trait]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[type_const]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[rustc_coinductive]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[rustc_do_not_implement_via_object]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[rustc_deny_explicit_impl]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-09Port `#[const_trait]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-08Rollup merge of #143402 - GrigorenkoPV:attributes/link_attrs, r=jdonszelmannMatthias Krüger-0/+4
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-08Rollup merge of #143589 - RalfJung:const-pat, r=compiler-errorsMatthias Krüger-2/+4
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-07const-block-as-pattern: do not refer to no-longer-existing nightly featureRalf Jung-2/+4
2025-07-07Remove unused allow attrsYotam Ofek-1/+0
2025-07-07Port `#[rustc_std_internal_symbol]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-07Port `#[ffi_pure]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-07Port `#[ffi_const]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-07Port `#[export_stable]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-07Rollup merge of #143544 - workingjubilee:rename-bare-fn, r=fmeaseJacob Pratt-7/+7
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-06compiler: rename {ast,hir}::BareFn* to FnPtr*Jubilee Young-7/+7
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-06Port `#[path]` to the new attribute parsing infrastructureJonathan Brouwer-0/+1
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-06Move check for new attribute to `check_builtin_meta_item`Jonathan Brouwer-36/+35
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-05Port `#[ignore]` to the new attribute parsing infrastructureJonathan Brouwer-2/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-04Port `#[non_exhaustive]` to the new attribute parsing infrastructureJonathan Brouwer-0/+1
2025-07-04Rollup merge of #143400 - GrigorenkoPV:attributes/lints, r=jdonszelmannMatthias Krüger-0/+1
Port `#[rustc_pass_by_value]` to the new attribute system Part of rust-lang/rust#131229 r? `@oli-obk`
2025-07-04Auto merge of #143237 - JonathanBrouwer:no_implicit_prelude_parser, ↵bors-0/+1
r=jdonszelmann,oli-obk Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure Ports no_implicit_prelude to the new attribute parsing infrastructure for https://github.com/rust-lang/rust/issues/131229#issuecomment-2971353197 r? `@oli-obk` cc `@jdonszelmann`
2025-07-04Rollup merge of #143380 - cjgillot:kw_span, r=compiler-errorsJacob Pratt-2/+12
Replace kw_span by full span for generic const parameters. Small simplification extracted from https://github.com/rust-lang/rust/pull/127241
2025-07-04Port `#[rustc_pass_by_value]` to the new attribute systemPavel Grigorenko-0/+1
2025-07-03Port `#[no_implicit_prelude]` to the new attribute parsing infrastructureJonathan Brouwer-0/+1
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-03Replace kw_span by full span.Camille GILLOT-2/+12
2025-07-03Port `#[target_feature]` to the new attribute parsing infrastructureJonathan Brouwer-0/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-02Auto merge of #143338 - matthiaskrgr:rollup-ykaxh04, r=matthiaskrgrbors-16/+37
Rollup of 11 pull requests Successful merges: - rust-lang/rust#131923 (Derive `Copy` and `Hash` for `IntErrorKind`) - rust-lang/rust#138340 (Remove some unsized tuple impls now that we don't support unsizing tuples anymore) - rust-lang/rust#141219 (Change `{Box,Arc,Rc,Weak}::into_raw` to only work with `A = Global`) - rust-lang/rust#142212 (bootstrap: validate `rust.codegen-backends` & `target.<triple>.codegen-backends`) - rust-lang/rust#142237 (Detect more cases of unused_parens around types) - rust-lang/rust#142964 (Attribute rework: a parser for single attributes without arguments) - rust-lang/rust#143070 (Rewrite `macro_rules!` parser to not use the MBE engine itself) - rust-lang/rust#143235 (Assemble const bounds via normal item bounds in old solver too) - rust-lang/rust#143261 (Feed `explicit_predicates_of` instead of `predicates_of`) - rust-lang/rust#143276 (loop match: handle opaque patterns) - rust-lang/rust#143306 (Add `track_caller` attributes to trace origin of Clippy lints) r? `@ghost` `@rustbot` modify labels: rollup try-job: aarch64-apple try-job: x86_64-msvc-1 try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl try-job: test-various
2025-07-02Rollup merge of #142237 - benschulz:unused-parens-fn, r=fee1-deadMatthias Krüger-16/+37
Detect more cases of unused_parens around types With this change, more unused parentheses around bounds and types nested within bounds are detected.
2025-07-02Auto merge of #143214 - camsteffen:remove-let-chains-feature, r=est31bors-1/+8
Remove let_chains unstable feature Per https://github.com/rust-lang/rust/issues/53667#issuecomment-3016742982 (but then I also noticed rust-lang/rust#140722) This replaces the feature gate with a parser error that says let chains require 2024. A lot of tests were using the unstable feature. I either added edition:2024 to the test or split out the parts that require 2024.
2025-07-01Auto merge of #143036 - compiler-errors:no-dyn-star, r=oli-obkbors-8/+2
Remove support for `dyn*` from the compiler This PR removes support for `dyn*` (https://github.com/rust-lang/rust/issues/102425), which are a currently un-RFC'd experiment that was opened a few years ago to explore a component that we thought was necessary for AFIDT (async fn in dyn trait). It doesn't seem like we are going to need `dyn*` types -- even in an not-exposed-to-the-user way[^1] -- for us to implement AFIDT. Given that AFIDT was the original motivating purpose of `dyn*` types, I don't really see a compelling reason to have to maintain their implementation in the compiler. [^1]: Compared to, e.g., generators whih are an unstable building block we use to implement stable syntax like `async {}`. We've learned quite a lot from `dyn*`, but I think at this point its current behavior leads to more questions than answers. For example, `dyn*` support today remains somewhat fragile; it ICEs in many cases where the current "normal" `dyn Trait` types rely on their unsizedness for their vtable-based implementation to be sound I wouldn't be surprised if it's unsound in other ways, though I didn't play around with it too much. See the examples below. ```rust #![feature(dyn_star)] trait Foo { fn hello(self); } impl Foo for usize { fn hello(self) { println!("hello, world"); } } fn main() { let x: dyn* Foo = 1usize; x.hello(); } ``` And: ```rust #![feature(dyn_star)] trait Trait { type Out where Self: Sized; } fn main() { let x: <dyn* Trait as Trait>::Out; } ``` ...and probably many more problems having to do with the intersection of dyn-compatibility and `Self: Sized` bounds that I was too lazy to look into like: * GATs * Methods with invalid signatures * Associated consts Generally, `dyn*` types also end up getting in the way of working with [normal `dyn` types](https://github.com/rust-lang/rust/issues/102425#issuecomment-1712604409) to an extent that IMO outweighs the benefit of experimentation. I recognize that there are probably other, more creative usages of `dyn*` that are orthogonal to AFIDT. However, I think any work along those lines should first have to think through some of the more fundamental interactions between `dyn*` and dyn-compatibility before we think about reimplementing them in the type system. --- I'm planning on removing the `DynKind` enum and the `PointerLike` built-in trait from the compiler after this PR lands. Closes rust-lang/rust#102425. cc `@eholk` `@rust-lang/lang` `@rust-lang/types` Closes rust-lang/rust#116979. Closes rust-lang/rust#119694. Closes rust-lang/rust#134591. Closes rust-lang/rust#104800.
2025-07-01Remove support for dyn*Michael Goulet-8/+2
2025-07-01Fix duplicate errors for `link_section`, ↵Jonathan Brouwer-0/+3
`rustc_layout_scalar_valid_range_start` and `rustc_layout_scalar_valid_range_end`
2025-07-01Fix `#[rustc_macro_transparency]` giving two errorsJonathan Brouwer-0/+1
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01Fix double error for `export_name`Jonathan Brouwer-0/+1
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-07-01Detect more cases of unused_parens around typesBenjamin Schulz-16/+37
2025-06-30Remove let_chains featureCameron Steffen-1/+8