about summary refs log tree commit diff
path: root/compiler/rustc_hir_pretty/src
AgeCommit message (Collapse)AuthorLines
2023-08-06lower impl const to bind to host effect paramDeadbeef-5/+0
2023-08-04Improve spans for indexing expressionsNilstrieb-2/+2
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-07-28Lower generic const items to HIRLeón Orell Valerian Liehr-4/+8
2023-06-26`hir`: Add `Become` expression kindMaybe Waffle-0/+5
2023-06-02Separate AnonConst from ConstBlock in HIR.Camille GILLOT-3/+4
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-04-21minor tweaksDrMeepster-7/+6
2023-04-21offset_ofDrMeepster-0/+18
2023-04-09Remove identity castsNilstrieb-1/+1
2023-03-28Add `(..)` syntax for RTNMichael Goulet-48/+52
2023-03-14Remove box expressions from HIRclubby789-4/+0
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-2/+2
2023-02-25Add ErrorGuaranteed to HIR ExprKind::ErrMichael Goulet-1/+1
2023-02-25Add ErrorGuaranteed to HIR TyKind::ErrMichael Goulet-1/+1
2023-01-30Use `Mutability::{is_mut, is_not}`Maybe Waffle-4/+2
2023-01-12parse const closuresDeadbeef-4/+10
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-4/+4
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-12-28Rename `Rptr` to `Ref` in AST and HIRNilstrieb-1/+1
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already as well.
2022-12-15more clippy::complexity fixesMatthias Krüger-1/+0
2022-12-12Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkovbors-1/+1
Remove `token::Lit` from `ast::MetaItemLit`. Currently `ast::MetaItemLit` represents the literal kind twice. This PR removes that redundancy. Best reviewed one commit at a time. r? `@petrochenkov`
2022-12-06Remove outdated syntax from trait alias pretty printingMaybe Waffle-12/+1
2022-12-05Remove `LitKind::synthesize_token_lit`.Nicholas Nethercote-1/+1
It has a single call site in the HIR pretty printer, where the resulting token lit is immediately converted to a string. This commit replaces `LitKind::synthesize_token_lit` with a `Display` impl for `LitKind`, which can be used by the HIR pretty printer.
2022-12-03Rollup merge of #104199 - SarthakSingh31:issue-97417-1, r=cjgillotMatthias Krüger-0/+1
Keep track of the start of the argument block of a closure This removes a call to `tcx.sess.source_map()` from [compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs](https://github.com/rust-lang/rust/compare/master...SarthakSingh31:issue-97417-1?expand=1#diff-8406bbc0d0b43d84c91b1933305df896ecdba0d1f9269e6744f13d87a2ab268a) as required by #97417. VsCode automatically applied `rustfmt` to the files I edited under `src/tools`. I can undo that if its a problem. r? `@cjgillot`
2022-12-02Rename `LitKind::to_token_lit` as `LitKind::synthesize_token_lit`.Nicholas Nethercote-1/+1
This makes it clearer that it's not a lossless conversion, which I find helpful.
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-1/+1
2022-11-28Keep track of the start of the argument block of a closureSarthak Singh-0/+1
2022-11-27Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errorsbors-1/+1
Separate lifetime ident from lifetime resolution in HIR Drive-by: change how suggested generic args are computed. Fixes https://github.com/rust-lang/rust/issues/103815 I recommend reviewing commit-by-commit.
2022-11-23Add `Mutability::{is_mut,is_not}`Maybe Waffle-2/+2
2022-11-23Separate lifetime ident from resolution in HIR.Camille GILLOT-1/+1
2022-11-13Store a LocalDefId in hir::Variant & hir::Field.Camille GILLOT-1/+1
2022-11-13Store LocalDefId in hir::Closure.Camille GILLOT-0/+1
2022-10-15pretty: fix to print some lifetimes on HIR pretty-printYutaro Ohno-1/+5
2022-10-09ImplItemKind::TyAlias => ImplItemKind::TypeMichael Goulet-1/+1
2022-09-08Introduce `DotDotPos`.Nicholas Nethercote-2/+3
This shrinks `hir::Pat` from 88 to 72 bytes.
2022-09-06Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillotbors-15/+9
`BindingAnnotation` refactor * `ast::BindingMode` is deleted and replaced with `hir::BindingAnnotation` (which is moved to `ast`) * `BindingAnnotation` is changed from an enum to a tuple struct e.g. `BindingAnnotation(ByRef::No, Mutability::Mut)` * Associated constants added for convenience `BindingAnnotation::{NONE, REF, MUT, REF_MUT}` One goal is to make it more clear that `BindingAnnotation` merely represents syntax `ref mut` and not the actual binding mode. This was especially confusing since we had `ast::BindingMode`->`hir::BindingAnnotation`->`thir::BindingMode`. I wish there were more symmetry between `ByRef` and `Mutability` (variant) naming (maybe `Mutable::Yes`?), and I also don't love how long the name `BindingAnnotation` is, but this seems like the best compromise. Ideas welcome.
2022-09-05Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, ↵bors-7/+12
r=cjgillot Separate the receiver from arguments in HIR Related to #100232 cc `@cjgillot`
2022-09-05separate the receiver from arguments in HIRTakayuki Maeda-7/+12
2022-09-05Remove dead code from `print_generic_args`.Nicholas Nethercote-27/+7
2022-09-02Refactor and re-use BindingAnnotationCameron Steffen-15/+9
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-16Rename some things related to literals.Nicholas Nethercote-1/+1
- Rename `ast::Lit::token` as `ast::Lit::token_lit`, because its type is `token::Lit`, which is not a token. (This has been confusing me for a long time.) reasonable because we have an `ast::token::Lit` inside an `ast::Lit`. - Rename `LitKind::{from,to}_lit_token` as `LitKind::{from,to}_token_lit`, to match the above change and `token::Lit`.
2022-08-15Auto merge of #96745 - ehuss:even-more-attribute-validation, r=cjgillotbors-28/+32
Visit attributes in more places. This adds 3 loosely related changes (I can split PRs if desired): - Attribute checking on pattern struct fields. - Attribute checking on struct expression fields. - Lint level visiting on pattern struct fields, struct expression fields, and generic parameters. There are still some lints which ignore lint levels in various positions. This is a consequence of how the lints themselves are implemented. For example, lint levels on associated consts don't work with `unused_braces`.
2022-08-11Check attributes on struct expression fields.Eric Huss-14/+16
Attributes on struct expression fields were not being checked for validity. This adds the fields as HIR nodes so that `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-11Check attributes on pattern fields.Eric Huss-14/+16
Attributes on pattern struct fields were not being checked for validity. This adds the fields as HIR nodes so that the `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-12Fix HIR pretty printing of let elseMichael Goulet-0/+4
2022-07-17use rustc_hir_pretty::qpath_to_string to avoid span_to_snippet when ↵Michael Goulet-0/+4
rendering path
2022-07-14Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillotDylan DPC-3/+41
Implement `for<>` lifetime binder for closures This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following: ```rust let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) }; // ^^^^^^^^^^^--- new! ``` cc ``@Aaron1011`` ``@cjgillot``
2022-07-12Add an indirection for closures in `hir::ExprKind`Maybe Waffle-3/+3
This helps bring `hir::Expr` size down, `Closure` was the biggest variant, especially after `for<>` additions.
2022-07-12Lower closure binders to hir & properly check themMaybe Waffle-1/+39
2022-07-11move else block into the `Local` structDing Xiang Fei-3/+3