about summary refs log tree commit diff
path: root/compiler/rustc_expand/src
AgeCommit message (Collapse)AuthorLines
2022-10-24Auto merge of #94063 - Aaron1011:pretty-print-rental, r=lcnrbors-11/+35
Only apply `ProceduralMasquerade` hack to older versions of `rental` The latest version of `rental` (v0.5.6) contains a fix that allows it to compile without relying on the pretty-print back-compat hack. Hopefully, there are no longer any crates relying on the affected versions of the (much less popular) `procedural-masquerade` crate. This should allow us to target the pretty-print back-compat hack specifically to older versions of `rental`, and specifically mention upgrading to `rental` v0.5.6 in the lint message.
2022-10-23Workaround unstable stmt_expr_attributes for method receiver expressions.Camille GILLOT-3/+78
2022-10-23Migrate all diagnosticsNilstrieb-8/+8
2022-10-21Only apply `ProceduralMasquerade` hack to older versions of `rental`Aaron Hill-11/+35
The latest version of `rental` (v0.5.6) contains a fix that allows it to compile without relying on the pretty-print back-compat hack. Hopefully, there are no longer any crates relying on the affected versions of the (much less popular) `procedural-masquerade` crate. This should allow us to target the pretty-print back-compat hack specifically to older versions of `rental`, and specifically mention upgrading to `rental` v0.5.6 in the lint message.
2022-10-21Rollup merge of #102922 - kper:bugfix/102902-filtering-json, r=oli-obkDylan DPC-2/+3
Filtering spans when emitting json According to the issue #102902, we shouldn't emit spans which have an empty span and no suggested replacement.
2022-10-20Implement assertions and fixes to not emit empty spans without suggestionsKevin Per-2/+3
2022-10-19Implement -Ztrack-diagnosticsmejrs-0/+1
2022-10-18Fix the bug of next_point in spanyukang-5/+4
2022-10-14more dupe word typosRageking8-1/+1
2022-10-12Auto merge of #102692 - nnethercote:TokenStreamBuilder, r=Aaron1011bors-73/+71
Remove `TokenStreamBuilder` `TokenStreamBuilder` is used to combine multiple token streams. It can be removed, leaving the code a little simpler and a little faster. r? `@Aaron1011`
2022-10-11fix #102878Takayuki Maeda-8/+11
2022-10-05Remove `TokenStreamBuilder`.Nicholas Nethercote-43/+42
`TokenStreamBuilder` exists to concatenate multiple `TokenStream`s together. This commit removes it, and moves the concatenation functionality directly into `TokenStream`, via two new methods `push_tree` and `push_stream`. This makes things both simpler and faster. `push_tree` is particularly important. `TokenStreamBuilder` only had a single `push` method, which pushed a stream. But in practice most of the time we push a single token tree rather than a stream, and `push_tree` avoids the need to build a token stream with a single entry (which requires two allocations, one for the `Lrc` and one for the `Vec`). The main `push_tree` use arises from a change to one of the `ToInternal` impls in `proc_macro_server.rs`. It now returns a `SmallVec` instead of a `TokenStream`. This return value is then iterated over by `concat_trees`, which does `push_tree` on each element. Furthermore, the use of `SmallVec` avoids more allocations, because there is always only one or two token trees. Note: the removed `TokenStreamBuilder::push` method had some code to deal with a quadratic blowup case from #57735. This commit removes the code. I tried and failed to reproduce the blowup from that PR, before and after this change. Various other changes have happened to `TokenStreamBuilder` in the meantime, so I suspect the original problem is no longer relevant, though I don't have proof of this. Generally speaking, repeatedly extending a `Vec` without pre-determining its capacity is *not* quadratic. It's also incredibly common, within rustc and many other Rust programs, so if there were performance problems there you'd think it would show up in other places, too.
2022-10-05Rearrange `to_internal`.Nicholas Nethercote-41/+40
`TokenTree::Punct` is handled outside the `match`. This commits moves it inside the `match`, avoiding the need for the `return`s and making it easier to read.
2022-10-04Improve spans when splitting multi-char operator tokens for proc macros.Nicholas Nethercote-2/+14
2022-10-03Clarify operator splitting.Nicholas Nethercote-2/+6
I found this code hard to read.
2022-09-27Rewrite and refactor format_args!() builtin macro.Mara Bos-0/+4
2022-09-26remove cfg(bootstrap)Pietro Albini-1/+0
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-1/+1
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-1/+1
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-7/+7
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-10/+10
2022-09-21UPDATE - move SessionDiagnostic from rustc_session to rustc_errorsJhonny Bill Mena-2/+4
2022-09-20Add the `#[derive_const]` attributeDeadbeef-7/+11
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-14make `mk_attr_id` part of `ParseSess`SparrowLii-2/+8
2022-09-13Rollup merge of #101602 - nnethercote:AttrTokenStream, r=petrochenkovDylan DPC-29/+29
Streamline `AttrAnnotatedTokenStream` r? ```@petrochenkov```
2022-09-09Rename `{Create,Lazy}TokenStream` as `{To,Lazy}AttrTokenStream`.Nicholas Nethercote-7/+7
`To` is better than `Create` for indicating that this is a non-consuming conversion, rather than creating something out of nothing. And the addition of `Attr` is because the current names makes them sound like they relate to `TokenStream`, but really they relate to `AttrTokenStream`.
2022-09-09Change return type of `Attribute::tokens`.Nicholas Nethercote-1/+1
The `AttrTokenStream` is always immediately turned into a `TokenStream`.
2022-09-09Rename `AttrAnnotatedToken{Stream,Tree}`.Nicholas Nethercote-21/+21
These two type names are long and have long matching prefixes. I find them hard to read, especially in combinations like `AttrAnnotatedTokenStream::new(vec![AttrAnnotatedTokenTree::Token(..)])`. This commit renames them as `AttrToken{Stream,Tree}`.
2022-09-09Move `Spacing` out of `AttrAnnotatedTokenStream`.Nicholas Nethercote-11/+11
And into `AttrAnnotatedTokenTree::Token`. PR #99887 did the same thing for `TokenStream`.
2022-09-07ssa: implement `#[collapse_debuginfo]`David Wood-16/+23
Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. Signed-off-by: David Wood <david.wood@huawei.com>
2022-09-02Refactor and re-use BindingAnnotationCameron Steffen-6/+4
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+3
by module
2022-09-01Auto merge of #100707 - dzvon:fix-typo, r=davidtwcobors-2/+2
Fix a bunch of typo This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-09-01Auto merge of #100210 - mystor:proc_macro_diag_struct, r=eddybbors-36/+17
proc_macro/bridge: send diagnostics over the bridge as a struct This removes some RPC when creating and emitting diagnostics, and simplifies the bridge slightly. After this change, there are no remaining methods which take advantage of the support for `&mut` references to objects in the store as arguments, meaning that support for them could technically be removed if we wanted. The only remaining uses of immutable references into the store are `TokenStream` and `SourceFile`. r? `@eddyb`
2022-08-31Fix ci checksDezhi Wu-1/+1
2022-08-31Fix a bunch of typoDezhi Wu-3/+3
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-23Remove the symbol from `ast::LitKind::Err`.Nicholas Nethercote-1/+1
Because it's never used meaningfully.
2022-08-22Use `AttrVec` in more places.Nicholas Nethercote-21/+23
In some places we use `Vec<Attribute>` and some places we use `ThinVec<Attribute>` (a.k.a. `AttrVec`). This results in various points where we have to convert between `Vec` and `ThinVec`. This commit changes the places that use `Vec<Attribute>` to use `AttrVec`. A lot of this is mechanical and boring, but there are some interesting parts: - It adds a few new methods to `ThinVec`. - It implements `MapInPlace` for `ThinVec`, and introduces a macro to avoid the repetition of this trait for `Vec`, `SmallVec`, and `ThinVec`. Overall, it makes the code a little nicer, and has little effect on performance. But it is a precursor to removing `rustc_data_structures::thin_vec::ThinVec` and replacing it with `thin_vec::ThinVec`, which is implemented more efficiently.
2022-08-21Replace #[lint/warning/error] with #[diag]Xiretza-6/+6
2022-08-20Auto merge of #100564 - nnethercote:box-ast-MacCall, r=spastorinobors-15/+15
Box the `MacCall` in various types. r? `@spastorino`
2022-08-18Rollup merge of #100669 - nnethercote:attribute-cleanups, r=spastorinoMatthias Krüger-2/+1
Attribute cleanups r? `@ghost`
2022-08-18Rollup merge of #100651 - nidnogg:diagnostics_migration_expand_transcribe, ↵Matthias Krüger-24/+59
r=davidtwco Migrations for rustc_expand transcribe.rs This PR includes some migrations to the new diagnostics API for the `rustc_expand` module. r? ```@davidtwco```
2022-08-17Hotfix for duplicated slug name on VarStillRepeating structnidnogg-1/+1
2022-08-17Moved structs to rustc_expand::errors, added several more migrations, fixed ↵nidnogg-3/+1
slug name
2022-08-17Moved structs to rustc_expand::errors, added several more migrations, fixed ↵nidnogg-33/+58
slug name
2022-08-17Remove `attrs` arg from `typaram` and `mk_ty_param`.Nicholas Nethercote-2/+1
Because it's always empty.
2022-08-16Previous commit under x.py fmtnidnogg-1/+1
2022-08-17Box the `MacCall` in various types.Nicholas Nethercote-15/+15