Skip to content

Commit 3ded02a

Browse files
committed
---
yaml --- r: 152319 b: refs/heads/try2 c: f24a537 h: refs/heads/master i: 152317: 1577397 152315: 21e6304 152311: 2347c4e 152303: 2688048 152287: 5b35f76 152255: 85eb353 152191: f215946 152063: 9eb3cca v: v3
1 parent 72cc87e commit 3ded02a

33 files changed

+355
-332
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: 8a414858ac04580be522b4d27abe834112011408
8+
refs/heads/try2: f24a53757e1e78fcf7f3a9208a0496dee26a6423
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/rust.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,10 +2524,10 @@ Note that for a given *unit-like* structure type, this will always be the same v
25242524

25252525
A structure expression can terminate with the syntax `..` followed by an expression to denote a functional update.
25262526
The expression following `..` (the base) must have the same structure type as the new structure type being formed.
2527-
The entire expression denotes the result of constructing a new structure
2527+
The entire expression denotes the result of allocating a new structure
25282528
(with the same type as the base expression)
25292529
with the given values for the fields that were explicitly specified
2530-
and the values in the base expression for all other fields.
2530+
and the values in the base record for all other fields.
25312531

25322532
~~~~
25332533
# struct Point3d { x: int, y: int, z: int }
@@ -2575,15 +2575,15 @@ when not immediately followed by a parenthesized expression-list (the latter is
25752575
A field expression denotes a field of a [structure](#structure-types).
25762576

25772577
~~~~ {.ignore .field}
2578-
mystruct.myfield;
2578+
myrecord.myfield;
25792579
foo().x;
25802580
(Struct {a: 10, b: 20}).a;
25812581
~~~~
25822582

2583-
A field access is an [lvalue](#lvalues-rvalues-and-temporaries) referring to the value of that field.
2584-
When the type providing the field inherits mutabilty, it can be [assigned](#assignment-expressions) to.
2583+
A field access on a record is an [lvalue](#lvalues-rvalues-and-temporaries) referring to the value of that field.
2584+
When the field is mutable, it can be [assigned](#assignment-expressions) to.
25852585

2586-
Also, if the type of the expression to the left of the dot is a pointer,
2586+
When the type of the expression to the left of the dot is a pointer to a record or structure,
25872587
it is automatically dereferenced to make the field access possible.
25882588

25892589
### Vector expressions
@@ -3038,7 +3038,7 @@ match_pat : pat [ '|' pat ] * [ "if" expr ] ? ;
30383038

30393039
A `match` expression branches on a *pattern*. The exact form of matching that
30403040
occurs depends on the pattern. Patterns consist of some combination of
3041-
literals, destructured vectors or enum constructors, structures and
3041+
literals, destructured vectors or enum constructors, structures, records and
30423042
tuples, variable binding specifications, wildcards (`..`), and placeholders
30433043
(`_`). A `match` expression has a *head expression*, which is the value to
30443044
compare to the patterns. The type of the patterns must equal the type of the
@@ -3315,16 +3315,17 @@ such as `&str` or `String`.
33153315

33163316
### Tuple types
33173317

3318-
A tuple *type* is a heterogeneous product of other types, called the *elements*
3319-
of the tuple. It has no nominal name and is instead structurally typed.
3318+
The tuple type-constructor forms a new heterogeneous product of values similar
3319+
to the record type-constructor. The differences are as follows:
3320+
3321+
* tuple elements cannot be mutable, unlike record fields
3322+
* tuple elements are not named and can be accessed only by pattern-matching
33203323

33213324
Tuple types and values are denoted by listing the types or values of their
33223325
elements, respectively, in a parenthesized, comma-separated
33233326
list.
33243327

3325-
Because tuple elements don't have a name, they can only be accessed by pattern-matching.
3326-
3327-
The members of a tuple are laid out in memory contiguously, in
3328+
The members of a tuple are laid out in memory contiguously, like a record, in
33283329
order specified by the tuple type.
33293330

33303331
An example of a tuple type and its use:
@@ -3376,13 +3377,12 @@ of the type.[^structtype]
33763377

33773378
New instances of a `struct` can be constructed with a [struct expression](#structure-expressions).
33783379

3379-
The memory layout of a `struct` is undefined by default to allow for compiler optimziations like
3380-
field reordering, but it can be fixed with the `#[repr(...)]` attribute.
3381-
In either case, fields may be given in any order in a corresponding struct *expression*;
3382-
the resulting `struct` value will always have the same memory layout.
3380+
The memory order of fields in a `struct` is given by the item defining it.
3381+
Fields may be given in any order in a corresponding struct *expression*;
3382+
the resulting `struct` value will always be laid out in memory in the order specified by the corresponding *item*.
33833383

33843384
The fields of a `struct` may be qualified by [visibility modifiers](#re-exporting-and-visibility),
3385-
to allow access to data in a structure outside a module.
3385+
to restrict access to implementation-private data in a structure.
33863386

33873387
A _tuple struct_ type is just like a structure type, except that the fields are anonymous.
33883388

@@ -3933,7 +3933,7 @@ The runtime provides C and Rust code to assist with various built-in types,
39333933
such as vectors, strings, and the low level communication system (ports,
39343934
channels, tasks).
39353935

3936-
Support for other built-in types such as simple types, tuples and
3936+
Support for other built-in types such as simple types, tuples, records, and
39373937
enums is open-coded by the Rust compiler.
39383938

39393939
### Task scheduling and communication

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#![allow(non_camel_case_types)]
1818

19+
use middle::subst;
1920
use middle::ty;
2021

2122
use std::rc::Rc;
@@ -25,7 +26,6 @@ use std::uint;
2526
use syntax::abi;
2627
use syntax::ast;
2728
use syntax::ast::*;
28-
use syntax::owned_slice::OwnedSlice;
2929
use syntax::parse::token;
3030

3131
// Compact string representation for ty::t values. API ty_str &
@@ -133,7 +133,7 @@ pub fn parse_trait_ref_data(data: &[u8], crate_num: ast::CrateNum, pos: uint, tc
133133
}
134134

135135
pub fn parse_substs_data(data: &[u8], crate_num: ast::CrateNum, pos: uint, tcx: &ty::ctxt,
136-
conv: conv_did) -> ty::substs {
136+
conv: conv_did) -> subst::Substs {
137137
let mut st = parse_state_from_data(data, crate_num, pos, tcx);
138138
parse_substs(&mut st, conv)
139139
}
@@ -162,7 +162,7 @@ fn parse_trait_store(st: &mut PState, conv: conv_did) -> ty::TraitStore {
162162
}
163163
}
164164

165-
fn parse_substs(st: &mut PState, conv: conv_did) -> ty::substs {
165+
fn parse_substs(st: &mut PState, conv: conv_did) -> subst::Substs {
166166
let regions = parse_region_substs(st, |x,y| conv(x,y));
167167

168168
let self_ty = parse_opt(st, |st| parse_ty(st, |x,y| conv(x,y)) );
@@ -172,24 +172,24 @@ fn parse_substs(st: &mut PState, conv: conv_did) -> ty::substs {
172172
while peek(st) != ']' { params.push(parse_ty(st, |x,y| conv(x,y))); }
173173
st.pos = st.pos + 1u;
174174

175-
return ty::substs {
175+
return subst::Substs {
176176
regions: regions,
177177
self_ty: self_ty,
178178
tps: params
179179
};
180180
}
181181

182-
fn parse_region_substs(st: &mut PState, conv: conv_did) -> ty::RegionSubsts {
182+
fn parse_region_substs(st: &mut PState, conv: conv_did) -> subst::RegionSubsts {
183183
match next(st) {
184-
'e' => ty::ErasedRegions,
184+
'e' => subst::ErasedRegions,
185185
'n' => {
186186
let mut regions = vec!();
187187
while peek(st) != '.' {
188188
let r = parse_region(st, |x,y| conv(x,y));
189189
regions.push(r);
190190
}
191191
assert_eq!(next(st), '.');
192-
ty::NonerasedRegions(OwnedSlice::from_vec(regions))
192+
subst::NonerasedRegions(regions)
193193
}
194194
_ => fail!("parse_bound_region: bad input")
195195
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use std::cell::RefCell;
1717
use std::collections::HashMap;
1818
use std::io::MemWriter;
1919

20+
use middle::subst;
2021
use middle::ty::param_ty;
2122
use middle::ty;
2223

@@ -96,20 +97,20 @@ fn enc_opt<T>(w: &mut MemWriter, t: Option<T>, enc_f: |&mut MemWriter, T|) {
9697
}
9798
}
9899

99-
pub fn enc_substs(w: &mut MemWriter, cx: &ctxt, substs: &ty::substs) {
100+
pub fn enc_substs(w: &mut MemWriter, cx: &ctxt, substs: &subst::Substs) {
100101
enc_region_substs(w, cx, &substs.regions);
101102
enc_opt(w, substs.self_ty, |w, t| enc_ty(w, cx, t));
102103
mywrite!(w, "[");
103104
for t in substs.tps.iter() { enc_ty(w, cx, *t); }
104105
mywrite!(w, "]");
105106
}
106107

107-
fn enc_region_substs(w: &mut MemWriter, cx: &ctxt, substs: &ty::RegionSubsts) {
108+
fn enc_region_substs(w: &mut MemWriter, cx: &ctxt, substs: &subst::RegionSubsts) {
108109
match *substs {
109-
ty::ErasedRegions => {
110+
subst::ErasedRegions => {
110111
mywrite!(w, "e");
111112
}
112-
ty::NonerasedRegions(ref regions) => {
113+
subst::NonerasedRegions(ref regions) => {
113114
mywrite!(w, "n");
114115
for &r in regions.iter() {
115116
enc_region(w, cx, r);

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use metadata::tydecode;
2323
use metadata::tydecode::{DefIdSource, NominalType, TypeWithId, TypeParameter,
2424
RegionParameter};
2525
use metadata::tyencode;
26+
use middle::subst;
2627
use middle::typeck::{MethodCall, MethodCallee, MethodOrigin};
2728
use middle::{ty, typeck};
2829
use util::ppaux::ty_to_str;
@@ -796,7 +797,7 @@ trait ebml_writer_helpers {
796797
fn emit_tpbt(&mut self,
797798
ecx: &e::EncodeContext,
798799
tpbt: ty::ty_param_bounds_and_ty);
799-
fn emit_substs(&mut self, ecx: &e::EncodeContext, substs: &ty::substs);
800+
fn emit_substs(&mut self, ecx: &e::EncodeContext, substs: &subst::Substs);
800801
fn emit_auto_adjustment(&mut self, ecx: &e::EncodeContext, adj: &ty::AutoAdjustment);
801802
}
802803

@@ -842,7 +843,7 @@ impl<'a> ebml_writer_helpers for Encoder<'a> {
842843
});
843844
}
844845

845-
fn emit_substs(&mut self, ecx: &e::EncodeContext, substs: &ty::substs) {
846+
fn emit_substs(&mut self, ecx: &e::EncodeContext, substs: &subst::Substs) {
846847
self.emit_opaque(|this| Ok(tyencode::enc_substs(this.writer,
847848
&ecx.ty_str_ctxt(),
848849
substs)));
@@ -1076,7 +1077,7 @@ trait ebml_decoder_decoder_helpers {
10761077
-> ty::TypeParameterDef;
10771078
fn read_ty_param_bounds_and_ty(&mut self, xcx: &ExtendedDecodeContext)
10781079
-> ty::ty_param_bounds_and_ty;
1079-
fn read_substs(&mut self, xcx: &ExtendedDecodeContext) -> ty::substs;
1080+
fn read_substs(&mut self, xcx: &ExtendedDecodeContext) -> subst::Substs;
10801081
fn read_auto_adjustment(&mut self, xcx: &ExtendedDecodeContext) -> ty::AutoAdjustment;
10811082
fn convert_def_id(&mut self,
10821083
xcx: &ExtendedDecodeContext,
@@ -1093,7 +1094,7 @@ trait ebml_decoder_decoder_helpers {
10931094
cdata: &cstore::crate_metadata) -> Vec<ty::t>;
10941095
fn read_substs_noxcx(&mut self, tcx: &ty::ctxt,
10951096
cdata: &cstore::crate_metadata)
1096-
-> ty::substs;
1097+
-> subst::Substs;
10971098
}
10981099

10991100
impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
@@ -1121,7 +1122,7 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
11211122
fn read_substs_noxcx(&mut self,
11221123
tcx: &ty::ctxt,
11231124
cdata: &cstore::crate_metadata)
1124-
-> ty::substs
1125+
-> subst::Substs
11251126
{
11261127
self.read_opaque(|_, doc| {
11271128
Ok(tydecode::parse_substs_data(
@@ -1210,7 +1211,7 @@ impl<'a> ebml_decoder_decoder_helpers for reader::Decoder<'a> {
12101211
}).unwrap()
12111212
}
12121213

1213-
fn read_substs(&mut self, xcx: &ExtendedDecodeContext) -> ty::substs {
1214+
fn read_substs(&mut self, xcx: &ExtendedDecodeContext) -> subst::Substs {
12141215
self.read_opaque(|this, doc| {
12151216
Ok(tydecode::parse_substs_data(doc.data,
12161217
xcx.dcx.cdata.cnum,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use middle::freevars::freevar_entry;
1313
use middle::freevars;
14+
use middle::subst;
1415
use middle::ty;
1516
use middle::typeck;
1617
use util::ppaux::{Repr, ty_to_str};
@@ -19,7 +20,6 @@ use util::ppaux::UserString;
1920
use syntax::ast::*;
2021
use syntax::attr;
2122
use syntax::codemap::Span;
22-
use syntax::owned_slice::OwnedSlice;
2323
use syntax::print::pprust::{expr_to_str,path_to_str};
2424
use syntax::{visit,ast_util};
2525
use syntax::visit::Visitor;
@@ -87,8 +87,8 @@ fn check_struct_safe_for_destructor(cx: &mut Context,
8787
struct_did: DefId) {
8888
let struct_tpt = ty::lookup_item_type(cx.tcx, struct_did);
8989
if !struct_tpt.generics.has_type_params() {
90-
let struct_ty = ty::mk_struct(cx.tcx, struct_did, ty::substs {
91-
regions: ty::NonerasedRegions(OwnedSlice::empty()),
90+
let struct_ty = ty::mk_struct(cx.tcx, struct_did, subst::Substs {
91+
regions: subst::NonerasedRegions(Vec::new()),
9292
self_ty: None,
9393
tps: Vec::new()
9494
});

0 commit comments

Comments
 (0)