about summary refs log tree commit diff
path: root/compiler/rustc_ast
AgeCommit message (Collapse)AuthorLines
2023-03-31Auto merge of #109010 - compiler-errors:rtn, r=eholkbors-6/+12
Initial support for return type notation (RTN) See: https://smallcultfollowing.com/babysteps/blog/2023/02/13/return-type-notation-send-bounds-part-2/ 1. Only supports `T: Trait<method(): Send>` style bounds, not `<T as Trait>::method(): Send`. Checking validity and injecting an implicit binder for all of the late-bound method generics is harder to do for the latter. * I'd add this in a follow-up. 3. ~Doesn't support RTN in general type position, i.e. no `let x: <T as Trait>::method() = ...`~ * I don't think we actually want this. 5. Doesn't add syntax for "eliding" the function args -- i.e. for now, we write `method(): Send` instead of `method(..): Send`. * May be a hazard if we try to add it in the future. I'll probably add it in a follow-up later, with a structured suggestion to change `method()` to `method(..)` once we add it. 7. ~I'm not in love with the feature gate name 😺~ * I renamed it to `return_type_notation` :heavy_check_mark: Follow-up PRs will probably add support for `where T::method(): Send` bounds. I'm not sure if we ever want to support return-type-notation in arbitrary type positions. I may also make the bounds require `..` in the args list later. r? `@ghost`
2023-03-28Fix mismatched punctuation in Debug impl of AttrIdDavid Tolnay-1/+1
2023-03-28Add `(..)` syntax for RTNMichael Goulet-10/+12
2023-03-28Feature gateMichael Goulet-0/+4
2023-03-27Rollup merge of #109354 - Swatinem:rm-closureid, r=compiler-errorsGuillaume Gomez-10/+5
Remove the `NodeId` of `ast::ExprKind::Async` This is a followup to https://github.com/rust-lang/rust/pull/104833#pullrequestreview-1314537416. In my original attempt, I was using `LoweringContext::expr`, which was not correct as it creates a fresh `DefId`. It now uses the correct `DefId` for the wrapping `Expr`, and also makes forwarding `#[track_caller]` attributes more explicit.
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-0/+22
2023-03-19Remove the `NodeId` of `ast::ExprKind::Async`Arpad Borsos-10/+5
2023-03-17Rollup merge of #108958 - clubby789:unbox-the-hir, r=compiler-errorsMatthias Krüger-3/+1
Remove box expressions from HIR After #108516, `#[rustc_box]` is used at HIR->THIR lowering and this is no longer emitted, so it can be removed. This is based on top of #108471 to help with conflicts, so 43490488ccacd1a822e9c621f5ed6fca99959a0b is the only relevant commit (sorry for all the duplicated pings!) ````@rustbot```` label +S-blocked
2023-03-16Support flattening/inlining format_args through & and ().Mara Bos-0/+9
E.g. format_args!("{}", &(format_args!("abc"))).
2023-03-16Flatten nested format_args!() into one.Mara Bos-2/+2
2023-03-14Remove box expressions from HIRclubby789-3/+1
2023-03-12Remove `box_syntax` from AST and use in toolsclubby789-8/+1
2023-03-08Rename `MapInPlace` as `FlatMapInPlace`.Nicholas Nethercote-1/+1
After removing the `map_in_place` method, which isn't much use because modifying every element in a collection such as a `Vec` can be done trivially with iteration.
2023-03-03Match unmatched backticks in comments in compiler/est31-1/+1
2023-02-21Use `ThinVec` in a few more AST types.Nicholas Nethercote-6/+6
2023-02-21Use `ThinVec` in `ast::ExprKind::Match`.Nicholas Nethercote-1/+1
2023-02-21Use `ThinVec` in `ast::PatKind::Struct`.Nicholas Nethercote-3/+3
2023-02-21Use `ThinVec` in `ast::AngleBracketedArgs`.Nicholas Nethercote-2/+2
2023-02-21Use `ThinVec` in `ast::Block`.Nicholas Nethercote-2/+2
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-33/+38
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-21Use `ThinVec` in `ast::Impl` and related types.Nicholas Nethercote-4/+4
2023-02-21Use `ThinVec` in `ast::WhereClause`.Nicholas Nethercote-9/+20
2023-02-21Use `ThinVec` in `ast::Generics` and related types.Nicholas Nethercote-17/+15
2023-02-21Upgrade `thin-vec` from 0.2.9 to 0.2.12.Nicholas Nethercote-1/+1
Because 0.2.10 added supports for `ThinVec::splice`, and 0.2.12 is the latest release.
2023-02-11rustc_ast: Merge impls and reorder methods for attributes and meta itemsVadim Petrochenkov-311/+307
2023-02-03Rollup merge of #107544 - nnethercote:improve-TokenCursor, r=petrochenkovDylan DPC-15/+27
Improve `TokenCursor`. Some small improvements, for things that were bugging me. Best reviewed one commit at a time. r? ``@petrochenkov``
2023-02-03Auto merge of #107569 - petrochenkov:optattr, r=nnethercotebors-23/+50
ast: Optimize list and value extraction primitives for attributes It's not necessary to convert the whole attribute into a meta item to extract something specific.
2023-02-03Rename `Cursor`/`CursorRef` as `TokenTreeCursor`/`RefTokenTreeCursor`.Nicholas Nethercote-14/+16
This makes it clear they return token trees, and makes for a nice comparison against `TokenCursor` which returns tokens.
2023-02-03Make clear that `TokenTree::Token` shouldn't contain a delimiter.Nicholas Nethercote-1/+2
2023-02-03Improve doc comment desugaring.Nicholas Nethercote-0/+9
Sometimes the parser needs to desugar a doc comment into `#[doc = r"foo"]`. Currently it does this in a hacky way: by pushing a "fake" new frame (one without a delimiter) onto the `TokenCursor` stack. This commit changes things so that the token stream itself is modified in place. The nice thing about this is that it means `TokenCursorFrame::delim_sp` is now only `None` for the outermost frame.
2023-02-02Revert "Teach parser to understand fake anonymous enum syntax" and related ↵Michael Goulet-2/+2
commits Revert "review comment: Remove AST AnonTy" This reverts commit 020cca8d36cb678e3ddc2ead41364be314d19e93. Revert "Ensure macros are not affected" This reverts commit 12d18e403139eeeeb339e8611b2bed4910864edb. Revert "Emit fewer errors on patterns with possible type ascription" This reverts commit c847a01a3b1f620c4fdb98c75805033e768975d1. Revert "Teach parser to understand fake anonymous enum syntax" This reverts commit 2d824206655bfb26cb5eed43490ee396542b153e.
2023-02-01ast: Optimize list and value extraction primitives for attributesVadim Petrochenkov-23/+50
It's not necessary to convert the whole attribute into a meta item to extract something specific
2023-01-30Replace enum `==`s with `match`es where it makes senseMaybe Waffle-16/+17
2023-01-28Rollup merge of #107194 - ↵Yuki Okushi-2/+2
xfix:remove-slice-internals-dependency-in-rustc-ast, r=Nilstrieb Remove dependency on slice_internals feature in rustc_ast This reduces dependency on unstable features by the compiler.
2023-01-27Replace format flags u32 by enums and bools.Mara Bos-2/+24
2023-01-26Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obkbors-1/+287
Move format_args!() into AST (and expand it during AST lowering) Implements https://github.com/rust-lang/compiler-team/issues/541 This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier. This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`. This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.
2023-01-26Rollup merge of #106960 - estebank:parse-anon-enums, r=cjgillotMatthias Krüger-2/+2
Teach parser to understand fake anonymous enum syntax Parse `Ty | OtherTy` in function argument and return types. Parse type ascription in top level patterns. Minimally address #100741.
2023-01-24Work around issue 106930.Mara Bos-0/+6
2023-01-23review comment: Remove AST AnonTyEsteban Küber-5/+2
2023-01-22Remove dependency on slice_internals feature in rustc_astKonrad Borowski-2/+2
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-1/+1
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-1/+1
2023-01-17Teach parser to understand fake anonymous enum syntaxEsteban Küber-3/+6
Parse `-> Ty | OtherTy`. Parse type ascription in top level patterns.
2023-01-15make error emitted on `impl &Trait` nicerEzra Shaw-1/+2
2023-01-12parse const closuresDeadbeef-0/+4
2023-01-12Expand format_args!() in rust_ast_lowering.Mara Bos-1/+281
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-20/+19
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).
2023-01-04Rollup merge of #106361 - clubby789:int-literal-too-large, r=estebankMatthias Krüger-2/+2
Note maximum integer literal for `IntLiteralTooLarge` Closes #105908 `@rustbot` label +A-diagnostics
2023-01-02Rollup merge of #106383 - Manishearth:ast-docs, r=compiler-errorsMichael Goulet-0/+15
Document some of the AST nodes Someone was confused about some of this on Zulip, added some docs We probably should make sure every last field/variant in the AST/HIR is documented at some point `@bors` rollup
2023-01-02Document rustc_ast::FnHeader fieldsManish Goregaokar-0/+4