about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-07-26 14:02:15 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-07-26 17:37:03 +1000
commit6e87858f26bcb9fadbd60f9e8ee24816a55faa80 (patch)
tree3db9649b27baed46e9324385c3aeb1f6e4479128 /compiler/rustc_parse/src/errors.rs
parenta560810a69a09452b4cd0c3173b6af98496dba35 (diff)
downloadrust-6e87858f26bcb9fadbd60f9e8ee24816a55faa80.tar.gz
rust-6e87858f26bcb9fadbd60f9e8ee24816a55faa80.zip
Fix a comment.
Imagine you have replace ranges (2..20,X) and (5..15,Y), and these tokens:
```
a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x
```
If we replace (5..15,Y) first, then (2..20,X) we get this sequence
```
a,b,c,d,e,Y,_,_,_,_,_,_,_,_,_,p,q,r,s,t,u,v,w,x
a,b,X,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,u,v,w,x
```
which is what we want.

If we do it in the other order, we get this:
```
a,b,X,_,_,_,_,_,_,_,_,_,_,_,_,p,q,r,s,t,u,v,w,x
a,b,X,_,_,Y,_,_,_,_,_,_,_,_,_,_,_,_,_,_,u,v,w,x
```
which is wrong. So it's true that we need the `.rev()` but the comment
is wrong about why.
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
0 files changed, 0 insertions, 0 deletions