14
14
//! to use this crate will be trivially able to switch to the upstream
15
15
//! `proc_macro` crate once its API stabilizes.
16
16
//!
17
- //! In the meantime this crate also has an `unstable ` Cargo feature which
17
+ //! In the meantime this crate also has a `nightly ` Cargo feature which
18
18
//! enables it to reimplement itself with the unstable API of `proc_macro`.
19
19
//! This'll allow immediate usage of the beneficial upstream API, particularly
20
20
//! around preserving span information.
21
21
22
- #![ cfg_attr( feature = "unstable " , feature( proc_macro) ) ]
22
+ #![ cfg_attr( feature = "nightly " , feature( proc_macro) ) ]
23
23
24
24
extern crate proc_macro;
25
25
26
- #[ cfg( not( feature = "unstable " ) ) ]
26
+ #[ cfg( not( feature = "nightly " ) ) ]
27
27
extern crate unicode_xid;
28
28
29
29
use std:: fmt;
30
30
use std:: str:: FromStr ;
31
31
use std:: iter:: FromIterator ;
32
32
33
33
#[ macro_use]
34
- #[ cfg( not( feature = "unstable " ) ) ]
34
+ #[ cfg( not( feature = "nightly " ) ) ]
35
35
mod strnom;
36
36
37
37
#[ path = "stable.rs" ]
38
- #[ cfg( not( feature = "unstable " ) ) ]
38
+ #[ cfg( not( feature = "nightly " ) ) ]
39
39
mod imp;
40
40
#[ path = "unstable.rs" ]
41
- #[ cfg( feature = "unstable " ) ]
41
+ #[ cfg( feature = "nightly " ) ]
42
42
mod imp;
43
43
44
44
#[ macro_use]
@@ -104,14 +104,14 @@ impl TokenStream {
104
104
}
105
105
106
106
// Returned by reference, so we can't easily wrap it.
107
- #[ cfg( procmacro2_unstable ) ]
107
+ #[ cfg( procmacro2_semver_exempt ) ]
108
108
pub use imp:: FileName ;
109
109
110
- #[ cfg( procmacro2_unstable ) ]
110
+ #[ cfg( procmacro2_semver_exempt ) ]
111
111
#[ derive( Clone , PartialEq , Eq ) ]
112
112
pub struct SourceFile ( imp:: SourceFile ) ;
113
113
114
- #[ cfg( procmacro2_unstable ) ]
114
+ #[ cfg( procmacro2_semver_exempt ) ]
115
115
impl SourceFile {
116
116
/// Get the path to this source file as a string.
117
117
pub fn path ( & self ) -> & FileName {
@@ -123,21 +123,21 @@ impl SourceFile {
123
123
}
124
124
}
125
125
126
- #[ cfg( procmacro2_unstable ) ]
126
+ #[ cfg( procmacro2_semver_exempt ) ]
127
127
impl AsRef < FileName > for SourceFile {
128
128
fn as_ref ( & self ) -> & FileName {
129
129
self . 0 . path ( )
130
130
}
131
131
}
132
132
133
- #[ cfg( procmacro2_unstable ) ]
133
+ #[ cfg( procmacro2_semver_exempt ) ]
134
134
impl fmt:: Debug for SourceFile {
135
135
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
136
136
self . 0 . fmt ( f)
137
137
}
138
138
}
139
139
140
- #[ cfg( procmacro2_unstable ) ]
140
+ #[ cfg( procmacro2_semver_exempt ) ]
141
141
pub struct LineColumn {
142
142
pub line : usize ,
143
143
pub column : usize ,
@@ -162,30 +162,30 @@ impl Span {
162
162
Span ( imp:: Span :: def_site ( ) )
163
163
}
164
164
165
- /// This method is only available when the `"unstable "` feature is enabled.
166
- #[ cfg( feature = "unstable " ) ]
165
+ /// This method is only available when the `"nightly "` feature is enabled.
166
+ #[ cfg( feature = "nightly " ) ]
167
167
pub fn unstable ( self ) -> proc_macro:: Span {
168
168
self . 0 . unstable ( )
169
169
}
170
170
171
- #[ cfg( procmacro2_unstable ) ]
171
+ #[ cfg( procmacro2_semver_exempt ) ]
172
172
pub fn source_file ( & self ) -> SourceFile {
173
173
SourceFile ( self . 0 . source_file ( ) )
174
174
}
175
175
176
- #[ cfg( procmacro2_unstable ) ]
176
+ #[ cfg( procmacro2_semver_exempt ) ]
177
177
pub fn start ( & self ) -> LineColumn {
178
178
let imp:: LineColumn { line, column } = self . 0 . start ( ) ;
179
179
LineColumn { line : line, column : column }
180
180
}
181
181
182
- #[ cfg( procmacro2_unstable ) ]
182
+ #[ cfg( procmacro2_semver_exempt ) ]
183
183
pub fn end ( & self ) -> LineColumn {
184
184
let imp:: LineColumn { line, column } = self . 0 . end ( ) ;
185
185
LineColumn { line : line, column : column }
186
186
}
187
187
188
- #[ cfg( procmacro2_unstable ) ]
188
+ #[ cfg( procmacro2_semver_exempt ) ]
189
189
pub fn join ( & self , other : Span ) -> Option < Span > {
190
190
self . 0 . join ( other. 0 ) . map ( Span )
191
191
}
0 commit comments