Skip to content

Commit 8173d78

Browse files
committed
---
yaml --- r: 130963 b: refs/heads/auto c: 06c0b1d h: refs/heads/master i: 130961: 266cb94 130959: c3d7793 v: v3
1 parent 6cfdb62 commit 8173d78

Some content is hidden

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

46 files changed

+751
-130
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: 7085b3edd96d5c3244422449edb2b5144b7d50f9
16+
refs/heads/auto: 06c0b1d28ac28ca42d6c179293e333a012a8a3fc
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/mk/docs.mk

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,22 @@ endif
7676

7777
# Check for the various external utilities for the EPUB/PDF docs:
7878

79-
ifeq ($(CFG_PDFLATEX),)
80-
$(info cfg: no pdflatex found, deferring to xelatex)
79+
ifeq ($(CFG_LUALATEX),)
80+
$(info cfg: no lualatex found, deferring to xelatex)
8181
ifeq ($(CFG_XELATEX),)
82-
$(info cfg: no xelatex found, deferring to lualatex)
83-
ifeq ($(CFG_LUALATEX),)
84-
$(info cfg: no lualatex found, disabling LaTeX docs)
82+
$(info cfg: no xelatex found, deferring to pdflatex)
83+
ifeq ($(CFG_PDFLATEX),)
84+
$(info cfg: no pdflatex found, disabling LaTeX docs)
8585
NO_PDF_DOCS = 1
8686
else
87-
CFG_LATEX := $(CFG_LUALATEX)
87+
CFG_LATEX := $(CFG_PDFLATEX)
8888
endif
8989
else
9090
CFG_LATEX := $(CFG_XELATEX)
91+
XELATEX = 1
9192
endif
9293
else
93-
CFG_LATEX := $(CFG_PDFLATEX)
94+
CFG_LATEX := $(CFG_LUALATEX)
9495
endif
9596

9697

@@ -187,12 +188,25 @@ doc/$(1).tex: $$(D)/$(1).md doc/footer.tex doc/version.tex | doc/
187188
ifneq ($(NO_PDF_DOCS),1)
188189
ifeq ($$(SHOULD_BUILD_PDF_DOC_$(1)),1)
189190
DOC_TARGETS += doc/$(1).pdf
191+
ifneq ($(XELATEX),1)
190192
doc/$(1).pdf: doc/$(1).tex
191193
@$$(call E, latex compiler: $$@)
192194
$$(Q)$$(CFG_LATEX) \
193195
-interaction=batchmode \
194196
-output-directory=doc \
195197
$$<
198+
else
199+
# The version of xelatex on the snap bots seemingly ingores -output-directory
200+
# So we'll output to . and move to the doc directory manually.
201+
# This will leave some intermediate files in the build directory.
202+
doc/$(1).pdf: doc/$(1).tex
203+
@$$(call E, latex compiler: $$@)
204+
$$(Q)$$(CFG_LATEX) \
205+
-interaction=batchmode \
206+
-output-directory=. \
207+
$$<
208+
$$(Q)mv ./$(1).pdf $$@
209+
endif # XELATEX
196210
endif # SHOULD_BUILD_PDF_DOCS_$(1)
197211
endif # NO_PDF_DOCS
198212

branches/auto/src/doc/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ discussion about Rust.
4343
There is also a [developer forum](http://discuss.rust-lang.org/), where the
4444
development of Rust itself is discussed.
4545

46+
# Specification
47+
48+
Rust does not have an exact specification, but an effort to describe as much of
49+
the language in as much detail as possible is in [the manual](rust.html).
4650

4751
# Guides
4852

branches/auto/src/doc/rust.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ enclosed within two `U+0022` (double-quote) characters,
349349
with the exception of `U+0022` itself,
350350
which must be _escaped_ by a preceding `U+005C` character (`\`),
351351
or a _raw byte string literal_.
352-
It is equivalent to a `&'static [u8]` borrowed vector of unsigned 8-bit integers.
352+
It is equivalent to a `&'static [u8]` borrowed array of unsigned 8-bit integers.
353353

354354
Some additional _escapes_ are available in either byte or non-raw byte string
355355
literals. An escape starts with a `U+005C` (`\`) and continues with one of
@@ -2555,6 +2555,8 @@ The currently implemented features of the reference compiler are:
25552555
which is considered wildly unsafe and will be
25562556
obsoleted by language improvements.
25572557

2558+
* `tuple_indexing` - Allows use of tuple indexing (expressions like `expr.0`)
2559+
25582560
If a feature is promoted to a language feature, then all existing programs will
25592561
start to receive compilation warnings about #[feature] directives which enabled
25602562
the new feature (because the directive is no longer necessary). However, if
@@ -2809,16 +2811,17 @@ When the type providing the field inherits mutabilty, it can be [assigned](#assi
28092811
Also, if the type of the expression to the left of the dot is a pointer,
28102812
it is automatically dereferenced to make the field access possible.
28112813

2812-
### Vector expressions
2814+
### Array expressions
28132815

28142816
~~~~ {.ebnf .gram}
2815-
vec_expr : '[' "mut" ? vec_elems? ']' ;
2817+
array_expr : '[' "mut" ? vec_elems? ']' ;
28162818
2817-
vec_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
2819+
array_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
28182820
~~~~
28192821

2820-
A [_vector_](#vector-types) _expression_ is written by enclosing zero or
2821-
more comma-separated expressions of uniform type in square brackets.
2822+
An [array](#vector,-array,-and-slice-types) _expression_ is written by
2823+
enclosing zero or more comma-separated expressions of uniform type in square
2824+
brackets.
28222825

28232826
In the `[expr ',' ".." expr]` form, the expression after the `".."`
28242827
must be a constant expression that can be evaluated at compile time, such
@@ -2827,7 +2830,7 @@ as a [literal](#literals) or a [static item](#static-items).
28272830
~~~~
28282831
[1i, 2, 3, 4];
28292832
["a", "b", "c", "d"];
2830-
[0i, ..128]; // vector with 128 zeros
2833+
[0i, ..128]; // array with 128 zeros
28312834
[0u8, 0u8, 0u8, 0u8];
28322835
~~~~
28332836

@@ -2837,9 +2840,9 @@ as a [literal](#literals) or a [static item](#static-items).
28372840
idx_expr : expr '[' expr ']' ;
28382841
~~~~
28392842

2840-
[Vector](#vector-types)-typed expressions can be indexed by writing a
2843+
[Array](#vector,-array,-and-slice-types)-typed expressions can be indexed by writing a
28412844
square-bracket-enclosed expression (the index) after them. When the
2842-
vector is mutable, the resulting [lvalue](#lvalues,-rvalues-and-temporaries) can be assigned to.
2845+
array is mutable, the resulting [lvalue](#lvalues,-rvalues-and-temporaries) can be assigned to.
28432846

28442847
Indices are zero-based, and may be of any integral type. Vector access
28452848
is bounds-checked at run-time. When the check fails, it will put the
@@ -2900,7 +2903,7 @@ This means that arithmetic operators can be overridden for user-defined types.
29002903
The default meaning of the operators on standard types is given here.
29012904

29022905
* `+`
2903-
: Addition and vector/string concatenation.
2906+
: Addition and array/string concatenation.
29042907
Calls the `add` method on the `std::ops::Add` trait.
29052908
* `-`
29062909
: Subtraction.
@@ -3203,7 +3206,7 @@ for_expr : "for" pat "in" no_struct_literal_expr '{' block '}' ;
32033206
A `for` expression is a syntactic construct for looping over elements
32043207
provided by an implementation of `std::iter::Iterator`.
32053208

3206-
An example of a for loop over the contents of a vector:
3209+
An example of a for loop over the contents of an array:
32073210

32083211
~~~~
32093212
# type Foo = int;
@@ -3261,7 +3264,7 @@ match_pat : pat [ '|' pat ] * [ "if" expr ] ? ;
32613264

32623265
A `match` expression branches on a *pattern*. The exact form of matching that
32633266
occurs depends on the pattern. Patterns consist of some combination of
3264-
literals, destructured vectors or enum constructors, structures and
3267+
literals, destructured arrays or enum constructors, structures and
32653268
tuples, variable binding specifications, wildcards (`..`), and placeholders
32663269
(`_`). A `match` expression has a *head expression*, which is the value to
32673270
compare to the patterns. The type of the patterns must equal the type of the
@@ -3290,11 +3293,11 @@ between `_` and `..` is that the pattern `C(_)` is only type-correct if `C` has
32903293
exactly one argument, while the pattern `C(..)` is type-correct for any enum
32913294
variant `C`, regardless of how many arguments `C` has.
32923295

3293-
Used inside a vector pattern, `..` stands for any number of elements, when the
3296+
Used inside a array pattern, `..` stands for any number of elements, when the
32943297
`advanced_slice_patterns` feature gate is turned on. This wildcard can be used
3295-
at most once for a given vector, which implies that it cannot be used to
3298+
at most once for a given array, which implies that it cannot be used to
32963299
specifically match elements that are at an unknown distance from both ends of a
3297-
vector, like `[.., 42, ..]`. If followed by a variable name, it will bind the
3300+
array, like `[.., 42, ..]`. If followed by a variable name, it will bind the
32983301
corresponding slice to the variable. Example:
32993302

33003303
~~~~
@@ -3427,7 +3430,7 @@ let message = match x {
34273430
~~~~
34283431

34293432
Range patterns only work on scalar types
3430-
(like integers and characters; not like vectors and structs, which have sub-components).
3433+
(like integers and characters; not like arrays and structs, which have sub-components).
34313434
A range pattern may not be a sub-range of another range pattern inside the same `match`.
34323435

34333436
Finally, match patterns can accept *pattern guards* to further refine the
@@ -3535,10 +3538,10 @@ http://www.unicode.org/glossary/#unicode_scalar_value)
35353538
(ie. a code point that is not a surrogate),
35363539
represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
35373540
or 0xE000 to 0x10FFFF range.
3538-
A `[char]` vector is effectively an UCS-4 / UTF-32 string.
3541+
A `[char]` array is effectively an UCS-4 / UTF-32 string.
35393542

35403543
A value of type `str` is a Unicode string,
3541-
represented as a vector of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
3544+
represented as a array of 8-bit unsigned bytes holding a sequence of UTF-8 codepoints.
35423545
Since `str` is of unknown size, it is not a _first class_ type,
35433546
but can only be instantiated through a pointer type,
35443547
such as `&str` or `String`.
@@ -3649,7 +3652,7 @@ Such recursion has restrictions:
36493652

36503653
* Recursive types must include a nominal type in the recursion
36513654
(not mere [type definitions](#type-definitions),
3652-
or other structural types such as [vectors](#vector-types) or [tuples](#tuple-types)).
3655+
or other structural types such as [arrays](#vector,-array,-and-slice-types) or [tuples](#tuple-types)).
36533656
* A recursive `enum` item must have at least one non-recursive constructor
36543657
(in order to give the recursion a basis case).
36553658
* The size of a recursive type must be finite;
@@ -4153,7 +4156,7 @@ heap data.
41534156
### Built in types
41544157

41554158
The runtime provides C and Rust code to assist with various built-in types,
4156-
such as vectors, strings, and the low level communication system (ports,
4159+
such as arrays, strings, and the low level communication system (ports,
41574160
channels, tasks).
41584161

41594162
Support for other built-in types such as simple types, tuples and

branches/auto/src/liballoc/heap.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
1313
// and `nonnull`
1414

15-
use core::ptr::RawPtr;
1615
#[cfg(not(test))] use core::raw;
1716
#[cfg(stage0, not(test))] use util;
1817

@@ -70,11 +69,6 @@ pub unsafe fn reallocate_inplace(ptr: *mut u8, size: uint, align: uint,
7069
/// the value returned by `usable_size` for the requested size.
7170
#[inline]
7271
pub unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) {
73-
// FIXME(14395) This is only required for DST ~[T], it should be removed once
74-
// we fix that representation to not use null pointers.
75-
if ptr.is_null() {
76-
return;
77-
}
7872
imp::deallocate(ptr, size, align)
7973
}
8074

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
7070
("unboxed_closures", Active),
7171
("import_shadowing", Active),
7272
("advanced_slice_patterns", Active),
73+
("tuple_indexing", Active),
7374

7475
// if you change this list without updating src/doc/rust.md, cmr will be sad
7576

@@ -338,6 +339,11 @@ impl<'a> Visitor<()> for Context<'a> {
338339
"unboxed closures are a work-in-progress \
339340
feature with known bugs");
340341
}
342+
ast::ExprTupField(..) => {
343+
self.gate_feature("tuple_indexing",
344+
e.span,
345+
"tuple indexing is experimental");
346+
}
341347
_ => {}
342348
}
343349
visit::walk_expr(self, e, ());

branches/auto/src/librustc/front/show_span.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ impl<'a> Visitor<()> for ShowSpanVisitor<'a> {
2828
self.sess.span_note(e.span, "expression");
2929
visit::walk_expr(self, e, ());
3030
}
31+
32+
fn visit_mac(&mut self, macro: &ast::Mac, e: ()) {
33+
visit::walk_mac(self, macro, e);
34+
}
3135
}
3236

3337
pub fn run(sess: &Session, krate: &ast::Crate) {

branches/auto/src/librustc/lint/builtin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,7 @@ impl UnnecessaryParens {
10561056
ast::ExprUnary(_, ref x) |
10571057
ast::ExprCast(ref x, _) |
10581058
ast::ExprField(ref x, _, _) |
1059+
ast::ExprTupField(ref x, _, _) |
10591060
ast::ExprIndex(ref x, _) => {
10601061
// &X { y: 1 }, X { y: 1 }.y
10611062
contains_exterior_struct_lit(&**x)

branches/auto/src/librustc/middle/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
807807
out.push_str(token::get_name(fname).get());
808808
}
809809
mc::PositionalField(idx) => {
810-
out.push_char('#'); // invent a notation here
810+
out.push_char('.');
811811
out.push_str(idx.to_string().as_slice());
812812
}
813813
}

branches/auto/src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
467467
ast::ExprCast(e, _) |
468468
ast::ExprUnary(_, e) |
469469
ast::ExprParen(e) |
470-
ast::ExprField(e, _, _) => {
470+
ast::ExprField(e, _, _) |
471+
ast::ExprTupField(e, _, _) => {
471472
self.straightline(expr, pred, [e])
472473
}
473474

branches/auto/src/librustc/middle/check_const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr, is_const: bool) {
173173
ExprAddrOf(MutImmutable, _) |
174174
ExprParen(..) |
175175
ExprField(..) |
176+
ExprTupField(..) |
176177
ExprIndex(..) |
177178
ExprTup(..) |
178179
ExprRepeat(..) |

branches/auto/src/librustc/middle/check_static.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl<'a, 'tcx> Visitor<bool> for CheckStaticVisitor<'a, 'tcx> {
106106
}
107107

108108
match e.node {
109-
ast::ExprField(..) | ast::ExprVec(..) |
109+
ast::ExprField(..) | ast::ExprTupField(..) | ast::ExprVec(..) |
110110
ast::ExprBlock(..) | ast::ExprTup(..) => {
111111
visit::walk_expr(self, e, is_const);
112112
}

branches/auto/src/librustc/middle/const_eval.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ impl<'a, 'tcx> ConstEvalVisitor<'a, 'tcx> {
225225

226226
ast::ExprField(ref base, _, _) => self.classify(&**base),
227227

228+
ast::ExprTupField(ref base, _, _) => self.classify(&**base),
229+
228230
ast::ExprIndex(ref base, ref idx) =>
229231
join(self.classify(&**base), self.classify(&**idx)),
230232

branches/auto/src/librustc/middle/dead.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
145145
}
146146
}
147147

148+
fn handle_tup_field_access(&mut self, lhs: &ast::Expr, idx: uint) {
149+
match ty::get(ty::expr_ty_adjusted(self.tcx, lhs)).sty {
150+
ty::ty_struct(id, _) => {
151+
let fields = ty::lookup_struct_fields(self.tcx, id);
152+
let field_id = fields[idx].id;
153+
self.live_symbols.insert(field_id.node);
154+
},
155+
_ => ()
156+
}
157+
}
158+
148159
fn handle_field_pattern_match(&mut self, lhs: &ast::Pat, pats: &[ast::FieldPat]) {
149160
let id = match self.tcx.def_map.borrow().get(&lhs.id) {
150161
&def::DefVariant(_, id, _) => id,
@@ -255,6 +266,9 @@ impl<'a, 'tcx> Visitor<MarkSymbolVisitorContext> for MarkSymbolVisitor<'a, 'tcx>
255266
ast::ExprField(ref lhs, ref ident, _) => {
256267
self.handle_field_access(&**lhs, &ident.node);
257268
}
269+
ast::ExprTupField(ref lhs, idx, _) => {
270+
self.handle_tup_field_access(&**lhs, idx.node);
271+
}
258272
_ => ()
259273
}
260274

branches/auto/src/librustc/middle/expr_use_visitor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,TYPER> {
324324
self.select_from_expr(&**base);
325325
}
326326

327+
ast::ExprTupField(ref base, _, _) => { // base.<n>
328+
self.select_from_expr(&**base);
329+
}
330+
327331
ast::ExprIndex(ref lhs, ref rhs) => { // lhs[rhs]
328332
if !self.walk_overloaded_operator(expr, &**lhs, [rhs.clone()]) {
329333
self.select_from_expr(&**lhs);

branches/auto/src/librustc/middle/liveness.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
511511
}
512512

513513
// otherwise, live nodes are not required:
514-
ExprIndex(..) | ExprField(..) | ExprVec(..) |
514+
ExprIndex(..) | ExprField(..) | ExprTupField(..) | ExprVec(..) |
515515
ExprCall(..) | ExprMethodCall(..) | ExprTup(..) |
516516
ExprBinary(..) | ExprAddrOf(..) |
517517
ExprCast(..) | ExprUnary(..) | ExprBreak(_) |
@@ -965,6 +965,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
965965
self.propagate_through_expr(&**e, succ)
966966
}
967967

968+
ExprTupField(ref e, _, _) => {
969+
self.propagate_through_expr(&**e, succ)
970+
}
971+
968972
ExprFnBlock(_, _, ref blk) |
969973
ExprProc(_, ref blk) |
970974
ExprUnboxedFn(_, _, _, ref blk) => {
@@ -1271,6 +1275,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
12711275
match expr.node {
12721276
ExprPath(_) => succ,
12731277
ExprField(ref e, _, _) => self.propagate_through_expr(&**e, succ),
1278+
ExprTupField(ref e, _, _) => self.propagate_through_expr(&**e, succ),
12741279
_ => self.propagate_through_expr(expr, succ)
12751280
}
12761281
}
@@ -1445,7 +1450,7 @@ fn check_expr(this: &mut Liveness, expr: &Expr) {
14451450
// no correctness conditions related to liveness
14461451
ExprCall(..) | ExprMethodCall(..) | ExprIf(..) | ExprMatch(..) |
14471452
ExprWhile(..) | ExprLoop(..) | ExprIndex(..) | ExprField(..) |
1448-
ExprVec(..) | ExprTup(..) | ExprBinary(..) |
1453+
ExprTupField(..) | ExprVec(..) | ExprTup(..) | ExprBinary(..) |
14491454
ExprCast(..) | ExprUnary(..) | ExprRet(..) | ExprBreak(..) |
14501455
ExprAgain(..) | ExprLit(_) | ExprBlock(..) |
14511456
ExprMac(..) | ExprAddrOf(..) | ExprStruct(..) | ExprRepeat(..) |

0 commit comments

Comments
 (0)