• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #![feature(proc_macro_span)]
6 
7 extern crate proc_macro;
8 
9 use core::ops::{Range, RangeBounds};
10 use proc_macro::{Literal, Span};
11 
byte_range(this: &Span) -> Range<usize>12 pub fn byte_range(this: &Span) -> Range<usize> {
13     this.byte_range()
14 }
15 
start(this: &Span) -> Span16 pub fn start(this: &Span) -> Span {
17     this.start()
18 }
19 
end(this: &Span) -> Span20 pub fn end(this: &Span) -> Span {
21     this.end()
22 }
23 
line(this: &Span) -> usize24 pub fn line(this: &Span) -> usize {
25     this.line()
26 }
27 
column(this: &Span) -> usize28 pub fn column(this: &Span) -> usize {
29     this.column()
30 }
31 
join(this: &Span, other: Span) -> Option<Span>32 pub fn join(this: &Span, other: Span) -> Option<Span> {
33     this.join(other)
34 }
35 
subspan<R: RangeBounds<usize>>(this: &Literal, range: R) -> Option<Span>36 pub fn subspan<R: RangeBounds<usize>>(this: &Literal, range: R) -> Option<Span> {
37     this.subspan(range)
38 }
39 
40 // Include in sccache cache key.
41 const _: Option<&str> = option_env!("RUSTC_BOOTSTRAP");
42