This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 19499df
authored
Unrolled build for rust-lang#139865
Rollup merge of rust-lang#139865 - m-ou-se:stabilize-proc-macro-span-location, r=tgross35
Stabilize proc_macro::Span::{start,end,line,column}.
This stabilizes part of rust-lang#54725
Specifically, the part related to getting the location of a span:
```rust
impl Span {
pub fn start(&self) -> Span; // Empty span at the start of this span
pub fn end(&self) -> Span; // Empty span at the end of this span
pub fn line(&self) -> usize; // Line where the span starts
pub fn column(&self) -> usize; // Column where the span starts
}
```
History of this part of the API:
Originally, `start` and `end` returned a `LineColumn` struct (containing the line and column).
This has been simplified/changed:
- No more `LineColumn`: `Span` now directly has `.line()` and `.column()` methods. This means we can easily add `.byte_offset()` or `.byte_range()` in the future if we want to.
- `Span::start()` and `Span::end()` are now the equivalent of rustc's internal `shrink_to_lo()` and `shrink_to_hi()`. This means you can do e.g. `span.end().column()`, removing the need for a `span.end_column()` or similar.1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
| 516 | + | |
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
522 | | - | |
| 522 | + | |
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
530 | | - | |
| 530 | + | |
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
538 | | - | |
| 538 | + | |
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
| |||
0 commit comments