Commit Graph

5098 Commits

Author SHA1 Message Date
bors
1f369f8b6a Auto merge of #114115 - nnethercote:less-token-tree-cloning, r=petrochenkov
Less `TokenTree` cloning

`TokenTreeCursor` has this comment on it:
```
// FIXME: Many uses of this can be replaced with by-reference iterator to avoid clones.
```
This PR completes that FIXME. It doesn't have much perf effect, but at least we now know that.

r? `@petrochenkov`
2023-07-28 01:21:27 +00:00
Nicholas Nethercote
e60a9e2c97 Avoid into_trees usage in rustfmt.
Token tree cloning is only needed in one place.
2023-07-27 11:58:42 +10:00
Trevor Gross
08fd1644d2 Unite bless environment variables under RUSTC_BLESS
Currently, Clippy, Miri, Rustfmt, and rustc all use an environment variable to
indicate that output should be blessed, but they use different variable names.
In order to improve consistency, this patch applies the following changes:

- Emit `RUSTC_BLESS` within `prepare_cargo_test` so it is always
  available
- Change usage of `MIRI_BLESS` in the Miri subtree to use `RUSTC_BLESS`
- Change usage of `BLESS` in the Clippy subtree to `RUSTC_BLESS`
- Change usage of `BLESS` in the Rustfmt subtree to `RUSTC_BLESS`
- Adjust the blessable test in `rustc_errors` to use this same
  convention
- Update documentation where applicable

Any tools that uses `RUSTC_BLESS` should check that it is set to any value
other than `"0"`.
2023-07-26 16:54:02 -04:00
Oli Scherer
c0ee8f5fea Make x test src/tools/rustfmt --bless format rustfmt with the freshly built in-tree version 2023-07-26 08:22:52 +00:00
Oli Scherer
a3dfd82559 Use a builder instead of boolean/option arguments 2023-07-25 13:51:15 +00:00
Esteban Küber
6013a8014b On nightly, dump ICE backtraces to disk
Implement rust-lang/compiler-team#578.

When an ICE is encountered on nightly releases, the new rustc panic
handler will also write the contents of the backtrace to disk. If any
`delay_span_bug`s are encountered, their backtrace is also added to the
file. The platform and rustc version will also be collected.
2023-07-19 14:10:07 +00:00
Caleb Cartwright
78331eefaf Merge commit 'dca1cf90ad6b8e45afbed2061803befbb2d159e9' into sync-rustfmt 2023-07-01 02:49:12 -05:00
Nilstrieb
80bf3ea542 Rollup merge of #112790 - WaffleLapkin:syntactically, r=Nilstrieb
Syntactically accept `become` expressions (explicit tail calls experiment)

This adds `ast::ExprKind::Become`, implements parsing and properly gates the feature.

cc `@scottmcm`
2023-06-21 07:37:02 +02:00
Caleb Cartwright
ed3e96e3d1 Merge commit '3f7c366fc0464e01ddcaefbd70647cb3da4202be' into rustfmt-sync 2023-06-19 23:13:56 -05:00
Maybe Waffle
dc7dc3e74c Implement become expression formatting in rustfmt 2023-06-19 12:54:34 +00:00
Matthias Krüger
48e380fa40 Rollup merge of #110989 - jyn514:bug-report-url, r=WaffleLapkin
Make the BUG_REPORT_URL configurable by tools

This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy
the entire hook implementation.

I haven't changed clippy in case they want to make the change upstream instead of the subtree, but
I'm happy to do so here if the maintainers want - cc ````@rust-lang/clippy````

Fixes https://github.com/rust-lang/rust/issues/109486.
2023-05-06 13:30:04 +02:00
Michael Goulet
8ed5d5de3d Rustfmt support for negative bounds, test 2023-05-02 22:36:25 +00:00
Michael Goulet
8e330f9d5b Make tools happy 2023-05-02 22:36:24 +00:00
bors
ae213e228d Auto merge of #109128 - chenyukang:yukang/remove-type-ascription, r=estebank
Remove type ascription from parser and diagnostics

Mostly based on https://github.com/rust-lang/rust/pull/106826

Part of #101728

r? `@estebank`
2023-05-02 09:41:35 +00:00
jyn
34a71f67d1 Make the BUG_REPORT_URL configurable by tools
This greatly simplifies how hard it is to set a custom bug report url; previously tools had to copy
the entire hook implementation.

- Switch clippy to the new hook

  This also adds a `extra_info` callback so clippy can include its own version number, which differs
  from rustc's.

- Call `install_ice_hook` in rustfmt
2023-05-01 21:44:04 -05:00
bors
4351e50a9e Auto merge of #111036 - RalfJung:miri, r=RalfJung
update Miri

r? `@ghost`
2023-05-01 11:13:49 +00:00
yukang
9d20134a78 remove rustfmt testcase for type ascription 2023-05-01 16:15:17 +08:00
yukang
a74d2d7440 fix tests 2023-05-01 16:15:17 +08:00
Ralf Jung
4eb1b520d5 Merge from rustc 2023-04-30 22:35:29 +02:00
Michael Goulet
6b9c151686 Tweak await span 2023-04-27 17:18:11 +00:00
Ralf Jung
afe34c8443 Merge from rustc 2023-04-22 10:35:35 +02:00
DrMeepster
f4c9b4c26f rustfmt fmt 2023-04-21 08:59:30 -07:00
DrMeepster
ecfdec44df minor tweaks 2023-04-21 02:14:04 -07:00
DrMeepster
84385bff42 offset_of 2023-04-21 02:14:02 -07:00
Ben Kimock
f533800225 Merge from rustc 2023-04-10 07:55:57 -04:00
Oli Scherer
f1781396bf box a bunch of large types 2023-04-04 13:58:50 +00:00
Oli Scherer
3ecb9ed53c Split out ast::ItemKind::Const into its own struct 2023-04-04 09:44:50 +00:00
Oli Scherer
ced3cd8d40 rust-analyzer guided tuple field to named field 2023-04-04 09:44:50 +00:00
Oli Scherer
c2890ec2d7 rust-analyzer guided enum variant structification 2023-04-04 09:44:45 +00:00
Oli Scherer
5effe61a54 Merge from rustc 2023-04-04 08:01:31 +00:00
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
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
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
Esteban Küber
4e3ed18e1d review comment: Remove AST AnonTy 2023-01-23 18:21:08 +00: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