@@ -19,7 +19,6 @@ use parse;
19
19
use parse:: token:: { get_ident_interner} ;
20
20
use print:: pprust;
21
21
22
- use std:: cell:: RefCell ;
23
22
use std:: io;
24
23
use std:: io:: File ;
25
24
use std:: str;
@@ -105,20 +104,14 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::token_tree])
105
104
Ok ( bytes) => bytes,
106
105
} ;
107
106
match str:: from_utf8_owned_opt ( bytes) {
108
- Some ( s) => {
109
- let s = s. to_managed ( ) ;
107
+ Some ( src) => {
110
108
// Add this input file to the code map to make it available as
111
109
// dependency information
112
- let mut files = cx. parse_sess . cm . files . borrow_mut ( ) ;
113
- files. get ( ) . push ( @codemap:: FileMap {
114
- name : file. display ( ) . to_str ( ) . to_managed ( ) ,
115
- substr : codemap:: FssNone ,
116
- src : s,
117
- start_pos : codemap:: BytePos ( 0 ) ,
118
- lines : RefCell :: new ( ~[ ] ) ,
119
- multibyte_chars : RefCell :: new ( ~[ ] ) ,
120
- } ) ;
121
- base:: MRExpr ( cx. expr_str ( sp, s) )
110
+ let src = src. to_managed ( ) ;
111
+ let filename = file. display ( ) . to_str ( ) . to_managed ( ) ;
112
+ cx. parse_sess . cm . new_filemap ( filename, src) ;
113
+
114
+ base:: MRExpr ( cx. expr_str ( sp, src) )
122
115
}
123
116
None => {
124
117
cx. span_fatal ( sp, format ! ( "{} wasn't a utf-8 file" , file. display( ) ) ) ;
0 commit comments