Skip to content

Commit 63b5bf4

Browse files
committed
---
yaml --- r: 146909 b: refs/heads/try2 c: 68e3292 h: refs/heads/master i: 146907: 5841369 v: v3
1 parent 514d04c commit 63b5bf4

Some content is hidden

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

41 files changed

+2183
-1222
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: 26ba64dca9486a910a6e191d27841ebff800928c
8+
refs/heads/try2: 68e3292fd79230f00745dc7608f4d80329c776bb
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: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,19 @@ Some productions are defined by exclusion of particular Unicode characters:
153153
~~~~ {.ebnf .gram}
154154
comment : block_comment | line_comment ;
155155
block_comment : "/*" block_comment_body * '*' + '/' ;
156-
block_comment_body : non_star * | '*' + non_slash_or_star ;
156+
block_comment_body : (block_comment | character) * ;
157157
line_comment : "//" non_eol * ;
158158
~~~~
159159

160160
Comments in Rust code follow the general C++ style of line and block-comment forms,
161161
with no nesting of block-comment delimiters.
162162

163-
Line comments beginning with _three_ slashes (`///`),
164-
and block comments beginning with a repeated asterisk in the block-open sequence (`/**`),
165-
are interpreted as a special syntax for `doc` [attributes](#attributes).
166-
That is, they are equivalent to writing `#[doc "..."]` around the comment's text.
163+
Line comments beginning with exactly _three_ slashes (`///`), and block
164+
comments beginning with a exactly one repeated asterisk in the block-open
165+
sequence (`/**`), are interpreted as a special syntax for `doc`
166+
[attributes](#attributes). That is, they are equivalent to writing
167+
`#[doc="..."]` around the body of the comment (this includes the comment
168+
characters themselves, ie `/// Foo` turns into `#[doc="/// Foo"]`).
167169

168170
Non-doc comments are interpreted as a form of whitespace.
169171

branches/try2/src/etc/unicode.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# code covering the core properties. Since this is a pretty rare event we
66
# just store this out-of-line and check the unicode.rs file into git.
77
#
8-
# The emitted code is "the minimum we think is necessary for libcore", that
8+
# The emitted code is "the minimum we think is necessary for libstd", that
99
# is, to support basic operations of the compiler and "most nontrivial rust
1010
# programs". It is not meant to be a complete implementation of unicode.
1111
# For that we recommend you use a proper binding to libicu.
@@ -41,7 +41,7 @@ def load_unicode_data(f):
4141
continue
4242
[code, name, gencat, combine, bidi,
4343
decomp, deci, digit, num, mirror,
44-
old, iso, upcase, lowcsae, titlecase ] = fields
44+
old, iso, upcase, lowcase, titlecase ] = fields
4545

4646
code = int(code, 16)
4747

@@ -89,11 +89,9 @@ def load_unicode_data(f):
8989

9090
return (canon_decomp, compat_decomp, gencats, combines)
9191

92-
93-
def load_derived_core_properties(f):
92+
def load_properties(f, interestingprops):
9493
fetch(f)
95-
derivedprops = {}
96-
interestingprops = ["XID_Start", "XID_Continue", "Alphabetic"]
94+
props = {}
9795
re1 = re.compile("^([0-9A-F]+) +; (\w+)")
9896
re2 = re.compile("^([0-9A-F]+)\.\.([0-9A-F]+) +; (\w+)")
9997

@@ -118,10 +116,10 @@ def load_derived_core_properties(f):
118116
continue
119117
d_lo = int(d_lo, 16)
120118
d_hi = int(d_hi, 16)
121-
if prop not in derivedprops:
122-
derivedprops[prop] = []
123-
derivedprops[prop].append((d_lo, d_hi))
124-
return derivedprops
119+
if prop not in props:
120+
props[prop] = []
121+
props[prop].append((d_lo, d_hi))
122+
return props
125123

126124
def escape_char(c):
127125
if c <= 0xff:
@@ -144,7 +142,7 @@ def emit_bsearch_range_table(f):
144142
use cmp::{Equal, Less, Greater};
145143
use vec::ImmutableVector;
146144
use option::None;
147-
(do r.bsearch |&(lo,hi)| {
145+
r.bsearch(|&(lo,hi)| {
148146
if lo <= c && c <= hi { Equal }
149147
else if hi < c { Less }
150148
else { Greater }
@@ -302,14 +300,14 @@ def emit_decomp_module(f, canon, compat, combine):
302300
ix += 1
303301
f.write("\n ];\n")
304302

305-
f.write(" pub fn canonical(c: char, i: &fn(char)) "
303+
f.write(" pub fn canonical(c: char, i: |char|) "
306304
+ "{ d(c, i, false); }\n\n")
307-
f.write(" pub fn compatibility(c: char, i: &fn(char)) "
305+
f.write(" pub fn compatibility(c: char, i: |char|) "
308306
+"{ d(c, i, true); }\n\n")
309307
f.write(" pub fn canonical_combining_class(c: char) -> u8 {\n"
310308
+ " bsearch_range_value_table(c, combining_class_table)\n"
311309
+ " }\n\n")
312-
f.write(" fn d(c: char, i: &fn(char), k: bool) {\n")
310+
f.write(" fn d(c: char, i: |char|, k: bool) {\n")
313311
f.write(" use iter::Iterator;\n");
314312

315313
f.write(" if c <= '\\x7f' { i(c); return; }\n")
@@ -376,5 +374,9 @@ def emit_decomp_module(f, canon, compat, combine):
376374

377375
emit_decomp_module(rf, canon_decomp, compat_decomp, combines)
378376

379-
derived = load_derived_core_properties("DerivedCoreProperties.txt")
377+
derived = load_properties("DerivedCoreProperties.txt",
378+
["XID_Start", "XID_Continue", "Alphabetic", "Lowercase", "Uppercase"])
380379
emit_property_module(rf, "derived_property", derived)
380+
381+
props = load_properties("PropList.txt", ["White_Space"])
382+
emit_property_module(rf, "property", props)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ syn match rustCharacter /'\([^'\\]\|\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8
187187

188188
syn region rustCommentML start="/\*" end="\*/" contains=rustTodo
189189
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
190+
syn region rustCommentMLDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo
191+
syn region rustCommentDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo keepend
192192

193193
syn keyword rustTodo contained TODO FIXME XXX NB NOTE
194194

branches/try2/src/librustc/driver/session.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use syntax::abi;
2828
use syntax::parse::token;
2929
use syntax;
3030

31-
use std::int;
3231
use std::hashmap::{HashMap,HashSet};
3332

3433
#[deriving(Clone)]
@@ -209,7 +208,7 @@ pub struct Session_ {
209208
building_library: @mut bool,
210209
working_dir: Path,
211210
lints: @mut HashMap<ast::NodeId, ~[(lint::lint, codemap::Span, ~str)]>,
212-
node_id: @mut uint,
211+
node_id: @mut ast::NodeId,
213212
}
214213

215214
pub type Session = @Session_;
@@ -274,13 +273,15 @@ impl Session_ {
274273
pub fn next_node_id(&self) -> ast::NodeId {
275274
self.reserve_node_ids(1)
276275
}
277-
pub fn reserve_node_ids(&self, count: uint) -> ast::NodeId {
276+
pub fn reserve_node_ids(&self, count: ast::NodeId) -> ast::NodeId {
278277
let v = *self.node_id;
279-
*self.node_id += count;
280-
if v > (int::max_value as uint) {
281-
self.bug("Input too large, ran out of node ids!");
278+
279+
match v.checked_add(&count) {
280+
Some(next) => { *self.node_id = next; }
281+
None => self.bug("Input too large, ran out of node ids!")
282282
}
283-
v as int
283+
284+
v
284285
}
285286
pub fn diagnostic(&self) -> @mut diagnostic::span_handler {
286287
self.span_diagnostic

branches/try2/src/librustc/front/feature_gate.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
//! Features are enabled in programs via the crate-level attributes of
1919
//! #[feature(...)] with a comma-separated list of features.
2020
21+
use middle::lint;
22+
2123
use syntax::ast;
2224
use syntax::attr::AttrMetaMethods;
2325
use syntax::codemap::Span;
@@ -209,7 +211,10 @@ pub fn check_crate(sess: Session, crate: &ast::Crate) {
209211
directive not necessary");
210212
}
211213
None => {
212-
sess.span_err(mi.span, "unknown feature");
214+
sess.add_lint(lint::unknown_features,
215+
ast::CRATE_NODE_ID,
216+
mi.span,
217+
~"unknown feature");
213218
}
214219
}
215220
}

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,62 @@ pub enum RealPredicate {
128128

129129
// The LLVM TypeKind type - must stay in sync with the def of
130130
// LLVMTypeKind in llvm/include/llvm-c/Core.h
131+
#[cfg(not(stage0))]
132+
#[deriving(Eq)]
133+
#[repr(C)]
134+
pub enum TypeKind {
135+
Void = 0,
136+
Half = 1,
137+
Float = 2,
138+
Double = 3,
139+
X86_FP80 = 4,
140+
FP128 = 5,
141+
PPC_FP128 = 6,
142+
Label = 7,
143+
Integer = 8,
144+
Function = 9,
145+
Struct = 10,
146+
Array = 11,
147+
Pointer = 12,
148+
Vector = 13,
149+
Metadata = 14,
150+
X86_MMX = 15,
151+
}
152+
153+
// NOTE remove these after snapshot. (See also #10308.)
154+
#[cfg(stage0)]
131155
pub type TypeKind = u32;
156+
#[cfg(stage0)]
132157
pub static Void: TypeKind = 0;
158+
#[cfg(stage0)]
133159
pub static Half: TypeKind = 1;
160+
#[cfg(stage0)]
134161
pub static Float: TypeKind = 2;
162+
#[cfg(stage0)]
135163
pub static Double: TypeKind = 3;
164+
#[cfg(stage0)]
136165
pub static X86_FP80: TypeKind = 4;
166+
#[cfg(stage0)]
137167
pub static FP128: TypeKind = 5;
168+
#[cfg(stage0)]
138169
pub static PPC_FP128: TypeKind = 6;
170+
#[cfg(stage0)]
139171
pub static Label: TypeKind = 7;
172+
#[cfg(stage0)]
140173
pub static Integer: TypeKind = 8;
174+
#[cfg(stage0)]
141175
pub static Function: TypeKind = 9;
176+
#[cfg(stage0)]
142177
pub static Struct: TypeKind = 10;
178+
#[cfg(stage0)]
143179
pub static Array: TypeKind = 11;
180+
#[cfg(stage0)]
144181
pub static Pointer: TypeKind = 12;
182+
#[cfg(stage0)]
145183
pub static Vector: TypeKind = 13;
184+
#[cfg(stage0)]
146185
pub static Metadata: TypeKind = 14;
186+
#[cfg(stage0)]
147187
pub static X86_MMX: TypeKind = 15;
148188

149189
#[repr(C)]

branches/try2/src/librustc/metadata/creader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl visit::Visitor<()> for ReadCrateVisitor {
6767

6868
#[deriving(Clone)]
6969
struct cache_entry {
70-
cnum: int,
70+
cnum: ast::CrateNum,
7171
span: Span,
7272
hash: @str,
7373
metas: @~[@ast::MetaItem]
@@ -242,7 +242,7 @@ fn metas_with_ident(ident: @str, metas: ~[@ast::MetaItem])
242242
}
243243

244244
fn existing_match(e: &Env, metas: &[@ast::MetaItem], hash: &str)
245-
-> Option<int> {
245+
-> Option<ast::CrateNum> {
246246
for c in e.crate_cache.iter() {
247247
if loader::metadata_matches(*c.metas, metas)
248248
&& (hash.is_empty() || c.hash.as_slice() == hash) {

branches/try2/src/librustc/metadata/decoder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@ fn lookup_hash(d: ebml::Doc, eq_fn: |&[u8]| -> bool, hash: u64) ->
7676

7777
pub type GetCrateDataCb<'self> = 'self |ast::CrateNum| -> Cmd;
7878

79-
pub fn maybe_find_item(item_id: int, items: ebml::Doc) -> Option<ebml::Doc> {
80-
fn eq_item(bytes: &[u8], item_id: int) -> bool {
79+
pub fn maybe_find_item(item_id: ast::NodeId, items: ebml::Doc) -> Option<ebml::Doc> {
80+
fn eq_item(bytes: &[u8], item_id: ast::NodeId) -> bool {
8181
return u64_from_be_bytes(
82-
bytes.slice(0u, 4u), 0u, 4u) as int
82+
bytes.slice(0u, 4u), 0u, 4u) as ast::NodeId
8383
== item_id;
8484
}
8585
lookup_hash(items,
8686
|a| eq_item(a, item_id),
8787
(item_id as i64).hash())
8888
}
8989

90-
fn find_item(item_id: int, items: ebml::Doc) -> ebml::Doc {
90+
fn find_item(item_id: ast::NodeId, items: ebml::Doc) -> ebml::Doc {
9191
match maybe_find_item(item_id, items) {
9292
None => fail!("lookup_item: id not found: {}", item_id),
9393
Some(d) => d
@@ -96,7 +96,7 @@ fn find_item(item_id: int, items: ebml::Doc) -> ebml::Doc {
9696

9797
// Looks up an item in the given metadata and returns an ebml doc pointing
9898
// to the item data.
99-
pub fn lookup_item(item_id: int, data: @~[u8]) -> ebml::Doc {
99+
pub fn lookup_item(item_id: ast::NodeId, data: @~[u8]) -> ebml::Doc {
100100
let items = reader::get_doc(reader::Doc(data), tag_items);
101101
find_item(item_id, items)
102102
}
@@ -343,7 +343,7 @@ fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::Ident {
343343
let string = name.as_str_slice();
344344
match intr.find_equiv(&string) {
345345
None => token::str_to_ident(string),
346-
Some(val) => ast::Ident::new(val),
346+
Some(val) => ast::Ident::new(val as ast::Name),
347347
}
348348
}
349349

0 commit comments

Comments
 (0)