Skip to content

Commit 11edd91

Browse files
committed
---
yaml --- r: 92087 b: refs/heads/auto c: 9169579 h: refs/heads/master i: 92085: ad8a0ff 92083: 96b6868 92079: c7a32fd v: v3
1 parent 0a0dfc3 commit 11edd91

File tree

19 files changed

+126
-73
lines changed

19 files changed

+126
-73
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 0cd79ee18aa38339147516413679f6fdaf01ca1a
16+
refs/heads/auto: 91695797c2ff36017edc47af270ca665f2f4d1ef
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/etc/vim/syntax/rust.vim

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: Patrick Walton <[email protected]>
44
" Maintainer: Ben Blum <[email protected]>
55
" Maintainer: Chris Morgan <[email protected]>
6-
" Last Change: 2013 Oct 29
6+
" Last Change: 2013 Dec 04
77

88
if version < 600
99
syntax clear
@@ -28,6 +28,7 @@ syn keyword rustKeyword use nextgroup=rustModPath skipwhite
2828
" FIXME: Scoped impl's name is also fallen in this category
2929
syn keyword rustKeyword mod trait struct enum type nextgroup=rustIdentifier skipwhite
3030
syn keyword rustKeyword fn nextgroup=rustFuncName skipwhite
31+
syn keyword rustKeyword proc
3132
syn keyword rustStorage const mut ref static
3233

3334
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
@@ -89,6 +90,7 @@ syn keyword rustTrait Orderable Signed Unsigned Round
8990
syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive
9091
syn keyword rustTrait GenericPath Path PosixPath WindowsPath
9192
syn keyword rustTrait RawPtr
93+
syn keyword rustTrait Buffer Writer Reader Seek
9294
syn keyword rustTrait SendStr SendStrOwned SendStrStatic IntoSendStr
9395
syn keyword rustTrait Str StrVector StrSlice OwnedStr
9496
syn keyword rustTrait IterBytes
@@ -143,38 +145,29 @@ syn match rustOperator display "&&\|||"
143145
syn match rustMacro '\w\(\w\)*!' contains=rustAssert,rustFail
144146
syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
145147

146-
syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained
147-
syn match rustFormat display "%%" contained
148+
syn match rustSpecialError display contained /\\./
148149
syn match rustSpecial display contained /\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
149150
syn match rustStringContinuation display contained /\\\n\s*/
150-
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation
151+
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation
151152
syn region rustString start='r\z(#*\)"' end='"\z1'
152153

153154
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
154155
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
155156

156157
" Number literals
157-
syn match rustNumber display "\<[0-9][0-9_]*\>"
158-
syn match rustNumber display "\<[0-9][0-9_]*\(u\|u8\|u16\|u32\|u64\)\>"
159-
syn match rustNumber display "\<[0-9][0-9_]*\(i\|i8\|i16\|i32\|i64\)\>"
160-
161-
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\>"
162-
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(u\|u8\|u16\|u32\|u64\)\>"
163-
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\(i8\|i16\|i32\|i64\)\>"
164-
syn match rustOctNumber display "\<0o[0-7_]\+\>"
165-
syn match rustOctNumber display "\<0o[0-7_]\+\(u\|u8\|u16\|u32\|u64\)\>"
166-
syn match rustOctNumber display "\<0o[0-7_]\+\(i8\|i16\|i32\|i64\)\>"
167-
syn match rustBinNumber display "\<0b[01_]\+\>"
168-
syn match rustBinNumber display "\<0b[01_]\+\(u\|u8\|u16\|u32\|u64\)\>"
169-
syn match rustBinNumber display "\<0b[01_]\+\(i8\|i16\|i32\|i64\)\>"
170-
171-
syn match rustFloat display "\<[0-9][0-9_]*\(f\|f32\|f64\)\>"
172-
syn match rustFloat display "\<[0-9][0-9_]*\([eE][+-]\=[0-9_]\+\)\>"
173-
syn match rustFloat display "\<[0-9][0-9_]*\([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"
174-
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\>"
175-
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\(f\|f32\|f64\)\>"
176-
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\>"
177-
syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>"
158+
syn match rustDecNumber display "\<[0-9][0-9_]*\%([iu]\%(8\|16\|32\|64\)\=\)\="
159+
syn match rustHexNumber display "\<0x[a-fA-F0-9_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\="
160+
syn match rustOctNumber display "\<0o[0-7_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\="
161+
syn match rustBinNumber display "\<0b[01_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\="
162+
163+
" To mark it as a float, it must have at least one of the three things integral values don't have:
164+
" a decimal point and more numbers; an exponent; and a type suffix.
165+
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\="
166+
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\="
167+
syn match rustFloat display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)"
168+
" Special case for numbers of the form "1." which are float literals, unless followed by
169+
" an identifier, which makes them integer literals with a method call or field access.
170+
syn match rustFloat display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\@!"
178171

179172
" For the benefit of delimitMate
180173
syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime
@@ -183,12 +176,24 @@ syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[
183176

184177
"rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting
185178
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
186-
syn match rustCharacter /'\([^'\\]\|\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial
187-
188-
syn region rustCommentML start="/\*" end="\*/" contains=rustTodo
189-
syn region rustComment start="//" end="$" contains=rustTodo keepend
190-
syn region rustCommentMLDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo
191-
syn region rustCommentDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo keepend
179+
syn match rustCharacter /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError
180+
181+
syn cluster rustComment contains=rustCommentLine,rustCommentLineDoc,rustCommentBlock,rustCommentBlockDoc
182+
syn region rustCommentLine start="//" end="$" contains=rustTodo
183+
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo
184+
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment keepend extend
185+
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment keepend extend
186+
" FIXME: this is a really ugly and not fully correct implementation. Most
187+
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
188+
" a comment, but in practice at present it leaves comments open two levels
189+
" deep. But as long as you stay away from that particular case, I *believe*
190+
" the highlighting is correct. Due to the way Vim's syntax engine works
191+
" (greedy for start matches, unlike Rust's tokeniser which is searching for
192+
" the earliest-starting match, start or end), I believe this cannot be solved.
193+
" Oh you who would fix it, don't bother with things like duplicating the Block
194+
" rules and putting ``\*\@<!`` at the start of them; it makes it worse, as
195+
" then you must deal with cases like ``/*/**/*/``. And don't try making it
196+
" worse with ``\%(/\@<!\*\)\@<!``, either...
192197

193198
syn keyword rustTodo contained TODO FIXME XXX NB NOTE
194199

@@ -200,15 +205,16 @@ syn region rustFoldBraces start="{" end="}" transparent fold
200205
" It's not enabled by default as it would drive some people mad.
201206

202207
" Default highlighting {{{1
208+
hi def link rustDecNumber rustNumber
203209
hi def link rustHexNumber rustNumber
204210
hi def link rustOctNumber rustNumber
205211
hi def link rustBinNumber rustNumber
206212
hi def link rustIdentifierPrime rustIdentifier
207213
hi def link rustTrait rustType
208214

209215
hi def link rustSigil StorageClass
210-
hi def link rustFormat Special
211216
hi def link rustSpecial Special
217+
hi def link rustSpecialError Error
212218
hi def link rustStringContinuation Special
213219
hi def link rustString String
214220
hi def link rustCharacter Character
@@ -229,10 +235,10 @@ hi def link rustModPathSep Delimiter
229235
hi def link rustFunction Function
230236
hi def link rustFuncName Function
231237
hi def link rustFuncCall Function
232-
hi def link rustCommentMLDoc rustCommentDoc
233-
hi def link rustCommentDoc SpecialComment
234-
hi def link rustCommentML rustComment
235-
hi def link rustComment Comment
238+
hi def link rustCommentLine Comment
239+
hi def link rustCommentLineDoc SpecialComment
240+
hi def link rustCommentBlock rustCommentLine
241+
hi def link rustCommentBlockDoc rustCommentLineDoc
236242
hi def link rustAssert PreCondit
237243
hi def link rustFail PreCondit
238244
hi def link rustMacro Macro

branches/auto/src/libextra/url.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,51 @@ use std::hashmap::HashMap;
1919
use std::to_bytes;
2020
use std::uint;
2121

22+
/// A Uniform Resource Locator (URL). A URL is a form of URI (Uniform Resource
23+
/// Identifier) that includes network location information, such as hostname or
24+
/// port number.
25+
///
26+
/// # Example
27+
///
28+
/// ```rust
29+
/// let url = Url { scheme: ~"https",
30+
/// user: Some(UserInfo { user: ~"username", pass: None }),
31+
/// host: ~"example.com",
32+
/// port: Some(~"8080"),
33+
/// path: ~"/foo/bar",
34+
/// query: ~[(~"baz", ~"qux")],
35+
/// fragment: Some(~"quz") };
36+
/// // https://[email protected]:8080/foo/bar?baz=qux#quz
37+
/// ```
2238
#[deriving(Clone, Eq)]
2339
pub struct Url {
40+
/// The scheme part of a URL, such as `https` in the above example.
2441
scheme: ~str,
42+
/// A URL subcomponent for user authentication. `username` in the above example.
2543
user: Option<UserInfo>,
44+
/// A domain name or IP address. For example, `example.com`.
2645
host: ~str,
46+
/// A TCP port number, for example `8080`.
2747
port: Option<~str>,
48+
/// The path component of a URL, for example `/foo/bar`.
2849
path: ~str,
50+
/// The query component of a URL. `~[(~"baz", ~"qux")]` represents the
51+
/// fragment `baz=qux` in the above example.
2952
query: Query,
53+
/// The fragment component, such as `quz`. Doesn't include the leading `#` character.
3054
fragment: Option<~str>
3155
}
3256

57+
/// An optional subcomponent of a URI authority component.
3358
#[deriving(Clone, Eq)]
3459
pub struct UserInfo {
60+
/// The user name.
3561
user: ~str,
62+
/// Password or other scheme-specific authentication information.
3663
pass: Option<~str>
3764
}
3865

66+
/// Represents the query component of a URI.
3967
pub type Query = ~[(~str, ~str)];
4068

4169
impl Url {

branches/auto/src/librustc/back/archive.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,25 @@ impl Archive {
119119
}
120120

121121
fn find_library(&self, name: &str) -> Path {
122-
let (prefix, ext) = match self.sess.targ_cfg.os {
122+
let (osprefix, osext) = match self.sess.targ_cfg.os {
123123
abi::OsWin32 => ("", "lib"), _ => ("lib", "a"),
124124
};
125-
let libname = format!("{}{}.{}", prefix, name, ext);
125+
// On windows, static libraries sometimes show up as libfoo.a and other
126+
// times show up as foo.lib
127+
let oslibname = format!("{}{}.{}", osprefix, name, osext);
128+
let unixlibname = format!("lib{}.a", name);
126129

127130
let mut rustpath = filesearch::rust_path();
128131
rustpath.push(self.sess.filesearch.get_target_lib_path());
129132
let path = self.sess.opts.addl_lib_search_paths.iter();
130133
for path in path.chain(rustpath.iter()) {
131134
debug!("looking for {} inside {}", name, path.display());
132-
let test = path.join(libname.clone());
135+
let test = path.join(oslibname.as_slice());
133136
if test.exists() { return test }
137+
if oslibname != unixlibname {
138+
let test = path.join(unixlibname.as_slice());
139+
if test.exists() { return test }
140+
}
134141
}
135142
self.sess.fatal(format!("could not find native static library `{}`, \
136143
perhaps an -L flag is missing?", name));

branches/auto/src/librustc/middle/typeck/check/_match.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,24 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
294294
etc: bool) {
295295
let tcx = pcx.fcx.ccx.tcx;
296296
297-
// Index the class fields.
297+
// Index the class fields. The second argument in the tuple is whether the
298+
// field has been bound yet or not.
298299
let mut field_map = HashMap::new();
299300
for (i, class_field) in class_fields.iter().enumerate() {
300-
field_map.insert(class_field.name, i);
301+
field_map.insert(class_field.name, (i, false));
301302
}
302303
303304
// Typecheck each field.
304305
let mut found_fields = HashSet::new();
305306
for field in fields.iter() {
306-
match field_map.find(&field.ident.name) {
307-
Some(&index) => {
307+
match field_map.find_mut(&field.ident.name) {
308+
Some(&(_, true)) => {
309+
tcx.sess.span_err(span,
310+
format!("field `{}` bound twice in pattern",
311+
tcx.sess.str_of(field.ident)));
312+
}
313+
Some(&(index, ref mut used)) => {
314+
*used = true;
308315
let class_field = class_fields[index];
309316
let field_type = ty::lookup_field_type(tcx,
310317
class_id,

branches/auto/src/librustuv/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ impl RtioTimer for TimerWatcher {
7777
let _missile = match util::replace(&mut self.action, None) {
7878
None => missile, // no need to do a homing dance
7979
Some(action) => {
80-
util::ignore(missile); // un-home ourself
81-
util::ignore(action); // destroy the previous action
80+
drop(missile); // un-home ourself
81+
drop(action); // destroy the previous action
8282
self.fire_homing_missile() // re-home ourself
8383
}
8484
};

branches/auto/src/librustuv/uvio.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use std::libc::{O_CREAT, O_APPEND, O_TRUNC, O_RDWR, O_RDONLY, O_WRONLY,
2626
use std::io::{FileMode, FileAccess, Open, Append, Truncate, Read, Write,
2727
ReadWrite, FileStat};
2828
use std::io::signal::Signum;
29-
use std::util;
3029
use ai = std::io::net::addrinfo;
3130

3231
#[cfg(test)] use std::unstable::run_in_bare_thread;
@@ -104,7 +103,7 @@ impl HomingMissile {
104103

105104
impl Drop for HomingMissile {
106105
fn drop(&mut self) {
107-
let f = ForbidUnwind::new("leaving home");
106+
let _f = ForbidUnwind::new("leaving home");
108107

109108
// It would truly be a sad day if we had moved off the home I/O
110109
// scheduler while we were doing I/O.
@@ -120,8 +119,6 @@ impl Drop for HomingMissile {
120119
});
121120
})
122121
}
123-
124-
util::ignore(f);
125122
}
126123
}
127124

branches/auto/src/libstd/io/fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ mod test {
11791179
file.write(bytes!("foo"));
11801180
file.fsync();
11811181
file.datasync();
1182-
util::ignore(file);
1182+
drop(file);
11831183
})
11841184

11851185
test!(fn truncate_works() {
@@ -1210,7 +1210,7 @@ mod test {
12101210
assert_eq!(stat(&path).size, 9);
12111211
assert_eq!(File::open(&path).read_to_end(),
12121212
(bytes!("fo", 0, 0, 0, 0, "wut")).to_owned());
1213-
util::ignore(file);
1213+
drop(file);
12141214
})
12151215

12161216
test!(fn open_flavors() {

branches/auto/src/libstd/prelude.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,7 @@ pub use vec::{Vector, VectorVector, CopyableVector, ImmutableVector};
8686
// Reexported runtime types
8787
pub use comm::{stream, Port, Chan, GenericChan, GenericSmartChan, GenericPort, Peekable};
8888
pub use task::spawn;
89+
90+
/// Disposes of a value.
91+
#[inline]
92+
pub fn drop<T>(_x: T) { }

branches/auto/src/libstd/rt/sched.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,6 @@ mod test {
11731173
use rt::sleeper_list::SleeperList;
11741174
use rt::stack::StackPool;
11751175
use rt::sched::{Shutdown, TaskFromFriend};
1176-
use util;
11771176

11781177
do run_in_bare_thread {
11791178
stress_factor().times(|| {
@@ -1205,7 +1204,7 @@ mod test {
12051204
handle.send(TaskFromFriend(task));
12061205

12071206
handle.send(Shutdown);
1208-
util::ignore(handle);
1207+
drop(handle);
12091208

12101209
thread.join();
12111210
})

branches/auto/src/libstd/unstable/sync.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,6 @@ mod tests {
467467
use prelude::*;
468468
use super::{Exclusive, UnsafeArc, atomically};
469469
use task;
470-
use util;
471470
use mem::size_of;
472471

473472
//#[unsafe_no_drop_flag] FIXME: #9758
@@ -571,7 +570,7 @@ mod tests {
571570
let x2 = x.clone();
572571
let left_x = x.try_unwrap();
573572
assert!(left_x.is_self());
574-
util::ignore(left_x);
573+
drop(left_x);
575574
assert!(x2.try_unwrap().expect_t("try_unwrap none") == ~~"hello");
576575
}
577576
@@ -590,7 +589,7 @@ mod tests {
590589
task::deschedule(); // Try to make the unwrapper get blocked first.
591590
let left_x = x.try_unwrap();
592591
assert!(left_x.is_self());
593-
util::ignore(left_x);
592+
drop(left_x);
594593
p.recv();
595594
}
596595
@@ -620,7 +619,7 @@ mod tests {
620619
assert!(x2.unwrap() == ~~"hello");
621620
}
622621
// Have to get rid of our reference before blocking.
623-
util::ignore(x);
622+
drop(x);
624623
res.recv();
625624
}
626625

branches/auto/src/libstd/util.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ use unstable::intrinsics;
1919
#[inline]
2020
pub fn id<T>(x: T) -> T { x }
2121

22-
/// Ignores a value.
23-
#[inline]
24-
pub fn ignore<T>(_x: T) { }
25-
2622
/**
2723
* Swap the values at two mutable locations of the same type, without
2824
* deinitialising or copying either one.

0 commit comments

Comments
 (0)