about summary refs log tree commit diff
path: root/compiler/rustc_expand/src
AgeCommit message (Collapse)AuthorLines
2023-03-31Auto merge of #109824 - GuillaumeGomez:rollup-i5r4uts, r=GuillaumeGomezbors-3/+7
Rollup of 7 pull requests Successful merges: - #109104 (rustdoc: Fix invalid suggestions on ambiguous intra doc links v2) - #109443 (Move `doc(primitive)` future incompat warning to `invalid_doc_attributes`) - #109680 (Fix subslice capture in closure) - #109798 (fluent_messages macro: don't emit the OS error in a note) - #109805 (Source map cleanups) - #109818 (rustdoc: Add GUI test for jump to collapsed item) - #109820 (rustdoc-search: update docs for comma in `?` help popover) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-31Remove an unnecessary use of `with_session_globals`.Nicholas Nethercote-3/+7
We can easily pass in the source map.
2023-03-28Add `(..)` syntax for RTNMichael Goulet-1/+1
2023-03-23Separate find_*_stability.Camille GILLOT-1/+3
2023-03-23rustc_interface: Add a new query `pre_configure`Vadim Petrochenkov-30/+22
It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes are then expanded normally during the main expansion pass, like attributes on any other nodes.
2023-03-23expand: Pass `ast::Crate` by reference to AST transforming passesVadim Petrochenkov-42/+35
Also some more attributes are passed by reference.
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-6/+4
2023-03-17Suggest surrounding the macro with `{}` to interpret as a statementMu42-6/+18
2023-03-15unequal → not equalgimbles-1/+1
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
2023-03-11Auto merge of #109019 - matthiaskrgr:rollup-ihjntil, r=matthiaskrgrbors-4/+4
Rollup of 9 pull requests Successful merges: - #104363 (Make `unused_allocation` lint against `Box::new` too) - #106633 (Stabilize `nonzero_min_max`) - #106844 (allow negative numeric literals in `concat!`) - #108071 (Implement goal caching with the new solver) - #108542 (Force parentheses around `match` expression in binary expression) - #108690 (Place size limits on query keys and values) - #108708 (Prevent overflow through Arc::downgrade) - #108739 (Prevent the `start_bx` basic block in codegen from having two `Builder`s at the same time) - #108806 (Querify register_tools and post-expansion early lints) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-11Rollup merge of #108806 - cjgillot:query-lints, r=davidtwcoMatthias Krüger-4/+4
Querify register_tools and post-expansion early lints The 2 extra queries correspond to code that happen before and after macro expansion, and don't need the resolver to exist.
2023-03-10Add note when matching token with nonterminalNilstrieb-3/+9
The current error message is _really_ confusing.
2023-03-08Rename `MapInPlace` as `FlatMapInPlace`.Nicholas Nethercote-2/+2
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-06Querify registered_tools.Camille GILLOT-4/+4
2023-03-04rustc_expand: make proc-macro derive error translatableTshepang Mbambo-1/+8
2023-03-03Match end user facing unmatched backticks in compiler/est31-1/+1
2023-03-01Rollup merge of #108297 - chenyukang:yukang/delim-error-exit, r=petrochenkovMatthias Krüger-1/+0
Exit when there are unmatched delims to avoid noisy diagnostics From https://github.com/rust-lang/rust/pull/104012#issuecomment-1311764832 r? ``@petrochenkov``
2023-02-28no need to return unmatched_delims from tokentreesyukang-1/+0
2023-02-24make "proc macro panicked" translatableTshepang Mbambo-5/+22
2023-02-22various: translation resources from cg backendDavid Wood-10/+16
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-12/+22
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-21Auto merge of #104754 - nnethercote:more-ThinVec-in-ast, r=the8472bors-32/+44
Use `ThinVec` more in the AST r? `@ghost`
2023-02-21Auto merge of #105462 - oli-obk:feeding_full, r=cjgillot,petrochenkovbors-4/+2
give the resolver access to TyCtxt The resolver is now created after TyCtxt is created. Then macro expansion and name resolution are run and the results fed into queries just like before this PR. Since the resolver had (before this PR) mutable access to the `CStore` and the source span table, these two datastructures are now behind a `RwLock`. To ensure that these are not mutated anymore after the resolver is done, a read lock to them is leaked right after the resolver finishes. ### PRs split out of this one and leading up to it: * https://github.com/rust-lang/rust/pull/105423 * https://github.com/rust-lang/rust/pull/105357 * https://github.com/rust-lang/rust/pull/105603 * https://github.com/rust-lang/rust/pull/106776 * https://github.com/rust-lang/rust/pull/106810 * https://github.com/rust-lang/rust/pull/106812 * https://github.com/rust-lang/rust/pull/108032
2023-02-21Use `ThinVec` in a few more AST types.Nicholas Nethercote-5/+6
2023-02-21Use `ThinVec` in `ast::ExprKind::Match`.Nicholas Nethercote-2/+2
2023-02-21Use `ThinVec` in `ast::PatKind::Struct`.Nicholas Nethercote-1/+1
2023-02-21Use `ThinVec` in `ast::Block`.Nicholas Nethercote-3/+8
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-20/+26
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-21Use `ThinVec` in `ast::Generics` and related types.Nicholas Nethercote-1/+1
2023-02-20Remove a redundant function argumentOli Scherer-4/+2
2023-02-20create dummy placeholder crate to prevent compilerPatrik Kårlin-0/+5
2023-02-16Replace some `then`s with some `then_some`sMaybe Waffle-1/+1
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-6/+4
2023-02-13Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisaMatthias Krüger-1/+2
Introduce `-Zterminal-urls` to use OSC8 for error codes Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-09Introduce `-Zterminal-urls` to use OSC8 for error codesEsteban Küber-1/+2
Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-07Add ~const bounds trait bounds when using derive_constMichael Goulet-2/+6
2023-02-05rustc_expand: remove huge error importsest31-23/+25
2023-02-03Rename `Cursor`/`CursorRef` as `TokenTreeCursor`/`RefTokenTreeCursor`.Nicholas Nethercote-6/+6
This makes it clear they return token trees, and makes for a nice comparison against `TokenCursor` which returns tokens.
2023-02-02Rollup merge of #107488 - nnethercote:fix-PartialEq-syntax, r=RalfJungMatthias Krüger-0/+4
Fix syntax in `-Zunpretty-expanded` output for derived `PartialEq`. If you do `derive(PartialEq)` on a packed struct, the output shown by `-Zunpretty=expanded` includes expressions like this: ``` { self.x } == { other.x } ``` This is invalid syntax. This doesn't break compilation, because the AST nodes are constructed within the compiler. But it does mean anyone using `-Zunpretty=expanded` output as a guide for hand-written impls could get a nasty surprise. This commit fixes things by instead using this form: ``` ({ self.x }) == ({ other.x }) ``` r? ``@RalfJung``
2023-02-01Fix syntax in `-Zunpretty-expanded` output for derived `PartialEq`.Nicholas Nethercote-0/+4
If you do `derive(PartialEq)` on a packed struct, the output shown by `-Zunpretty=expanded` includes expressions like this: ``` { self.x } == { other.x } ``` This is invalid syntax. This doesn't break compilation, because the AST nodes are constructed within the compiler. But it does mean anyone using `-Zunpretty=expanded` output as a guide for hand-written impls could get a nasty surprise. This commit fixes things by instead using this form: ``` ({ self.x }) == ({ other.x }) ```
2023-01-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-1/+1
Improve enum checks Some light refactoring.
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-3/+10
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30Replace some `_ == _ || _ == _`s with `matches!(_, _ | _)`sMaybe Waffle-1/+1
2023-01-20preserve delim spans during `macro_rules!` expansion if ableLukas Markeffsky-6/+18
2023-01-20Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstriebbors-82/+75
Remove some `ref` patterns from the compiler Previous PR: https://github.com/rust-lang/rust/pull/105368 r? `@Nilstrieb`
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-3/+3
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-3/+3
2023-01-17`rustc_expand`: remove `ref` patternsMaybe Waffle-82/+75
2023-01-13Update `rental` hack to work with remapped paths.Tim Neumann-4/+6