Commit Graph

39 Commits

Author SHA1 Message Date
Camille GILLOT 6dcc8617d3 Fix doc-comment. 2025-08-10 23:01:45 +00:00
Jason Newcomb d9c060b88b Optimize the codegen for Span::from_expansion 2025-04-30 11:38:09 -04:00
Matthias Krüger e158303c09 Rollup merge of #128197 - Alexendoo:span-ctxt, r=davidtwco
Skip locking span interner for some syntax context checks

- `from_expansion` now never needs to consult the interner
- `eq_ctxt` now only needs the interner when both spans are fully interned
2024-11-14 20:45:12 +01:00
Michael Goulet c682aa162b Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
Nicholas Nethercote b0f22ff98f Add warn(unreachable_pub) to rustc_span. 2024-09-03 08:49:54 +10:00
Alex Macleod ad3f3c7fb6 Skip locking span interner for some syntax context checks 2024-08-06 13:29:11 +00:00
Nicholas Nethercote 84ac80f192 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Vadim Petrochenkov 4d3b617911 rustc_span: Optimize span parent get/set methods 2024-06-20 17:02:13 +03:00
Vadim Petrochenkov 91d05ba557 [perf] More span update benchmarking 2024-06-17 16:26:56 +03:00
Vadim Petrochenkov 14da80c372 rustc_span: Minor improvements
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-06-16 14:08:25 +03:00
Vadim Petrochenkov 220f3ec99f rustc_span: Remove transmutes from span encoding 2024-06-13 20:12:50 +03:00
Vadim Petrochenkov 6fea953267 rustc_span: By-value interface for ctxt update 2024-06-13 19:29:24 +03:00
Vadim Petrochenkov 4440f50996 rustc_span: Add conveniences for working with span formats 2024-06-13 19:29:24 +03:00
Vadim Petrochenkov d5dd2d8284 rustc_span: Optimize syntax context updates in spans 2024-06-10 02:20:16 +03:00
Vadim Petrochenkov 8530285f4e rustc_span: Inline some hot functions 2024-06-03 01:01:18 +03:00
Nilstrieb 5039160c5b Add add/sub methods that only panic with debug assertions to rustc
This mitigates the perf impact of enabling overflow checks on rustc.
The change to use overflow checks will be done in a later PR.
2024-04-13 17:03:12 +02:00
Vadim Petrochenkov 90d11d6448 rustc_span: Optimize syntax context comparisons
Including comparisons with root context
2024-01-06 01:25:20 +03:00
Arthur Lafrance 5895102c4d debug Span::ctxt() call detection 2023-10-16 19:50:29 -07:00
Arthur Lafrance f77dea89e1 basic lint v2 implemented 2023-10-16 19:47:33 -07:00
Arthur Lafrance 8769e02d0b implement the basics of the lint static analysis 2023-10-16 19:47:33 -07:00
Michael Goulet b2d2184ede Format all the let chains in compiler 2023-10-13 08:59:36 +00:00
Nicholas Nethercote 5790372736 Optimize Span::is_dummy.
It's quite hot, and worth having a version that works directly at the
`Span` level, rather than first converting to the `SpanData` level.
2023-09-08 16:54:02 +10:00
Nicholas Nethercote e525e4f10a Span tweaks.
`Span` has undergone some changes over the years (addition of an optional
parent, and possible inlining of the context in interned spans) but the
comments and identifiers used haven't kept up. As a result, I find it
harder to understand than I should.

This commit reworks the comments, renames some identifiers, and
restructures the code slightly, all to make things clearer. I now feel
like I understand this code again.
2023-09-08 16:53:57 +10:00
Camille GILLOT 99962a8418 Refactor SyntaxContext::ctxt logic. 2023-04-18 18:00:21 +00:00
Camille GILLOT e80afa6501 Intern span when length is MAX_LEN with parent. 2023-02-11 17:46:22 +00:00
Camille GILLOT 6d42636456 Encode span parent in the inlined representation. 2022-12-25 16:41:33 +00:00
Maybe Waffle f2b97a8bfe Remove useless borrows and derefs 2022-12-01 17:34:43 +00:00
Camille GILLOT 3e67bded92 Make names more explicit. 2022-08-17 19:20:28 +02:00
Camille GILLOT b2a17e9bd1 Keep ctxt in encoded span representation. 2022-08-17 19:18:33 +02:00
Mark Rousskov 76b13c9eea Enable rustc_pass_by_value for Span 2022-02-25 08:00:53 -05:00
Mark Rousskov 22c3a71de1 Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
lcnr 2684dfe583 try apply rustc_pass_by_value to Span 2022-01-27 11:29:41 +01:00
Camille GILLOT 940fa9251e Rename decode to data_untracked. 2021-09-10 20:18:22 +02:00
Camille GILLOT b19ae20aad Track span dependency using a callback. 2021-09-10 20:18:18 +02:00
Camille GILLOT 00485e0c0e Keep a parent LocalDefId in SpanData. 2021-09-10 20:17:33 +02:00
Guillaume Gomez a2654fb64c Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
Joshua Nelson b73ad09dfd Remove SpanInterner::get
- It's used exactly once, so it's trivial to replace
- It doesn't match the normal convention for containers: normally
`get()` returns and option and indexing panics. Instead `get()` panicked
  and there's no indexing operation available.
2021-05-03 17:32:06 -04:00
pierwill a8775d44e9 Edit rustc_span documentation
Various changes to the `rustc_span` docs, including the following:

- Additions to top-level docs
- Edits to the source_map module docs
- Edits to documentation for `Span` and `SpanData`
- Added intra-docs links
- Documentation for Levenshtein distances
- Fixed missing punctuation
2020-12-25 14:02:52 -08:00
mark 9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00