Commit Graph

5554 Commits

Author SHA1 Message Date
Guillaume Gomez
5cbb08db00 Rollup merge of #109354 - Swatinem:rm-closureid, r=compiler-errors
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-27 18:56:19 +02:00
Oli Scherer
9510f7eb2c Merge from rustc 2023-03-23 07:33:19 +00:00
Vadim Petrochenkov
809dd77b80 rustc: Remove unused Session argument from some attribute functions 2023-03-22 13:55:55 +04:00
Arpad Borsos
3ef194c14c Remove the NodeId of ast::ExprKind::Async 2023-03-19 19:01:31 +01:00
clubby789
4e658cc01e Remove box_syntax from AST and use in tools 2023-03-12 13:19:46 +00:00
clubby789
a5ba6e025f Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
David Wood
386ea3770f various: translation resources from cg backend
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-22 09:15:54 +00:00
David Wood
8b7f8116d6 errors: generate typed identifiers in each crate
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-22 09:15:53 +00:00
Nicholas Nethercote
01ed9ddf0e Use ThinVec in a few more AST types. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote
23007fc9e4 Use ThinVec in ast::Block. 2023-02-21 11:51:56 +11:00
Nicholas Nethercote
af75a2f7f1 Use ThinVec in various AST types.
This commit changes the sequence parsers to produce `ThinVec`, which
triggers numerous conversions.
2023-02-21 11:51:56 +11:00
Caleb Cartwright
34f9ca28f2 fix: use correct span for struct generics 2023-02-16 00:03:36 -05:00
Esteban Küber
24f4ecec25 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-09 14:52:54 +00:00
Nicholas Nethercote
c6b822d855 Rename Cursor/CursorRef as TokenTreeCursor/RefTokenTreeCursor.
This makes it clear they return token trees, and makes for a nice
comparison against `TokenCursor` which returns tokens.
2023-02-03 10:06:52 +11:00
Rajiv Sharma
5391847ea5 Fix #5488 - prevent shorthand init for tuple struct
Closes #5488

Fix for #5488. Before applying shorthand initialization for structs,
check if identifier is a literal (e.g. tuple struct). If yes, then do
not apply short hand initialization.

Added test case to validate the changes for the fix.
2023-02-01 21:33:19 -06:00
Thaqib
e2996a807b
Lists doc comments fix4041 (#5560)
* add + start of an itemized line

* add test

* fix format

* fix tests

* update doc comment
2023-02-01 21:26:12 -06:00
Wim Looman
3f36c997bf Test that with all comment wrapping disabled table comments are not wrapped 2023-01-29 16:47:06 -06:00
Wim Looman
cdd0b56071 Test that both table headers and values are not wrapped 2023-01-29 16:47:06 -06:00
Wim Looman
368a63305c Fix typo 2023-01-29 16:47:06 -06:00
Ayaz Hafiz
846662cdb3 Don't wrap comments that are part of a table
Closes #4210
2023-01-29 16:47:06 -06:00
Yuki Okushi
fb1a223eba
Remove use of actions-rs (#5571)
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-29 16:45:26 -06:00
Yuki Okushi
9cc0af5407
Remove old CI config (#5572)
* Remove old CI config

Signed-off-by: Yuki Okushi <jtitor@2k36.org>

* Replace outdated badges

Signed-off-by: Yuki Okushi <jtitor@2k36.org>

---------

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-01-29 16:44:58 -06:00
Tom French
61d82acf53
refactor: fix typo in comment (#5581) 2023-01-29 16:43:40 -06:00
David Bar-On
b08130c590
Fix #5234 - handling of empty code block (#5601) 2023-01-29 12:55:14 -06:00
amab8901
bcfc57ec8a
added tests (#5619) 2023-01-28 15:18:52 -06:00
Arthur Carcano
567bd97723
Document which comments are excluded from wrapping (#5637)
* Document which comments are excluded from wrapping

Cf: https://github.com/rust-lang/rustfmt/issues/5634

* Add examples in wrap_commments doc

* fix failling tests
2023-01-28 15:16:46 -06:00
bors
6d133152f8 Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk
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-26 12:44:47 +00:00
Matthias Krüger
1d9afb285f Rollup merge of #106960 - estebank:parse-anon-enums, r=cjgillot
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-26 06:15:24 +01:00
Caleb Cartwright
094b7f599c Merge commit '1d8491b120223272b13451fc81265aa64f7f4d5b' into sync-from-rustfmt 2023-01-24 14:16:03 -06:00
Caleb Cartwright
1d8491b120 chore: prep v1.5.2 release 2023-01-24 14:04:12 -06:00
Caleb Cartwright
5139b14620 fix: version gate changes for multiline single generic bound 2023-01-24 11:38:44 -06:00
Caleb Cartwright
6eeb4fd230
Merge pull request #5670 from calebcartwright/subtree-sync-2023-01-24
Subtree sync 2023-01-24
2023-01-23 22:13:01 -06:00
Caleb Cartwright
18dd0757db chore: bump toolchain 2023-01-23 21:44:03 -06:00
Caleb Cartwright
e7d87ad61d Merge remote-tracking branch 'upstream/master' into subtree-sync-2023-01-24 2023-01-23 21:19:31 -06:00
Esteban Küber
4e3ed18e1d review comment: Remove AST AnonTy 2023-01-23 18:21:08 +00:00
Caleb Cartwright
aae222c974 fix: correct span for structs with const generics 2023-01-23 12:55:02 -05:00
Esteban Küber
2791cc37e6 Teach parser to understand fake anonymous enum syntax
Parse `-> Ty | OtherTy`.
Parse type ascription in top level patterns.
2023-01-17 01:58:32 +00:00
Deadbeef
19c2286d5c parse const closures 2023-01-12 02:28:37 +00:00
Mara Bos
80d196d789 Update rustfmt for ast::ExprKind::FormatArgs.
Rustfmt doesn't expand macros, so that's easy: FormatArgs nodes do not
occur in the unexpanded AST.
2023-01-12 00:25:46 +01:00
Albert Larsan
8c8aa3873f Change src/test to tests in source files, fix tidy and tests 2023-01-11 09:32:13 +00:00
Esteban Küber
664c60a18e Detect closures assigned to binding in block
Fix #58497.
2023-01-05 21:29:36 +00:00
bjorn3
d7fa2ee3e6 Add missing extern crate rustc_driver 2022-12-31 17:20:13 +00:00
Nilstrieb
ac8eaa1ba7 Rename Rptr to Ref in AST and HIR
The name makes a lot more sense, and `ty::TyKind` calls it `Ref` already
as well.
2022-12-28 18:52:36 +01:00
bors
53ca2598d3 Auto merge of #105160 - nnethercote:rm-Lit-token_lit, r=petrochenkov
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-12 05:16:50 +00:00
Matthias Krüger
2119f7d7d1 Rollup merge of #104199 - SarthakSingh31:issue-97417-1, r=cjgillot
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-03 17:37:41 +01:00
Nicholas Nethercote
c91dd22870 Remove token::Lit from ast::MetaItemLit.
`token::Lit` contains a `kind` field that indicates what kind of literal
it is. `ast::MetaItemLit` currently wraps a `token::Lit` but also has
its own `kind` field. This means that `ast::MetaItemLit` encodes the
literal kind in two different ways.

This commit changes `ast::MetaItemLit` so it no longer wraps
`token::Lit`. It now contains the `symbol` and `suffix` fields from
`token::Lit`, but not the `kind` field, eliminating the redundancy.
2022-12-02 13:49:19 +11:00
Vadim Petrochenkov
46f0b38eb5 rustc_ast_lowering: Stop lowering imports into multiple items
Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-01 18:51:20 +03:00
Sarthak Singh
749c816fae Keep track of the start of the argument block of a closure 2022-11-28 14:09:00 +05:30
Nicholas Nethercote
c7e4abd444 Rename NestedMetaItem::[Ll]iteral as NestedMetaItem::[Ll]it.
We already use a mix of `Literal` and `Lit`. The latter is better
because it is shorter without causing any ambiguity.
2022-11-28 15:18:53 +11:00
Nicholas Nethercote
cdff11ce94 Rename ast::Lit as ast::MetaItemLit. 2022-11-28 15:18:49 +11:00