about summary refs log tree commit diff
path: root/src/librustc_metadata
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-10-17 22:27:57 -0700
committerGitHub <noreply@github.com>2016-10-17 22:27:57 -0700
commit3543a0f6020fb16860f471e8651fa05f5709e83a (patch)
treea4ed9fd39414df30ca4c891131f55d2c755ef6d8 /src/librustc_metadata
parent1d3dfa5301f59e86547a4034fb654c4efb47ac0e (diff)
parent94b36594c628d6703f879856b9b3d4d08a6debfa (diff)
downloadrust-3543a0f6020fb16860f471e8651fa05f5709e83a.tar.gz
rust-3543a0f6020fb16860f471e8651fa05f5709e83a.zip
Auto merge of #36969 - nnethercote:rename-Parser-fields, r=eddyb
Clarify the positions of the lexer and parser

The lexer and parser use unclear names to indicate their positions in the
source code. I propose the following renamings.

Lexer:
```
pos      -> next_pos      # it's actually the next pos!
last_pos -> pos           # it's actually the current pos!
curr     -> ch            # the current char
curr_is  -> ch_is         # tests the current char
col (unchanged)           # the current column
```
parser
```
- last_span       -> prev_span          # the previous token's span
- last_token_kind -> prev_token_kind    # the previous token's kind
- LastTokenKind   -> PrevTokenKind      # ditto (but the type)
- token (unchanged)                     # the current token
- span (unchanged)                      # the current span
```

Things to note:
- This proposal removes all uses of "last", which is an unclear word because it
  could mean (a) previous, (b) final, or (c) most recent, i.e. current.
- The "current" things (ch, col, token, span) consistently lack a prefix. The
  "previous" and "next" things consistently have a prefix.
Diffstat (limited to 'src/librustc_metadata')
-rw-r--r--src/librustc_metadata/creader.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index a57207dc089..f97df67c445 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -582,7 +582,7 @@ impl<'a> CrateReader<'a> {
                     unreachable!();
                 }
             };
-            let local_span = mk_sp(lo, p.last_span.hi);
+            let local_span = mk_sp(lo, p.prev_span.hi);
 
             // Mark the attrs as used
             for attr in &def.attrs {