Skip to content

Commit f0f11f3

Browse files
committed
---
yaml --- r: 144728 b: refs/heads/try2 c: 2bd628e h: refs/heads/master v: v3
1 parent 672a3d7 commit f0f11f3

File tree

237 files changed

+7193
-4975
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

237 files changed

+7193
-4975
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: ba1f663bbd988ad0c12aacaaa94d9e36b91dac81
8+
refs/heads/try2: 2bd628eafab1225cdc59c468c32868302b5e92ed
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ code_. They are defined in the same way as any other Rust function,
10381038
except that they have the `extern` modifier.
10391039

10401040
~~~
1041-
// Declares an extern fn, the ABI defaults to "C"
1041+
// Declares an extern fn, the ABI defaults to "C"
10421042
extern fn new_vec() -> ~[int] { ~[] }
10431043
10441044
// Declares an extern fn with "stdcall" ABI
@@ -1723,6 +1723,62 @@ Supported traits for `deriving` are:
17231723
each constituent field of the type must also implement `ToStr` and will have
17241724
`field.to_str()` invoked to build up the result.
17251725

1726+
### Stability
1727+
One can indicate the stability of an API using the following attributes:
1728+
1729+
* `deprecated`: This item should no longer be used, e.g. it has been
1730+
replaced. No guarantee of backwards-compatibility.
1731+
* `experimental`: This item was only recently introduced or is
1732+
otherwise in a state of flux. It may change significantly, or even
1733+
be removed. No guarantee of backwards-compatibility.
1734+
* `unstable`: This item is still under development, but requires more
1735+
testing to be considered stable. No guarantee of backwards-compatibility.
1736+
* `stable`: This item is considered stable, and will not change
1737+
significantly. Guarantee of backwards-compatibility.
1738+
* `frozen`: This item is very stable, and is unlikely to
1739+
change. Guarantee of backwards-compatibility.
1740+
* `locked`: This item will never change unless a serious bug is
1741+
found. Guarantee of backwards-compatibility.
1742+
1743+
These levels are directly inspired by
1744+
[Node.js' "stability index"](http://nodejs.org/api/documentation.html).
1745+
1746+
There are lints for disallowing items marked with certain levels:
1747+
`deprecated`, `experimental` and `unstable`; the first two will warn
1748+
by default. Items with not marked with a stability are considered to
1749+
be unstable for the purposes of the lint. One can give an optional
1750+
string that will be displayed when the lint flags the use of an item.
1751+
1752+
~~~ {.xfail-test}
1753+
#[warn(unstable)];
1754+
1755+
#[deprecated="replaced by `best`"]
1756+
fn bad() {
1757+
// delete everything
1758+
}
1759+
1760+
fn better() {
1761+
// delete fewer things
1762+
}
1763+
1764+
#[stable]
1765+
fn best() {
1766+
// delete nothing
1767+
}
1768+
1769+
fn main() {
1770+
bad(); // "warning: use of deprecated item: replaced by `best`"
1771+
1772+
better(); // "warning: use of unmarked item"
1773+
1774+
best(); // no warning
1775+
}
1776+
~~~
1777+
1778+
> **Note:** Currently these are only checked when applied to
1779+
> individual functions, structs, methods and enum variants, *not* to
1780+
> entire modules, traits, impls or enums themselves.
1781+
17261782
# Statements and expressions
17271783

17281784
Rust is _primarily_ an expression language. This means that most forms of

branches/try2/mk/rt.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ RUNTIME_CXXS_$(1)_$(2) := \
7676
rt/rust_upcall.cpp \
7777
rt/rust_uv.cpp \
7878
rt/rust_crate_map.cpp \
79-
rt/rust_log.cpp \
8079
rt/isaac/randport.cpp \
8180
rt/miniz.cpp \
8281
rt/memory_region.cpp \

branches/try2/src/compiletest/compiletest.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
extern mod extra;
1717

1818
use std::os;
19+
use std::rt;
1920
use std::f64;
2021

2122
use extra::getopts;
@@ -223,6 +224,10 @@ pub fn mode_str(mode: mode) -> ~str {
223224
pub fn run_tests(config: &config) {
224225
let opts = test_opts(config);
225226
let tests = make_tests(config);
227+
// sadly osx needs some file descriptor limits raised for running tests in
228+
// parallel (especially when we have lots and lots of child processes).
229+
// For context, see #8904
230+
rt::test::prepare_for_lots_of_tests();
226231
let res = test::run_tests_console(&opts, tests);
227232
if !res { fail!("Some tests failed"); }
228233
}
@@ -302,8 +307,9 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
302307
// Try to elide redundant long paths
303308
fn shorten(path: &Path) -> ~str {
304309
let filename = path.filename();
305-
let dir = path.pop().filename();
306-
fmt!("%s/%s", dir.unwrap_or_default(~""), filename.unwrap_or_default(~""))
310+
let p = path.pop();
311+
let dir = p.filename();
312+
fmt!("%s/%s", dir.unwrap_or_default(""), filename.unwrap_or_default(""))
307313
}
308314

309315
test::DynTestName(fmt!("[%s] %s",

branches/try2/src/compiletest/header.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
use common::config;
1212
use common;
13+
use util;
1314

1415
use std::io;
15-
use std::os;
1616

1717
pub struct TestProps {
1818
// Lines that should be expected, in order, on standard out
@@ -89,13 +89,13 @@ pub fn load_props(testfile: &Path) -> TestProps {
8989
}
9090

9191
pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
92-
fn xfail_target() -> ~str {
93-
~"xfail-" + os::SYSNAME
92+
fn xfail_target(config: &config) -> ~str {
93+
~"xfail-" + util::get_os(config.target)
9494
}
9595
9696
let val = do iter_header(testfile) |ln| {
9797
if parse_name_directive(ln, "xfail-test") { false }
98-
else if parse_name_directive(ln, xfail_target()) { false }
98+
else if parse_name_directive(ln, xfail_target(config)) { false }
9999
else if config.mode == common::mode_pretty &&
100100
parse_name_directive(ln, "xfail-pretty") { false }
101101
else { true }

branches/try2/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) {
880880
let dirs = os::list_dir_path(&Path(tstr));
881881
for file in dirs.iter() {
882882

883-
if (file.filetype() == Some(~".so")) {
883+
if (file.filetype() == Some(".so")) {
884884

885885
let copy_result = procsrv::run("", config.adb_path,
886886
[~"push", file.to_str(), config.adb_test_dir.clone()],

branches/try2/src/compiletest/util.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ use common::config;
1313
use std::io;
1414
use std::os::getenv;
1515

16+
/// Conversion table from triple OS name to Rust SYSNAME
17+
static OS_TABLE: &'static [(&'static str, &'static str)] = &[
18+
("mingw32", "win32"),
19+
("win32", "win32"),
20+
("darwin", "macos"),
21+
("android", "android"),
22+
("linux", "linux"),
23+
("freebsd", "freebsd"),
24+
];
25+
26+
pub fn get_os(triple: &str) -> &'static str {
27+
for &(triple_os, os) in OS_TABLE.iter() {
28+
if triple.contains(triple_os) {
29+
return os
30+
}
31+
}
32+
fail!("Cannot determine OS from triple");
33+
}
34+
1635
pub fn make_new_path(path: &str) -> ~str {
1736

1837
// Windows just uses PATH as the library search path, so we have to

branches/try2/src/etc/unicode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def emit_property_module(f, mod, tbl):
158158
keys.sort()
159159
emit_bsearch_range_table(f);
160160
for cat in keys:
161+
if cat == "Cs": continue
161162
f.write(" static %s_table : &'static [(char,char)] = &[\n" % cat)
162163
ix = 0
163164
for pair in tbl[cat]:

branches/try2/src/etc/vim/ftplugin/rust.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ else
2121
setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,://
2222
endif
2323
setlocal commentstring=//%s
24-
setlocal formatoptions-=t formatoptions+=croqnlj
24+
setlocal formatoptions-=t formatoptions+=croqnl
25+
" j was only added in 7.3.541, so stop complaints about its nonexistence
26+
silent! setlocal formatoptions+=j
2527

2628
" This includeexpr isn't perfect, but it's a good start
2729
setlocal includeexpr=substitute(v:fname,'::','/','g')

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

Lines changed: 86 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
" Maintainer: Patrick Walton <[email protected]>
44
" Maintainer: Ben Blum <[email protected]>
55
" Maintainer: Chris Morgan <[email protected]>
6-
" Last Change: 2013 Aug 1
6+
" Last Change: 2013 Sep 4
77

88
if version < 600
99
syntax clear
1010
elseif exists("b:current_syntax")
1111
finish
1212
endif
1313

14+
" Syntax definitions {{{1
15+
" Basic keywords {{{2
1416
syn keyword rustConditional match if else
1517
syn keyword rustOperator as
1618

@@ -32,47 +34,90 @@ syn keyword rustStorage const mut ref static
3234
syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
3335
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
3436

35-
" reserved
37+
" Reserved (but not yet used) keywords {{{2
3638
syn keyword rustKeyword be yield typeof
3739

40+
" Built-in types {{{2
3841
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32
3942
syn keyword rustType f64 i8 i16 i32 i64 str Self
40-
syn keyword rustType Option Either
41-
42-
" Types from libc
43-
syn keyword rustType c_float c_double c_void FILE fpos_t
44-
syn keyword rustType DIR dirent
45-
syn keyword rustType c_char c_schar c_uchar
46-
syn keyword rustType c_short c_ushort c_int c_uint c_long c_ulong
47-
syn keyword rustType size_t ptrdiff_t clock_t time_t
48-
syn keyword rustType c_longlong c_ulonglong intptr_t uintptr_t
49-
syn keyword rustType off_t dev_t ino_t pid_t mode_t ssize_t
50-
51-
syn keyword rustTrait Const Copy Send Owned Sized " inherent traits
52-
syn keyword rustTrait Clone Decodable Encodable IterBytes Rand ToStr
53-
syn keyword rustTrait Eq Ord TotalEq TotalOrd Num Ptr
54-
syn keyword rustTrait Drop Add Sub Mul Quot Rem Neg BitAnd BitOr
55-
syn keyword rustTrait BitXor Shl Shr Index
43+
44+
" Things from the prelude (src/libstd/prelude.rs) {{{2
45+
" This section is just straight transformation of the contents of the prelude,
46+
" to make it easy to update.
47+
48+
" Core operators {{{3
49+
syn keyword rustEnum Either
50+
syn keyword rustEnumVariant Left Right
51+
syn keyword rustTrait Sized
52+
syn keyword rustTrait Freeze Send
53+
syn keyword rustTrait Add Sub Mul Div Rem Neg Not
54+
syn keyword rustTrait BitAnd BitOr BitXor
55+
syn keyword rustTrait Drop
56+
syn keyword rustTrait Shl Shr Index
57+
syn keyword rustEnum Option
58+
syn keyword rustEnumVariant Some None
59+
syn keyword rustEnum Result
60+
syn keyword rustEnumVariant Ok Err
61+
62+
" Functions {{{3
63+
"syn keyword rustFunction print println
64+
"syn keyword rustFunction range
65+
66+
" Types and traits {{{3
67+
syn keyword rustTrait ToCStr
68+
syn keyword rustTrait Clone DeepClone
69+
syn keyword rustTrait Eq ApproxEq Ord TotalEq TotalOrd Ordering Equiv
70+
syn keyword rustEnumVariant Less Equal Greater
71+
syn keyword rustTrait Char
72+
syn keyword rustTrait Container Mutable Map MutableMap Set MutableSet
73+
syn keyword rustTrait Hash
74+
syn keyword rustTrait Times
75+
syn keyword rustTrait FromIterator Extendable
76+
syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator ClonableIterator
77+
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize
78+
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul
79+
syn keyword rustTrait Orderable Signed Unsigned Round
80+
syn keyword rustTrait Algebraic Trigonometric Exponential Hyperbolic
81+
syn keyword rustTrait Integer Fractional Real RealExt
82+
syn keyword rustTrait Bitwise BitCount Bounded
83+
syn keyword rustTrait Primitive Int Float ToStrRadix
84+
syn keyword rustTrait GenericPath
85+
syn keyword rustTrait Path
86+
syn keyword rustTrait PosixPath
87+
syn keyword rustTrait WindowsPath
88+
syn keyword rustTrait RawPtr
89+
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr ToBytesConsume
90+
syn keyword rustTrait Str StrVector StrSlice OwnedStr
91+
syn keyword rustTrait FromStr
92+
syn keyword rustTrait IterBytes
93+
syn keyword rustTrait ToStr ToStrConsume
94+
syn keyword rustTrait CopyableTuple ImmutableTuple
95+
syn keyword rustTrait CloneableTuple1 ImmutableTuple1
96+
syn keyword rustTrait CloneableTuple2 CloneableTuple3 CloneableTuple4 CloneableTuple5
97+
syn keyword rustTrait CloneableTuple6 CloneableTuple7 CloneableTuple8 CloneableTuple9
98+
syn keyword rustTrait CloneableTuple10 CloneableTuple11 CloneableTuple12
99+
syn keyword rustTrait ImmutableTuple2 ImmutableTuple3 ImmutableTuple4 ImmutableTuple5
100+
syn keyword rustTrait ImmutableTuple6 ImmutableTuple7 ImmutableTuple8 ImmutableTuple9
101+
syn keyword rustTrait ImmutableTuple10 ImmutableTuple11 ImmutableTuple12
102+
syn keyword rustTrait Vector VectorVector CopyableVector ImmutableVector
103+
syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector ImmutableCopyableVector
104+
syn keyword rustTrait OwnedVector OwnedCopyableVector OwnedEqVector MutableVector
105+
syn keyword rustTrait Reader ReaderUtil Writer WriterUtil
106+
syn keyword rustTrait Default
107+
108+
"syn keyword rustFunction stream
109+
syn keyword rustTrait Port Chan GenericChan GenericSmartChan GenericPort Peekable
110+
"syn keyword rustFunction spawn
56111

57112
syn keyword rustSelf self
58113
syn keyword rustBoolean true false
59114

60115
syn keyword rustConstant Some None " option
61116
syn keyword rustConstant Left Right " either
62117
syn keyword rustConstant Ok Err " result
63-
syn keyword rustConstant Success Failure " task
64-
syn keyword rustConstant Cons Nil " list
65-
" syn keyword rustConstant empty node " tree
66-
67-
" Constants from libc
68-
syn keyword rustConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
69-
syn keyword rustConstant EOF SEEK_SET SEEK_CUR SEEK_END _IOFBF _IONBF
70-
syn keyword rustConstant _IOLBF BUFSIZ FOPEN_MAX FILENAME_MAX L_tmpnam
71-
syn keyword rustConstant TMP_MAX O_RDONLY O_WRONLY O_RDWR O_APPEND O_CREAT
72-
syn keyword rustConstant O_EXCL O_TRUNC S_IFIFO S_IFCHR S_IFBLK S_IFDIR
73-
syn keyword rustConstant S_IFREG S_IFMT S_IEXEC S_IWRITE S_IREAD S_IRWXU
74-
syn keyword rustConstant S_IXUSR S_IWUSR S_IRUSR F_OK R_OK W_OK X_OK
75-
syn keyword rustConstant STDIN_FILENO STDOUT_FILENO STDERR_FILENO
118+
syn keyword rustConstant Less Equal Greater " Ordering
119+
120+
" Other syntax {{{2
76121

77122
" If foo::bar changes to foo.bar, change this ("::" to "\.").
78123
" If foo::bar changes to Foo::bar, change this (first "\w" to "\u").
@@ -102,7 +147,8 @@ syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
102147
syn match rustFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained
103148
syn match rustFormat display "%%" contained
104149
syn match rustSpecial display contained /\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
105-
syn region rustString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial
150+
syn match rustStringContinuation display contained /\\\n\s*/
151+
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation
106152

107153
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
108154
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
@@ -137,18 +183,20 @@ syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit
137183
syn match rustCharacter /'\([^'\\]\|\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial
138184

139185
syn region rustCommentML start="/\*" end="\*/" contains=rustTodo
140-
syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo keepend
186+
syn region rustComment start="//" end="$" contains=rustTodo keepend
141187
syn region rustCommentMLDoc start="/\*\%(!\|\*/\@!\)" end="\*/" contains=rustTodo
142-
syn region rustCommentDoc start="//[/!]" skip="\\$" end="$" contains=rustTodo keepend
188+
syn region rustCommentDoc start="//[/!]" end="$" contains=rustTodo keepend
143189

144190
syn keyword rustTodo contained TODO FIXME XXX NB NOTE
145191

192+
" Folding rules {{{2
146193
" Trivial folding rules to begin with.
147194
" TODO: use the AST to make really good folding
148195
syn region rustFoldBraces start="{" end="}" transparent fold
149196
" If you wish to enable this, setlocal foldmethod=syntax
150197
" It's not enabled by default as it would drive some people mad.
151198

199+
" Default highlighting {{{1
152200
hi def link rustHexNumber rustNumber
153201
hi def link rustBinNumber rustNumber
154202
hi def link rustIdentifierPrime rustIdentifier
@@ -157,10 +205,13 @@ hi def link rustTrait rustType
157205
hi def link rustSigil StorageClass
158206
hi def link rustFormat Special
159207
hi def link rustSpecial Special
208+
hi def link rustStringContinuation Special
160209
hi def link rustString String
161210
hi def link rustCharacter Character
162211
hi def link rustNumber Number
163212
hi def link rustBoolean Boolean
213+
hi def link rustEnum rustType
214+
hi def link rustEnumVariant rustConstant
164215
hi def link rustConstant Constant
165216
hi def link rustSelf Constant
166217
hi def link rustFloat Float
@@ -171,6 +222,7 @@ hi def link rustIdentifier Identifier
171222
hi def link rustCapsIdent rustIdentifier
172223
hi def link rustModPath Include
173224
hi def link rustModPathSep Delimiter
225+
hi def link rustFunction Function
174226
hi def link rustFuncName Function
175227
hi def link rustFuncCall Function
176228
hi def link rustCommentMLDoc rustCommentDoc

0 commit comments

Comments
 (0)