| 1 | |
| 2 |
|
| 3 | |
| 4 | |
| 5 | |
| 6 |
|
| 7 | #![cfg_attr(procmacro2_build_probe, feature(proc_macro_span))]
|
| 8 |
|
| 9 | extern crate proc_macro;
|
| 10 |
|
| 11 | use core::ops::{Range, RangeBounds};
|
| 12 | use proc_macro::{Literal, Span};
|
| 13 | use std::path::PathBuf;
|
| 14 |
|
| 15 | pub fn byte_range(this: &Span) -> Range<usize> {
|
| 16 | this.byte_range()
|
| 17 | }
|
| 18 |
|
| 19 | pub fn start(this: &Span) -> Span {
|
| 20 | this.start()
|
| 21 | }
|
| 22 |
|
| 23 | pub fn end(this: &Span) -> Span {
|
| 24 | this.end()
|
| 25 | }
|
| 26 |
|
| 27 | pub fn line(this: &Span) -> usize {
|
| 28 | this.line()
|
| 29 | }
|
| 30 |
|
| 31 | pub fn column(this: &Span) -> usize {
|
| 32 | this.column()
|
| 33 | }
|
| 34 |
|
| 35 | pub fn file(this: &Span) -> String {
|
| 36 | this.file()
|
| 37 | }
|
| 38 |
|
| 39 | pub fn local_file(this: &Span) -> Option<PathBuf> {
|
| 40 | this.local_file()
|
| 41 | }
|
| 42 |
|
| 43 | pub fn join(this: &Span, other: Span) -> Option<Span> {
|
| 44 | this.join(other)
|
| 45 | }
|
| 46 |
|
| 47 | pub fn subspan<R: RangeBounds<usize>>(this: &Literal, range: R) -> Option<Span> {
|
| 48 | this.subspan(range)
|
| 49 | }
|
| 50 |
|
| 51 | |
| 52 | #[cfg(procmacro2_build_probe)]
|
| 53 | const _: Option<&str> = option_env!("RUSTC_BOOTSTRAP");
|