about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering
AgeCommit message (Collapse)AuthorLines
2023-04-24Remove "V1" from ArgumentsV1 and FlagsV1.Mara Bos-9/+9
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-3/+3
2023-04-22Also arena-allocate `ast::MacroDef` to make `Item: Copy`Nilstrieb-1/+2
2023-04-21offset_ofDrMeepster-0/+9
2023-04-20Update comments in format args lowering.Mara Bos-7/+7
These lang items have been moved/renamed.
2023-04-19Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwcobors-1/+2
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros` Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-19Rollup merge of #110451 - WaffleLapkin:ensure_return_elem, r=scottmcmMatthias Krüger-13/+12
Minor changes to `IndexVec::ensure_contains_elem` & related methods r? `@scottmcm`
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+2
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-17Use `Item::expect_*` and `ImplItem::expect_*` moreMaybe Waffle-6/+4
2023-04-17Make `IndexVec::ensure_contains_elem` return a reference to the elementMaybe Waffle-13/+12
2023-04-17Auto merge of #109588 - Nilstrieb:dropless-expr, r=compiler-errorsbors-30/+25
Alloc `hir::Lit` in an arena to remove the destructor from `Expr` This allows allocating `Expr`s into a dropless arena, which is useful for using length prefixed thing slices in HIR, since these can only be allocated in the dropless arena and not in a typed arena.
2023-04-16Alloc `hir::Lit` in an arena to remove the destructor from `Expr`Nilstrieb-30/+25
This allows allocating `Expr`s into a dropless arena, which is useful for using length prefixed thing slices in HIR, since these can only be allocated in the dropless arena and not in a typed arena. This is something I'm working on.
2023-04-16use matches! macro in more placesMatthias Krüger-4/+1
2023-04-12Rollup merge of #110203 - compiler-errors:rtn-dots, r=eholkMatthias Krüger-31/+17
Remove `..` from return type notation `@nikomatsakis` and I decided that using `..` in the return-type notation syntax is probably overkill. r? `@eholk` since you reviewed the last one Since this is piggybacking now totally off of a pre-existing syntax (parenthesized generics), let me know if you need any explanation of the logic here, since it's a bit more complicated now.
2023-04-10Remove `..` from return type notationMichael Goulet-31/+17
2023-04-10Fix typos in compilerDaniPopes-4/+4
2023-04-04Rename `ast::Static` to `ast::StaticItem` to match `ast::ConstItem`Oli Scherer-1/+1
2023-04-04box a bunch of large typesOli Scherer-4/+4
2023-04-04Split out ast::ItemKind::Const into its own structOli Scherer-5/+5
2023-04-04rust-analyzer guided tuple field to named fieldOli Scherer-1/+1
2023-04-04rust-analyzer guided enum variant structificationOli Scherer-1/+1
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-4/+4
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-03-31Auto merge of #109010 - compiler-errors:rtn, r=eholkbors-21/+119
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-29Rollup merge of #109664 - m-ou-se:format-args-placeholder-span, r=oli-obkDylan DPC-23/+43
Use span of placeholders in format_args!() expansion. `format_args!("{}", x)` expands to something that contains `Argument::new_display(&x)`. That entire expression was generated with the span of `x`. After this PR, `&x` uses the span of `x`, but the `new_display` call uses the span of the `{}` placeholder within the format string. If an implicitly captured argument was used like in `format_args!("{x}")`, both use the span of the `{x}` placeholder. This fixes https://github.com/rust-lang/rust/issues/109576, and also allows for more improvements to similar diagnostics in the future, since the usage of `x` can now be traced to the exact `{}` placeholder that required it to be `Display` (or `Debug` etc.)
2023-03-28Add `(..)` syntax for RTNMichael Goulet-36/+91
2023-03-28Add tests and error messagesMichael Goulet-5/+36
2023-03-28RTNMichael Goulet-0/+12
2023-03-28ParenthesizedGenericArgs::{Ok -> ParenSugar}Michael Goulet-5/+5
2023-03-27Rollup merge of #109354 - Swatinem:rm-closureid, r=compiler-errorsGuillaume Gomez-42/+42
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-27Use span of placeholders in format_args!() expansion.Mara Bos-23/+43
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-1/+1
2023-03-19Remove the `NodeId` of `ast::ExprKind::Async`Arpad Borsos-42/+42
2023-03-16Gate fmt args flattening behind -Zflatten-format-args.Mara Bos-2/+5
2023-03-16Don't allow new const panic through format flattening.Mara Bos-1/+17
panic!("a {}", "b") is still not allowed in const, even if the hir flattens to panic!("a b").
2023-03-16Also inline integer literals into format_args!().Mara Bos-5/+18
2023-03-16Check all arg indexes before removing inlined format args.Mara Bos-13/+15
2023-03-16Remove unreachable branch in format_args ast lowering.Mara Bos-19/+8
2023-03-16Fix argument index remapping in format_args flattening.Mara Bos-28/+36
2023-03-16Only inline `{}` string literals in format_args.Mara Bos-0/+1
Placeholders like {:123} would incorrectly get inlined.
2023-03-16Support flattening/inlining format_args through & and ().Mara Bos-6/+12
E.g. format_args!("{}", &(format_args!("abc"))).
2023-03-16Inline string literals into format_args!().Mara Bos-3/+61
2023-03-16Coalesce adjacent literal pieces in expand_format_args.Mara Bos-16/+16
2023-03-16Flatten nested format_args!() into one.Mara Bos-2/+100
2023-03-14Auto merge of #104833 - Swatinem:async-identity-future, r=compiler-errorsbors-38/+28
Remove `identity_future` indirection This was previously needed because the indirection used to hide some unexplained lifetime errors, which it turned out were related to the `min_choice` algorithm. Removing the indirection also solves a couple of cycle errors, large moves and makes async blocks support the `#[track_caller]`annotation. Fixes https://github.com/rust-lang/rust/issues/104826.
2023-03-13Auto merge of #108471 - clubby789:unbox-the-syntax, r=Nilstrieb,est31bors-1/+0
Remove `box_syntax` r? `@Nilstrieb` This removes the feature `box_syntax`, which allows the use of `box <expr>` to create a Box, and finalises removing use of the feature from the compiler. `box_patterns` (allowing the use of `box <pat>` in a pattern) is unaffected. It also removes `ast::ExprKind::Box` - the only way to create a 'box' expression now is with the rustc-internal `#[rustc_box]` attribute. As a temporary measure to help users move away, `box <expr>` now parses the inner expression, and emits a `MachineApplicable` lint to replace it with `Box::new` Closes #49733
2023-03-12Auto merge of #108820 - cjgillot:ensure-on-disk, r=oli-obkbors-2/+3
Ensure value is on the on-disk cache before returning from `ensure()`. The current logic for `ensure()` a query just checks that the node is green in the dependency graph. However, a lot of places use `ensure()` to prevent the query from being called later. This is the case before stealing a query result. If the query is actually green but the value is not available in the on-disk cache, `ensure` would return, but a subsequent call to the full query would run the code, and attempt to read from a stolen value. This PR conforms the query system to the usage by checking whether the queried value is loadable from disk before returning. Sadly, I can't manage to craft a proper test... Should fix all instances of "attempted to read from stolen value".
2023-03-12Remove `box_syntax` from AST and use in toolsclubby789-1/+0
2023-03-12Auto merge of #108794 - nnethercote:avoid-unnecessary-hashing, r=cjgillotbors-31/+24
Avoid unnecessary hashing I noticed some stable hashing being done in a non-incremental build. It turns out that some of this is necessary to compute the crate hash, but some of it is not. Removing the unnecessary hashing is a perf win. r? `@cjgillot`
2023-03-11Use ensure_with_value in a few more places.Camille GILLOT-2/+3
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done