Files
rust/compiler/rustc_ast
Jonathan Brouwer 34df6a0ab8 Rollup merge of #160216 - khyperia:gca-path-cleanup, r=BoxyUwU,bit-aloo
clean up handling of paths in mgca

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

Handling of ambiguous type-or-constant argument paths was really wonky and distinct from the regular `can_lower_expr_to_const_arg_direct` lowering paths. Clean that up and unify it, as discussed here https://github.com/rust-lang/rust/pull/158479#discussion_r3544664708

Also, do a bunch of other little cleanups at the same time while I'm here:

- add support for parens to the inside of direct_const_arg! and macroless_generic_const_args (idk why this wasn't a thing before)
- add constant and lifetime ribs when resolving TyKind::DirectConstArg - note the TyKind, not ExprKind (~~I am unsure if/how this changes behavior~~ added a test, `direct-const-arg-correct-rib.rs`) - this was discussed here https://github.com/rust-lang/rust/pull/158617#issuecomment-4932249112
- minor debug logging change
- various minor code shuffles/cleanups
- add test for `direct_const_arg!(_)` inferring to a type - this test should have been added in https://github.com/rust-lang/rust/pull/159058 which added this behavior (well, changed the behavior from an ICE to inferring to a type)
- add a test asserting the current behavior of parens/braces/underscores on stable - one or two of these cases already have tests elsewhere, but it's nice to assert the whole set, and also assert the whole set in the same place so it's easily visible to be able to give me confidence the whole set actually is tested (both positives and negatives are important here)
- add a test similar to the previous one, but with mgca enabled, asserting all combinations now compile successfully

r? @BoxyUwU
2026-08-10 13:45:40 +02:00
..
2026-07-27 10:33:18 +02:00
…

The rustc_ast crate contains those things concerned purely with syntax – that is, the AST ("abstract syntax tree"), along with some definitions for tokens and token streams, data structures/traits for mutating ASTs, and shared definitions for other AST-related parts of the compiler (like the lexer and macro-expansion).

For more information about how these things work in rustc, see the rustc dev guide: