aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / vendor / proc-macro2 / src / probe / proc_macro_span.rs
| 1 | // This code exercises the surface area that we expect of Span's unstable API. |
| 2 | // If the current toolchain is able to compile it, then proc-macro2 is able to |
| 3 | // offer these APIs too. |
| 4 | |
| 5 | #![cfg_attr(procmacro2_build_probe, no_std)] |
| 6 | #![cfg_attr(procmacro2_build_probe, feature(proc_macro_span))] |
| 7 | |
| 8 | extern crate alloc; |
| 9 | extern crate proc_macro; |
| 10 | extern crate std; |
| 11 | |
| 12 | use alloc::string::String; |
| 13 | use core::ops::{Range, RangeBounds}; |
| 14 | use proc_macro::{Literal, Span}; |
| 15 | use std::path::PathBuf; |
| 16 | |
| 17 | pub fn byte_range(this: &Span) -> Range<usize> { |
| 18 | this.byte_range() |
| 19 | } |
| 20 | |
| 21 | pub fn start(this: &Span) -> Span { |
| 22 | this.start() |
| 23 | } |
| 24 | |
| 25 | pub fn end(this: &Span) -> Span { |
| 26 | this.end() |
| 27 | } |
| 28 | |
| 29 | pub fn line(this: &Span) -> usize { |
| 30 | this.line() |
| 31 | } |
| 32 | |
| 33 | pub fn column(this: &Span) -> usize { |
| 34 | this.column() |
| 35 | } |
| 36 | |
| 37 | pub fn file(this: &Span) -> String { |
| 38 | this.file() |
| 39 | } |
| 40 | |
| 41 | pub fn local_file(this: &Span) -> Option<PathBuf> { |
| 42 | this.local_file() |
| 43 | } |
| 44 | |
| 45 | pub fn join(this: &Span, other: Span) -> Option<Span> { |
| 46 | this.join(other) |
| 47 | } |
| 48 | |
| 49 | pub fn subspan<R: RangeBounds<usize>>(this: &Literal, range: R) -> Option<Span> { |
| 50 | this.subspan(range) |
| 51 | } |
| 52 | |
| 53 | // Include in sccache cache key. |
| 54 | #[cfg(procmacro2_build_probe)] |
| 55 | const _: Option<&str> = option_env!("RUSTC_BOOTSTRAP"); |