Skip to content

Commit 9778e13

Browse files
committed
---
yaml --- r: 20791 b: refs/heads/snap-stage3 c: 37d7c9d h: refs/heads/master i: 20789: 270873e 20787: ab67a98 20783: 235d1a7 v: v3
1 parent eff7f56 commit 9778e13

File tree

4 files changed

+48
-41
lines changed

4 files changed

+48
-41
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 71927615e0a2cd2d9f96038ba0f403a4d833a2f5
4+
refs/heads/snap-stage3: 37d7c9d1c3696ef4d6eb6680e3b682dcd033beaf
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
if exists('g:no_rust_conceal') || !has('conceal') || &enc != 'utf-8'
2+
finish
3+
endif
4+
5+
" For those who don't want to see `::`...
6+
if exists('g:rust_conceal_mod_path')
7+
syn match rustNiceOperator "::" conceal cchar=
8+
endif
9+
10+
syn match rustLeftArrowHead contained "-" conceal cchar= 
11+
syn match rustLeftArrowTail contained "<" conceal cchar=
12+
syn match rustNiceOperator "<-" contains=rustLeftArrowHead,rustLeftArrowTail
13+
14+
syn match rustRightArrowHead contained ">" conceal cchar= 
15+
syn match rustRightArrowTail contained "-" conceal cchar=
16+
syn match rustNiceOperator "->" contains=rustRightArrowHead,rustRightArrowTail
17+
18+
syn match rustFatRightArrowHead contained ">" conceal cchar= 
19+
syn match rustFatRightArrowTail contained "=" conceal cchar=
20+
syn match rustNiceOperator "=>" contains=rustFatRightArrowHead,rustFatRightArrowTail
21+
22+
syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar=
23+
24+
hi link rustNiceOperator Operator
25+
hi! link Conceal Operator
26+
setlocal conceallevel=2

branches/snap-stage3/src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,6 @@ syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo ke
103103

104104
syn keyword rustTodo TODO FIXME XXX NB
105105

106-
" For those who don't want to see `::`...
107-
syn match rustModPathSep "::" conceal cchar=
108-
109-
syn match rustArrowHead contained ">" conceal cchar= 
110-
syn match rustArrowTail contained "-" conceal cchar=
111-
syn match rustArrowFull "->" contains=rustArrowHead,rustArrowTail
112-
113-
syn match rustFatArrowHead contained ">" conceal cchar= 
114-
syn match rustFatArrowTail contained "=" conceal cchar=
115-
syn match rustFatArrowFull "=>" contains=rustFatArrowHead,rustFatArrowTail
116-
117-
syn match rustIdentifierPrime /\<\@!_\(_*\>\)\@=/ conceal cchar=
118-
119106
hi def link rustHexNumber rustNumber
120107
hi def link rustBinNumber rustNumber
121108
hi def link rustIdentifierPrime rustIdentifier
@@ -136,7 +123,7 @@ hi def link rustMacro Macro
136123
hi def link rustType Type
137124
hi def link rustTodo Todo
138125
hi def link rustAttribute PreProc
139-
hi def link rustModPathSep Conceal
126+
140127
" Other Suggestions:
141128
" hi rustAssert ctermfg=yellow
142129
" hi rustMacro ctermfg=magenta

branches/snap-stage3/src/libcore/vec.rs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ pure fn from_fn<T>(n_elts: uint, op: init_op<T>) -> ~[T] {
189189
let mut v = ~[];
190190
unchecked{reserve(v, n_elts);}
191191
let mut i: uint = 0u;
192-
while i < n_elts unsafe { unsafe::set(v, i, op(i)); i += 1u; }
192+
while i < n_elts unsafe { ref_set(v, i, op(i)); i += 1u; }
193193
unsafe { unsafe::set_len(v, n_elts); }
194194
ret v;
195195
}
@@ -204,8 +204,8 @@ pure fn from_elem<T: copy>(n_elts: uint, t: T) -> ~[T] {
204204
let mut v = ~[];
205205
unchecked{reserve(v, n_elts)}
206206
let mut i: uint = 0u;
207-
unsafe { // because unsafe::set is unsafe
208-
while i < n_elts { unsafe::set(v, i, t); i += 1u; }
207+
unsafe { // because ref_set is unsafe
208+
while i < n_elts { ref_set(v, i, t); i += 1u; }
209209
unsafe { unsafe::set_len(v, n_elts); }
210210
}
211211
ret v;
@@ -534,12 +534,28 @@ fn push_slow<T>(&v: ~[const T], +initval: T) {
534534
unsafe { push_fast(v, initval) }
535535
}
536536

537+
// Unchecked vector indexing
538+
#[inline(always)]
539+
unsafe fn get_ref<T: copy>(v: &[const T], i: uint) -> T {
540+
as_buf(v, |p, _len| *ptr::offset(p, i))
541+
}
542+
543+
#[inline(always)]
544+
unsafe fn ref_set<T>(v: &[mut T], i: uint, +val: T) {
545+
let mut box = some(val);
546+
do as_mut_buf(v) |p, _len| {
547+
let mut box2 = none;
548+
box2 <-> box;
549+
rusti::move_val_init(*ptr::mut_offset(p, i), option::unwrap(box2));
550+
}
551+
}
552+
537553
#[inline(always)]
538554
fn push_all<T: copy>(&v: ~[const T], rhs: &[const T]) {
539555
reserve(v, v.len() + rhs.len());
540556

541557
for uint::range(0u, rhs.len()) |i| {
542-
push(v, unsafe { unsafe::get(rhs, i) })
558+
push(v, unsafe { get_ref(rhs, i) })
543559
}
544560
}
545561

@@ -1595,28 +1611,6 @@ mod unsafe {
15951611
f(*v)
15961612
}
15971613

1598-
/**
1599-
* Unchecked vector indexing.
1600-
*/
1601-
#[inline(always)]
1602-
unsafe fn get<T: copy>(v: &[const T], i: uint) -> T {
1603-
as_buf(v, |p, _len| *ptr::offset(p, i))
1604-
}
1605-
1606-
/**
1607-
* Unchecked vector index assignment.
1608-
*/
1609-
#[inline(always)]
1610-
unsafe fn set<T>(v: &[mut T], i: uint, +val: T) {
1611-
let mut box = some(val);
1612-
do as_mut_buf(v) |p, _len| {
1613-
let mut box2 = none;
1614-
box2 <-> box;
1615-
rusti::move_val_init(*ptr::mut_offset(p, i),
1616-
option::unwrap(box2));
1617-
}
1618-
}
1619-
16201614
/**
16211615
* Copies data from one vector to another.
16221616
*

0 commit comments

Comments
 (0)