Skip to content

Commit 2578ca7

Browse files
committed
---
yaml --- r: 146910 b: refs/heads/try2 c: 79ed898 h: refs/heads/master v: v3
1 parent 63b5bf4 commit 2578ca7

33 files changed

+1121
-2087
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: 68e3292fd79230f00745dc7608f4d80329c776bb
8+
refs/heads/try2: 79ed898f64f45cdcca6eadad3a5ad378fc8ff635
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: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,17 @@ 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 : (block_comment | character) * ;
156+
block_comment_body : non_star * | '*' + non_slash_or_star ;
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 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"]`).
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.
169167

170168
Non-doc comments are interpreted as a form of whitespace.
171169

branches/try2/src/etc/unicode.py

Lines changed: 15 additions & 17 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 libstd", that
8+
# The emitted code is "the minimum we think is necessary for libcore", 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, lowcase, titlecase ] = fields
44+
old, iso, upcase, lowcsae, titlecase ] = fields
4545

4646
code = int(code, 16)
4747

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

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

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

@@ -116,10 +118,10 @@ def load_properties(f, interestingprops):
116118
continue
117119
d_lo = int(d_lo, 16)
118120
d_hi = int(d_hi, 16)
119-
if prop not in props:
120-
props[prop] = []
121-
props[prop].append((d_lo, d_hi))
122-
return props
121+
if prop not in derivedprops:
122+
derivedprops[prop] = []
123+
derivedprops[prop].append((d_lo, d_hi))
124+
return derivedprops
123125

124126
def escape_char(c):
125127
if c <= 0xff:
@@ -142,7 +144,7 @@ def emit_bsearch_range_table(f):
142144
use cmp::{Equal, Less, Greater};
143145
use vec::ImmutableVector;
144146
use option::None;
145-
r.bsearch(|&(lo,hi)| {
147+
(do r.bsearch |&(lo,hi)| {
146148
if lo <= c && c <= hi { Equal }
147149
else if hi < c { Less }
148150
else { Greater }
@@ -300,14 +302,14 @@ def emit_decomp_module(f, canon, compat, combine):
300302
ix += 1
301303
f.write("\n ];\n")
302304

303-
f.write(" pub fn canonical(c: char, i: |char|) "
305+
f.write(" pub fn canonical(c: char, i: &fn(char)) "
304306
+ "{ d(c, i, false); }\n\n")
305-
f.write(" pub fn compatibility(c: char, i: |char|) "
307+
f.write(" pub fn compatibility(c: char, i: &fn(char)) "
306308
+"{ d(c, i, true); }\n\n")
307309
f.write(" pub fn canonical_combining_class(c: char) -> u8 {\n"
308310
+ " bsearch_range_value_table(c, combining_class_table)\n"
309311
+ " }\n\n")
310-
f.write(" fn d(c: char, i: |char|, k: bool) {\n")
312+
f.write(" fn d(c: char, i: &fn(char), k: bool) {\n")
311313
f.write(" use iter::Iterator;\n");
312314

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

375377
emit_decomp_module(rf, canon_decomp, compat_decomp, combines)
376378

377-
derived = load_properties("DerivedCoreProperties.txt",
378-
["XID_Start", "XID_Continue", "Alphabetic", "Lowercase", "Uppercase"])
379+
derived = load_derived_core_properties("DerivedCoreProperties.txt")
379380
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/front/feature_gate.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
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-
2321
use syntax::ast;
2422
use syntax::attr::AttrMetaMethods;
2523
use syntax::codemap::Span;
@@ -211,10 +209,7 @@ pub fn check_crate(sess: Session, crate: &ast::Crate) {
211209
directive not necessary");
212210
}
213211
None => {
214-
sess.add_lint(lint::unknown_features,
215-
ast::CRATE_NODE_ID,
216-
mi.span,
217-
~"unknown feature");
212+
sess.span_err(mi.span, "unknown feature");
218213
}
219214
}
220215
}

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

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -128,62 +128,22 @@ 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)]
155131
pub type TypeKind = u32;
156-
#[cfg(stage0)]
157132
pub static Void: TypeKind = 0;
158-
#[cfg(stage0)]
159133
pub static Half: TypeKind = 1;
160-
#[cfg(stage0)]
161134
pub static Float: TypeKind = 2;
162-
#[cfg(stage0)]
163135
pub static Double: TypeKind = 3;
164-
#[cfg(stage0)]
165136
pub static X86_FP80: TypeKind = 4;
166-
#[cfg(stage0)]
167137
pub static FP128: TypeKind = 5;
168-
#[cfg(stage0)]
169138
pub static PPC_FP128: TypeKind = 6;
170-
#[cfg(stage0)]
171139
pub static Label: TypeKind = 7;
172-
#[cfg(stage0)]
173140
pub static Integer: TypeKind = 8;
174-
#[cfg(stage0)]
175141
pub static Function: TypeKind = 9;
176-
#[cfg(stage0)]
177142
pub static Struct: TypeKind = 10;
178-
#[cfg(stage0)]
179143
pub static Array: TypeKind = 11;
180-
#[cfg(stage0)]
181144
pub static Pointer: TypeKind = 12;
182-
#[cfg(stage0)]
183145
pub static Vector: TypeKind = 13;
184-
#[cfg(stage0)]
185146
pub static Metadata: TypeKind = 14;
186-
#[cfg(stage0)]
187147
pub static X86_MMX: TypeKind = 15;
188148

189149
#[repr(C)]

branches/try2/src/librustc/middle/lint.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ use syntax::codemap::Span;
5959
use syntax::codemap;
6060
use syntax::parse::token;
6161
use syntax::{ast, ast_util, visit};
62-
use syntax::ast_util::IdVisitingOperation;
6362
use syntax::visit::Visitor;
6463

6564
#[deriving(Clone, Eq)]
@@ -78,7 +77,6 @@ pub enum lint {
7877
unused_unsafe,
7978
unsafe_block,
8079
attribute_usage,
81-
unknown_features,
8280

8381
managed_heap_memory,
8482
owned_heap_memory,
@@ -323,13 +321,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
323321
desc: "mass-change the level for lints which produce warnings",
324322
default: warn
325323
}),
326-
327-
("unknown_features",
328-
LintSpec {
329-
lint: unknown_features,
330-
desc: "unknown features found in create-level #[feature] directives",
331-
default: deny,
332-
}),
333324
];
334325

335326
/*
@@ -1329,7 +1320,7 @@ impl<'self> Visitor<()> for Context<'self> {
13291320
}
13301321
}
13311322

1332-
impl<'self> IdVisitingOperation for Context<'self> {
1323+
impl<'self> ast_util::IdVisitingOperation for Context<'self> {
13331324
fn visit_id(&self, id: ast::NodeId) {
13341325
match self.tcx.sess.lints.pop(&id) {
13351326
None => {}
@@ -1365,7 +1356,6 @@ pub fn check_crate(tcx: ty::ctxt,
13651356
cx.set_level(lint, level, CommandLine);
13661357
}
13671358
cx.with_lint_attrs(crate.attrs, |cx| {
1368-
cx.visit_id(ast::CRATE_NODE_ID);
13691359
cx.visit_ids(|v| {
13701360
v.visited_outermost = true;
13711361
visit::walk_crate(v, crate, ());

branches/try2/src/librustdoc/html/format.rs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -299,22 +299,20 @@ impl fmt::Default for clean::Type {
299299
f.buf.write(s.as_bytes());
300300
}
301301
clean::Closure(ref decl) => {
302-
f.buf.write(match decl.sigil {
303-
ast::BorrowedSigil => "&amp;",
304-
ast::ManagedSigil => "@",
305-
ast::OwnedSigil => "~",
306-
}.as_bytes());
307-
match decl.region {
308-
Some(ref region) => write!(f.buf, "{} ", *region),
309-
None => {}
310-
}
311-
write!(f.buf, "{}{}fn{}",
302+
let region = match decl.region {
303+
Some(ref region) => format!("{} ", *region),
304+
None => ~"",
305+
};
306+
307+
write!(f.buf, "{}{}{arrow, select, yes{ -&gt; {ret}} other{}}",
312308
PuritySpace(decl.purity),
313-
match decl.onceness {
314-
ast::Once => "once ",
315-
ast::Many => "",
309+
match decl.sigil {
310+
ast::OwnedSigil => format!("proc({})", decl.decl.inputs),
311+
ast::BorrowedSigil => format!("{}|{}|", region, decl.decl.inputs),
312+
ast::ManagedSigil => format!("@{}fn({})", region, decl.decl.inputs),
316313
},
317-
decl.decl);
314+
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
315+
ret = decl.decl.output);
318316
// XXX: where are bounds and lifetimes printed?!
319317
}
320318
clean::BareFunction(ref decl) => {
@@ -374,18 +372,24 @@ impl fmt::Default for clean::Type {
374372

375373
impl fmt::Default for clean::FnDecl {
376374
fn fmt(d: &clean::FnDecl, f: &mut fmt::Formatter) {
375+
write!(f.buf, "({args}){arrow, select, yes{ -&gt; {ret}} other{}}",
376+
args = d.inputs,
377+
arrow = match d.output { clean::Unit => "no", _ => "yes" },
378+
ret = d.output);
379+
}
380+
}
381+
382+
impl fmt::Default for ~[clean::Argument] {
383+
fn fmt(inputs: &~[clean::Argument], f: &mut fmt::Formatter) {
377384
let mut args = ~"";
378-
for (i, input) in d.inputs.iter().enumerate() {
385+
for (i, input) in inputs.iter().enumerate() {
379386
if i > 0 { args.push_str(", "); }
380387
if input.name.len() > 0 {
381388
args.push_str(format!("{}: ", input.name));
382389
}
383390
args.push_str(format!("{}", input.type_));
384391
}
385-
write!(f.buf, "({args}){arrow, select, yes{ -&gt; {ret}} other{}}",
386-
args = args,
387-
arrow = match d.output { clean::Unit => "no", _ => "yes" },
388-
ret = d.output);
392+
f.buf.write(args.as_bytes());
389393
}
390394
}
391395

branches/try2/src/libstd/ascii.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Ascii {
6767
/// Check if the character is a number (0-9)
6868
#[inline]
6969
pub fn is_digit(&self) -> bool {
70-
self.chr >= 0x30 && self.chr <= 0x39
70+
self.chr >= 0x31 && self.chr <= 0x39
7171
}
7272

7373
/// Check if the character is a letter or number
@@ -85,7 +85,7 @@ impl Ascii {
8585
/// Check if the character is a control character
8686
#[inline]
8787
pub fn is_control(&self) -> bool {
88-
self.chr < 0x20 || self.chr == 0x7F
88+
self.chr <= 0x20 || self.chr == 0x7F
8989
}
9090

9191
/// Checks if the character is printable (except space)
@@ -498,15 +498,6 @@ mod tests {
498498
assert_eq!('`'.to_ascii().to_upper().to_char(), '`');
499499
assert_eq!('{'.to_ascii().to_upper().to_char(), '{');
500500

501-
assert!('0'.to_ascii().is_digit());
502-
assert!('9'.to_ascii().is_digit());
503-
assert!(!'/'.to_ascii().is_digit());
504-
assert!(!':'.to_ascii().is_digit());
505-
506-
assert!((0x1fu8).to_ascii().is_control());
507-
assert!(!' '.to_ascii().is_control());
508-
assert!((0x7fu8).to_ascii().is_control());
509-
510501
assert!("banana".chars().all(|c| c.is_ascii()));
511502
assert!(!"ประเทศไทย中华Việt Nam".chars().all(|c| c.is_ascii()));
512503
}

0 commit comments

Comments
 (0)