about summary refs log tree commit diff
path: root/compiler/rustc_ast_pretty
AgeCommit message (Collapse)AuthorLines
2023-11-08Clarify `space_between`.Nicholas Nethercote-30/+42
To avoid `!matches!(...)`, which is hard to think about. Instead every case now uses direct pattern matching and returns true or false. Also add a couple of cases to the `stringify.rs` test that currently print badly.
2023-11-04Fix remaining uses of `CaptureBy::Value`Dinu Blanovschi-1/+1
2023-10-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-2/+2
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
2023-10-27Add gen blocks to ast and do some broken ast loweringOli Scherer-2/+2
2023-10-17Auto merge of #116822 - notriddle:notriddle/rust-logo, r=fmeasebors-0/+3
docs: add Rust logo to more compiler crates c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more. r? `@GuillaumeGomez`
2023-10-16docs: add Rust logo to more compiler cratesMichael Howell-0/+3
c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more.
2023-10-16Preserve unicode escapes in format string literals when pretty-printing ASTPaul Gey-2/+2
2023-10-12Rename `tt_prepend_space` as `space_between`.Nicholas Nethercote-4/+4
And reorder the arguments. I find it easier to think about this way.
2023-09-11Move let expression checking to parsingMatthew Jasper-1/+1
There was an incomplete version of the check in parsing and a second version in AST validation. This meant that some, but not all, invalid uses were allowed inside macros/disabled cfgs. It also means that later passes have a hard time knowing when the let expression is in a valid location, sometimes causing ICEs. - Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location. - Suppress later errors and MIR construction for invalid let expressions.
2023-08-24Auto merge of #115131 - frank-king:feature/unnamed-fields-lite, r=petrochenkovbors-1/+13
Parse unnamed fields and anonymous structs or unions (no-recovery) It is part of #114782 which implements #49804. Only parse anonymous structs or unions in struct field definition positions. r? `@petrochenkov`
2023-08-24Parse unnamed fields and anonymous structs or unionsFrank King-1/+13
Anonymous structs or unions are only allowed in struct field definitions. Co-authored-by: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com>
2023-08-17Add helpful comments to `tt_prepend_space`.Nicholas Nethercote-0/+11
2023-08-04Improve spans for indexing expressionsNilstrieb-1/+1
Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location. This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.
2023-08-03Remove `MacDelimiter`.Nicholas Nethercote-3/+3
It's the same as `Delimiter`, minus the `Invisible` variant. I'm generally in favour of using types to make impossible states unrepresentable, but this one feels very low-value, and the conversions between the two types are annoying and confusing. Look at the change in `src/tools/rustfmt/src/expr.rs` for an example: the old code converted from `MacDelimiter` to `Delimiter` and back again, for no good reason. This suggests the author was confused about the types.
2023-07-28Parse generic const itemsLeón Orell Valerian Liehr-9/+26
2023-07-23more clippy::style fixes:Matthias Krüger-4/+4
get_first single_char_add_str unnecessary_mut_passed manual_map manual_is_ascii_check
2023-06-19Syntatically accept `become` expressionsMaybe Waffle-0/+5
2023-06-15Fix suggestion for E0404 not dealing with multiple generics许杰友 Jieyou Xu (Joe)-13/+26
2023-05-05Migrate offset_of from a macro to builtin # syntaxest31-2/+1
2023-05-05Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errorsDylan DPC-0/+4
Implement RFC 3348, `c"foo"` literals RFC: https://github.com/rust-lang/rfcs/pull/3348 Tracking issue: #105723
2023-05-02Implement negative boundsMichael Goulet-0/+7
2023-05-02fix TODO commentsDeadbeef-2/+4
2023-05-02initial step towards implementing C string literalsDeadbeef-0/+2
2023-05-01Rip it outNilstrieb-3/+9
My type ascription Oh rip it out Ah If you think we live too much then You can sacrifice diagnostics Don't mix your garbage Into my syntax So many weird hacks keep diagnostics alive Yet I don't even step outside So many bad diagnostics keep tyasc alive Yet tyasc doesn't even bother to survive!
2023-05-01Rollup merge of #111037 - Nilstrieb:close-the-offsetof, r=compiler-errorsMatthias Krüger-1/+1
Close parentheses for `offset_of` in AST pretty printing HIR pretty printing already handles it correctly. This will conflict with #110694 but it seems like that PR is gonna take bit more time.
2023-05-01Rollup merge of #110823 - compiler-errors:tweak-await-span, r=b-naberMatthias Krüger-1/+1
Tweak await span to not contain dot Fixes a discrepancy between method calls and await expressions where the latter are desugared to have a span that *contains* the dot (i.e. `.await`) but method call identifiers don't contain the dot. This leads to weird suggestions suggestions in borrowck -- see linked issue. Fixes #110761 This mostly touches a bunch of tests to tighten their `await` span.
2023-04-30Close parentheses for `offset_of` in AST pretty printingNilstrieb-1/+1
HIR pretty printing already handles it correctly.
2023-04-28remove unused `mut`sLukas Markeffsky-1/+1
2023-04-27Tweak await spanMichael Goulet-1/+1
2023-04-21minor tweaksDrMeepster-7/+6
2023-04-21offset_ofDrMeepster-0/+21
2023-04-10Remove `..` from return type notationMichael Goulet-4/+0
2023-04-09Remove identity castsNilstrieb-1/+1
2023-04-09Fix some clippy::complexityNilstrieb-1/+3
2023-04-04Rename `ast::Static` to `ast::StaticItem` to match `ast::ConstItem`Oli Scherer-2/+2
2023-04-04box a bunch of large typesOli Scherer-3/+3
2023-04-04Split out ast::ItemKind::Const into its own structOli Scherer-4/+11
2023-04-04rust-analyzer guided tuple field to named fieldOli Scherer-1/+1
2023-04-04rust-analyzer guided enum variant structificationOli Scherer-1/+2
2023-03-28Add `(..)` syntax for RTNMichael Goulet-0/+4
2023-03-19Remove the `NodeId` of `ast::ExprKind::Async`Arpad Borsos-1/+1
2023-03-12Remove `box_syntax` from AST and use in toolsclubby789-4/+0
2023-03-02Force parentheses around `match` expression in binary expressionbwmf2-0/+4
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-2/+5
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-21Use `ThinVec` in `ast::WhereClause`.Nicholas Nethercote-1/+1
2023-02-21Use `ThinVec` in `ast::Generics` and related types.Nicholas Nethercote-4/+4
2023-02-07Expand const-if-const trait bounds correctlyMichael Goulet-2/+12
2023-02-06remove unused importsklensy-1/+0
2023-02-02Rename `rust_2015` => `is_rust_2015`Maybe Waffle-1/+1
2023-01-31Use `Edition` methods a bit moreMaybe Waffle-1/+1