@@ -35,8 +35,8 @@ impl TokenStream {
35
35
36
36
#[ cfg( span_locations) ]
37
37
fn get_cursor ( src : & str ) -> Cursor {
38
- // Create a dummy file & add it to the codemap
39
- CODEMAP . with ( |cm| {
38
+ // Create a dummy file & add it to the source map
39
+ SOURCE_MAP . with ( |cm| {
40
40
let mut cm = cm. borrow_mut ( ) ;
41
41
let name = format ! ( "<parsed string {}>" , cm. files. len( ) ) ;
42
42
let span = cm. add_file ( & name, src) ;
@@ -56,7 +56,7 @@ impl FromStr for TokenStream {
56
56
type Err = LexError ;
57
57
58
58
fn from_str ( src : & str ) -> Result < TokenStream , LexError > {
59
- // Create a dummy file & add it to the codemap
59
+ // Create a dummy file & add it to the source map
60
60
let cursor = get_cursor ( src) ;
61
61
62
62
match token_stream ( cursor) {
@@ -225,7 +225,7 @@ pub struct LineColumn {
225
225
226
226
#[ cfg( span_locations) ]
227
227
thread_local ! {
228
- static CODEMAP : RefCell <Codemap > = RefCell :: new( Codemap {
228
+ static SOURCE_MAP : RefCell <SourceMap > = RefCell :: new( SourceMap {
229
229
// NOTE: We start with a single dummy file which all call_site() and
230
230
// def_site() spans reference.
231
231
files: vec![ {
@@ -295,12 +295,12 @@ fn lines_offsets(s: &str) -> Vec<usize> {
295
295
}
296
296
297
297
#[ cfg( span_locations) ]
298
- struct Codemap {
298
+ struct SourceMap {
299
299
files : Vec < FileInfo > ,
300
300
}
301
301
302
302
#[ cfg( span_locations) ]
303
- impl Codemap {
303
+ impl SourceMap {
304
304
fn next_start_pos ( & self ) -> u32 {
305
305
// Add 1 so there's always space between files.
306
306
//
@@ -384,7 +384,7 @@ impl Span {
384
384
385
385
#[ cfg( procmacro2_semver_exempt) ]
386
386
pub fn source_file ( & self ) -> SourceFile {
387
- CODEMAP . with ( |cm| {
387
+ SOURCE_MAP . with ( |cm| {
388
388
let cm = cm. borrow ( ) ;
389
389
let fi = cm. fileinfo ( * self ) ;
390
390
SourceFile {
@@ -395,7 +395,7 @@ impl Span {
395
395
396
396
#[ cfg( span_locations) ]
397
397
pub fn start ( & self ) -> LineColumn {
398
- CODEMAP . with ( |cm| {
398
+ SOURCE_MAP . with ( |cm| {
399
399
let cm = cm. borrow ( ) ;
400
400
let fi = cm. fileinfo ( * self ) ;
401
401
fi. offset_line_column ( self . lo as usize )
@@ -404,7 +404,7 @@ impl Span {
404
404
405
405
#[ cfg( span_locations) ]
406
406
pub fn end ( & self ) -> LineColumn {
407
- CODEMAP . with ( |cm| {
407
+ SOURCE_MAP . with ( |cm| {
408
408
let cm = cm. borrow ( ) ;
409
409
let fi = cm. fileinfo ( * self ) ;
410
410
fi. offset_line_column ( self . hi as usize )
@@ -413,7 +413,7 @@ impl Span {
413
413
414
414
#[ cfg( procmacro2_semver_exempt) ]
415
415
pub fn join ( & self , other : Span ) -> Option < Span > {
416
- CODEMAP . with ( |cm| {
416
+ SOURCE_MAP . with ( |cm| {
417
417
let cm = cm. borrow ( ) ;
418
418
// If `other` is not within the same FileInfo as us, return None.
419
419
if !cm. fileinfo ( * self ) . span_within ( other) {
0 commit comments