about summary refs log tree commit diff
path: root/compiler/rustc_span/src/hygiene.rs
AgeCommit message (Collapse)AuthorLines
2025-01-18Revert "Auto merge of #133734 - scottmcm:lower-indexing-to-ptrmetadata, ↵Rémy Rakic-4/+0
r=davidtwco,RalfJung" This reverts commit b57d93d8b9525fa261404b4cd9c0670eeb1264b8, reversing changes made to 0aeaa5eb22180fdf12a8489e63c4daa18da6f236.
2024-12-13Don't retag the `PtrMetadata(&raw const *_n)` in slice indexingScott McMurray-0/+4
2024-11-27rustc_span: Replace a `HashMap<_, ()>` with `HashSet`Josh Stone-5/+6
Now that `HashSet::entry()` exists, we don't need to fake it with a map.
2024-11-12Delete the `cfg(not(parallel))` serial compilerNoratrieb-13/+1
Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon!
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-3/+3
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-1/+1
2024-08-21Rollup merge of #127279 - bvanjoi:fix-112680, r=petrochenkovMatthias Krüger-0/+8
use old ctx if has same expand environment during decode span Fixes #112680 The root reason why #112680 failed with incremental compilation on the second attempt is the difference in `opaque` between the span of the field [`ident`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_hir_typeck/src/expr.rs#L2348) and the span in the incremental cache at `tcx.def_ident_span(field.did)`. - Let's call the span of `ident` as `span_a`, which is generated by [`apply_mark_internal`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_span/src/hygiene.rs#L553-L554). Its content is similar to: ```rs span_a_ctx -> SyntaxContextData { opaque: span_a_ctx, opaque_and_semitransparent: span_a_ctx, // .... } ``` - And call the span of `tcx.def_ident_span` as `span_b`, which is generated by [`decode_syntax_context`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_span/src/hygiene.rs#L1390). Its content is: ```rs span_b_ctx -> SyntaxContextData { opaque: span_b_ctx, // note `span_b_ctx` is not same as `span_a_ctx` opaque_and_semitransparent: span_b_ctx, // .... } ``` Although they have the same `parent` (both refer to the root) and `outer_expn`, I cannot find the specific connection between them. Therefore, I chose a solution that may not be the best: give up the incremental compile cache to ensure we can use `span_a` in this case. r? `@petrochenkov` Do you have any advice on this? Or perhaps this solution is acceptable?
2024-07-29Reformat `use` declarations.Nicholas Nethercote-8/+10
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-05use old ctx if has same expand environment during decode spanbohan-0/+8
2024-06-21Auto merge of #123165 - oli-obk:no_ord_def_id3, r=cjgillotbors-1/+7
Stop sorting `Span`s' `SyntaxContext`, as that is incompatible with incremental work towards https://github.com/rust-lang/rust/issues/90317 Luckily no one actually needed these to be sorted, so it didn't even affect diagnostics. I'm guessing they'd have been sorted by creation time anyway, so it wouldn't really have mattered. r? `@cjgillot`
2024-06-16rustc_span: Minor improvementsVadim Petrochenkov-0/+5
Introduce `{IndexNewtype,SyntaxContext}::from_u16` for convenience because small indices are sometimes encoded as `u16`. Use `SpanData::span` instead of `Span::new` where appropriate. Add a clarifying comment about decoding span parents.
2024-05-22Remove `#[macro_use]` extern crate tracing` from `rustc_span`.Nicholas Nethercote-0/+1
Because explicit macro imports are better than implicit macro imports.
2024-04-29Remove `extern crate rustc_macros` from numerous crates.Nicholas Nethercote-1/+1
2024-04-25debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and ↵Vadim Petrochenkov-23/+15
`#[collapse_debuginfo]` `-Z debug-macros` is "stabilized" by enabling it by default and removing. `-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`. It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no. Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local). `#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
2024-04-24chore: fix some typos in commentswhosehang-1/+1
Signed-off-by: whosehang <whosehang@outlook.com>
2024-04-19Stop sorting `Span`s' `SyntaxContext`, as that is incompatible with incrementalOli Scherer-1/+7
2024-04-03rustc_index: Add a `ZERO` constant to index typesVadim Petrochenkov-2/+2
It is commonly used.
2024-03-22Update (doc) commentsLeón Orell Valerian Liehr-1/+1
Several (doc) comments were super outdated or didn't provide enough context. Some doc comments shoved everything in a single paragraph without respecting the fact that the first paragraph should be a single sentence because rustdoc treats these as item descriptions / synopses on module pages.
2024-01-31Add async bound modifier to enable async Fn boundsMichael Goulet-0/+3
2024-01-19Auto merge of #120112 - matthiaskrgr:rollup-48o3919, r=matthiaskrgrbors-5/+14
Rollup of 9 pull requests Successful merges: - #119582 (bootstrap: handle vendored sources when remapping crate paths) - #119730 (docs: fix typos) - #119828 (Improved collapse_debuginfo attribute, added command-line flag) - #119869 (replace `track_errors` usages with bubbling up `ErrorGuaranteed`) - #120037 (Remove `next_root_ty_var`) - #120094 (tests/ui/asm/inline-syntax: adapt for LLVM 18) - #120096 (Set RUSTC_BOOTSTRAP=1 consistently) - #120101 (change `.unwrap()` to `?` on write where `fmt::Result` is returned) - #120102 (Fix typo in munmap_partial.rs) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-17Use UnhashMap for a few more mapsMark Rousskov-2/+2
This avoids hashing data that's already hashed.
2024-01-17Improved collapse_debuginfo attribute, added command-line flag (no|external|yes)Andrew Zhogin-5/+14
2024-01-09Rollup merge of #118903 - azhogin:azhogin/skip_second_stmt_debuginfo.rs, ↵Matthias Krüger-1/+33
r=petrochenkov Improved support of collapse_debuginfo attribute for macros. Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain. Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap). cc https://github.com/rust-lang/rust/issues/100758
2024-01-08Improved support of collapse_debuginfo attribute for macros.Andrew Zhogin-1/+33
2024-01-08macro_rules: Add an expansion-local cache to span markerVadim Petrochenkov-1/+1
2024-01-06Auto merge of #119662 - matthiaskrgr:rollup-ehofh5n, r=matthiaskrgrbors-16/+1
Rollup of 9 pull requests Successful merges: - #118194 (rustdoc: search for tuples and unit by type with `()`) - #118781 (merge core_panic feature into panic_internals) - #119486 (pass allow-{dirty,staged} to clippy) - #119591 (rustc_mir_transform: Make DestinationPropagation stable for queries) - #119595 (Fixed ambiguity in hint.rs) - #119624 (rustc_span: More consistent span combination operations) - #119653 (compiler: update Fuchsia sanitizer support.) - #119655 (Remove ignore-stage1 that was added when changing error count msg) - #119661 (Strip lld-wrapper binaries) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-06Rollup merge of #119624 - petrochenkov:dialoc4, r=compiler-errorsMatthias Krüger-16/+1
rustc_span: More consistent span combination operations Also add more tests for using `tt` in addition to `ident`, and some other minor tweaks, see individual commits. This is a part of https://github.com/rust-lang/rust/pull/119412 that doesn't yet add side tables for metavariable spans.
2024-01-06Auto merge of #119531 - petrochenkov:cmpctxt, r=cjgillotbors-4/+6
rustc_span: Optimize syntax context comparisons Including comparisons with root context. - `eq_ctxt` doesn't require retrieving full `SpanData`, or taking the span interner lock twice. - Checking `SyntaxContext` for "rootness" is cheaper than extracting a full outer `ExpnData` for it and checking *it* for rootness. The internal lint for `eq_ctxt` is also tweaked to detect `a.ctxt() != b.ctxt()` in addition to `a.ctxt() == b.ctxt()`.
2024-01-06rustc_span: Optimize syntax context comparisonsVadim Petrochenkov-4/+6
Including comparisons with root context
2024-01-05rustc_span: Remove `fn fresh_expansion`Vadim Petrochenkov-16/+1
In the past it did create a fresh expansion, but now, after surviving a number of refactorings, it does not. Now it's just a thin wrapper around `apply_mark`.
2023-12-31Remove almost all uses of specialization from the metadata encoding codebjorn3-27/+3
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-1/+1
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-2/+0
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-10Remove `-Zkeep-hygiene-data`.Nicholas Nethercote-4/+0
It was added way back in #28585 under the name `-Zkeep-mtwt-tables`. The justification was: > This is so that the resolution results can be used after analysis, > potentially for tool support. There are no uses of significance in the code base, and various Google searches for both option names (and variants) found nothing of interest. @petrochenkov says removing this part (and it's only part) of the hygiene data is dubious. It doesn't seem that big, so let's just keep it around.
2023-11-02Minimize `pub` usage in `hygiene.rs`.Nicholas Nethercote-34/+15
And remove dead functions revealed by this.
2023-11-02Tweak `use` items.Nicholas Nethercote-6/+3
2023-08-25Rollup merge of #115081 - Zoxc:expn-id-decode, r=cjgillotMatthias Krüger-3/+3
Allow overwriting ExpnId for concurrent decoding These assertions only hold for the single threaded compiler. They were triggered in https://github.com/rust-lang/rust/pull/115003.
2023-08-23Extend comment on assertionJohn Kåre Alsaker-1/+5
2023-08-23Check that the old values matchJohn Kåre Alsaker-2/+2
2023-08-22Fix races conditions with `SyntaxContext` decodingJohn Kåre Alsaker-34/+80
2023-08-22Allow overwriting ExpnId for concurrent decodingJohn Kåre Alsaker-3/+3
2023-06-16Add `SyntaxContext::is_root`Maybe Waffle-4/+9
2023-05-30Lower the tracing level of some very verbose messagesOli Scherer-2/+2
2023-05-27Rollup merge of #111952 - cjgillot:drop-replace, r=WaffleLapkinGuillaume Gomez-2/+0
Remove DesugaringKind::Replace. A simple boolean flag is enough.
2023-05-25Remove DesugaringKind::Replace.Camille GILLOT-2/+0
2023-05-25Remove ExpnKind::Inlined.Camille GILLOT-4/+0
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-18Store hashes in special types so they aren't accidentally encoded as numbersBen Kimock-7/+7
2023-04-10Fix typos in compilerDaniPopes-1/+1
2023-04-01a couple clippy::complexity fixesMatthias Krüger-1/+1
map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference