@@ -31,8 +31,8 @@ use rustc_data_structures::sync::Lrc;
31
31
// a given file into the current one.
32
32
33
33
/// line!(): expands to the current line number
34
- pub fn expand_line ( cx : & mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
35
- -> Box < base:: MacResult +' static > {
34
+ pub fn expand_line < ' cx > ( cx : & ' cx mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
35
+ -> Box < base:: MacResult +' cx > {
36
36
base:: check_zero_tts ( cx, sp, tts, "line!" ) ;
37
37
38
38
let topmost = cx. expansion_cause ( ) . unwrap_or ( sp) ;
@@ -42,8 +42,8 @@ pub fn expand_line(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
42
42
}
43
43
44
44
/* column!(): expands to the current column number */
45
- pub fn expand_column ( cx : & mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
46
- -> Box < base:: MacResult +' static > {
45
+ pub fn expand_column < ' cx > ( cx : & ' cx mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
46
+ -> Box < base:: MacResult +' cx > {
47
47
base:: check_zero_tts ( cx, sp, tts, "column!" ) ;
48
48
49
49
let topmost = cx. expansion_cause ( ) . unwrap_or ( sp) ;
@@ -53,8 +53,8 @@ pub fn expand_column(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
53
53
}
54
54
55
55
/* __rust_unstable_column!(): expands to the current column number */
56
- pub fn expand_column_gated ( cx : & mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
57
- -> Box < base:: MacResult +' static > {
56
+ pub fn expand_column_gated < ' cx > ( cx : & ' cx mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
57
+ -> Box < base:: MacResult +' cx > {
58
58
if sp. allows_unstable ( ) {
59
59
expand_column ( cx, sp, tts)
60
60
} else {
@@ -65,23 +65,23 @@ pub fn expand_column_gated(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::Token
65
65
/// file!(): expands to the current filename */
66
66
/// The filemap (`loc.file`) contains a bunch more information we could spit
67
67
/// out if we wanted.
68
- pub fn expand_file ( cx : & mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
69
- -> Box < base:: MacResult +' static > {
68
+ pub fn expand_file < ' cx > ( cx : & ' cx mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
69
+ -> Box < base:: MacResult +' cx > {
70
70
base:: check_zero_tts ( cx, sp, tts, "file!" ) ;
71
71
72
72
let topmost = cx. expansion_cause ( ) . unwrap_or ( sp) ;
73
73
let loc = cx. codemap ( ) . lookup_char_pos ( topmost. lo ( ) ) ;
74
74
base:: MacEager :: expr ( cx. expr_str ( topmost, Symbol :: intern ( & loc. file . name . to_string ( ) ) ) )
75
75
}
76
76
77
- pub fn expand_stringify ( cx : & mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
78
- -> Box < base:: MacResult +' static > {
77
+ pub fn expand_stringify < ' cx > ( cx : & ' cx mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
78
+ -> Box < base:: MacResult +' cx > {
79
79
let s = pprust:: tts_to_string ( tts) ;
80
80
base:: MacEager :: expr ( cx. expr_str ( sp, Symbol :: intern ( & s) ) )
81
81
}
82
82
83
- pub fn expand_mod ( cx : & mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
84
- -> Box < base:: MacResult +' static > {
83
+ pub fn expand_mod < ' cx > ( cx : & ' cx mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
84
+ -> Box < base:: MacResult +' cx > {
85
85
base:: check_zero_tts ( cx, sp, tts, "module_path!" ) ;
86
86
let mod_path = & cx. current_expansion . module . mod_path ;
87
87
let string = mod_path. iter ( ) . map ( |x| x. to_string ( ) ) . collect :: < Vec < String > > ( ) . join ( "::" ) ;
@@ -130,8 +130,8 @@ pub fn expand_include<'cx>(cx: &'cx mut ExtCtxt, sp: Span, tts: &[tokenstream::T
130
130
}
131
131
132
132
// include_str! : read the given file, insert it as a literal string expr
133
- pub fn expand_include_str ( cx : & mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
134
- -> Box < base:: MacResult +' static > {
133
+ pub fn expand_include_str < ' cx > ( cx : & ' cx mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
134
+ -> Box < base:: MacResult +' cx > {
135
135
let file = match get_single_str_from_tts ( cx, sp, tts, "include_str!" ) {
136
136
Some ( f) => f,
137
137
None => return DummyResult :: expr ( sp)
@@ -165,8 +165,8 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenT
165
165
}
166
166
}
167
167
168
- pub fn expand_include_bytes ( cx : & mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
169
- -> Box < base:: MacResult +' static > {
168
+ pub fn expand_include_bytes < ' cx > ( cx : & ' cx mut ExtCtxt , sp : Span , tts : & [ tokenstream:: TokenTree ] )
169
+ -> Box < base:: MacResult +' cx > {
170
170
let file = match get_single_str_from_tts ( cx, sp, tts, "include_bytes!" ) {
171
171
Some ( f) => f,
172
172
None => return DummyResult :: expr ( sp)
0 commit comments