Skip to content

Commit 5e043b6

Browse files
committed
---
yaml --- r: 112207 b: refs/heads/try c: 02081e7 h: refs/heads/master i: 112205: 8de9695 112203: 3f99f06 112199: 9b87381 112191: 724178f v: v3
1 parent 5af9d32 commit 5e043b6

Some content is hidden

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

42 files changed

+886
-315
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: a692e9b1234ff6573b0cfbc39394d9222eb38f81
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b5dd3f05fe95168b5569d0f519636149479eb6ac
5-
refs/heads/try: 37306c1d25a6bb8d1e96adaff6a360d6163b8f29
5+
refs/heads/try: 02081e7c41d5780ae59fd8e6f68193a8fe737ced
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/doc/complement-cheatsheet.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let x: int = 42;
2929
let y: ~str = format!("{:t}", x); // binary
3030
let y: ~str = format!("{:o}", x); // octal
3131
let y: ~str = format!("{:x}", x); // lowercase hexadecimal
32-
let y: ~str = format!("{:X}", x); // uppercase hexidecimal
32+
let y: ~str = format!("{:X}", x); // uppercase hexadecimal
3333
~~~
3434

3535
**String to int, in non-base-10**

branches/try/src/doc/guide-ffi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Besides classical synchronization mechanisms like mutexes, one possibility in
337337
Rust is to use channels (in `std::comm`) to forward data from the C thread
338338
that invoked the callback into a Rust task.
339339

340-
If an asychronous callback targets a special object in the Rust address space
340+
If an asynchronous callback targets a special object in the Rust address space
341341
it is also absolutely necessary that no more callbacks are performed by the
342342
C library after the respective Rust object gets destroyed.
343343
This can be achieved by unregistering the callback in the object's

branches/try/src/doc/guide-lifetimes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ points at a static constant).
561561

562562
Lifetimes can be named and referenced. For example, the special lifetime
563563
`'static`, which does not go out of scope, can be used to create global
564-
variables and communicate between tasks (see the manual for usecases).
564+
variables and communicate between tasks (see the manual for use cases).
565565

566566
## Parameter Lifetimes
567567

branches/try/src/doc/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Now here's the exciting part:
226226
because `numbers` is an owned type,
227227
when it is sent across the channel,
228228
it is actually *moved*,
229-
transfering ownership of `numbers` between tasks.
229+
transferring ownership of `numbers` between tasks.
230230
This ownership transfer is *very fast* -
231231
in this case simply copying a pointer -
232232
while also ensuring that the original owning task cannot create data races by continuing to read or write to `numbers` in parallel with the new owner.
@@ -318,7 +318,7 @@ fn main() {
318318
This is almost exactly the same,
319319
except that this time `numbers` is first put into an `Arc`.
320320
`Arc::new` creates the `Arc`,
321-
`.clone()` makes another `Arc` that referrs to the same contents.
321+
`.clone()` makes another `Arc` that refers to the same contents.
322322
So we clone the `Arc` for each task,
323323
send that clone down the channel,
324324
and then use it to print out a number.

branches/try/src/doc/rust.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Raw string literals do not process any escapes. They start with the character
295295
`U+0022` (double-quote) character. The _raw string body_ is not defined in the
296296
EBNF grammar above: it can contain any sequence of Unicode characters and is
297297
terminated only by another `U+0022` (double-quote) character, followed by the
298-
same number of `U+0023` (`#`) characters that preceeded the opening `U+0022`
298+
same number of `U+0023` (`#`) characters that preceded the opening `U+0022`
299299
(double-quote) character.
300300

301301
All Unicode characters contained in the raw string body represent themselves,
@@ -1214,6 +1214,22 @@ struct Cookie;
12141214
let c = [Cookie, Cookie, Cookie, Cookie];
12151215
~~~~
12161216

1217+
By using the `struct_inherit` feature gate, structures may use single inheritance. A Structure may only
1218+
inherit from a single other structure, called the _super-struct_. The inheriting structure (sub-struct)
1219+
acts as if all fields in the super-struct were present in the sub-struct. Fields declared in a sub-struct
1220+
must not have the same name as any field in any (transitive) super-struct. All fields (both declared
1221+
and inherited) must be specified in any initializers. Inheritance between structures does not give
1222+
subtyping or coercion. The super-struct and sub-struct must be defined in the same crate. The super-struct
1223+
must be declared using the `virtual` keyword.
1224+
For example:
1225+
1226+
~~~~ {.ignore}
1227+
virtual struct Sup { x: int }
1228+
struct Sub : Sup { y: int }
1229+
let s = Sub {x: 10, y: 11};
1230+
let sx = s.x;
1231+
~~~~
1232+
12171233
### Enumerations
12181234

12191235
An _enumeration_ is a simultaneous definition of a nominal [enumerated type](#enumerated-types) as well as a set of *constructors*,
@@ -2240,7 +2256,7 @@ fn main() {
22402256
Certain aspects of Rust may be implemented in the compiler, but they're not
22412257
necessarily ready for every-day use. These features are often of "prototype
22422258
quality" or "almost production ready", but may not be stable enough to be
2243-
considered a full-fleged language feature.
2259+
considered a full-fledged language feature.
22442260

22452261
For this reason, Rust recognizes a special crate-level attribute of the form:
22462262

@@ -3989,7 +4005,7 @@ dependencies will be used:
39894005
could only be found in an `rlib` format. Remember that `staticlib` formats
39904006
are always ignored by `rustc` for crate-linking purposes.
39914007

3992-
2. If a static library is being produced, all upstream dependecies are
4008+
2. If a static library is being produced, all upstream dependencies are
39934009
required to be available in `rlib` formats. This requirement stems from the
39944010
same reasons that a dynamic library must have all dynamic dependencies.
39954011

branches/try/src/librustc/front/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ fn fold_struct(cx: &Context, def: &ast::StructDef) -> @ast::StructDef {
151151
@ast::StructDef {
152152
fields: fields.collect(),
153153
ctor_id: def.ctor_id,
154+
super_struct: def.super_struct.clone(),
155+
is_virtual: def.is_virtual,
154156
}
155157
}
156158

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
5555
("default_type_params", Active),
5656
("quote", Active),
5757
("linkage", Active),
58+
("struct_inherit", Active),
5859

5960
// These are used to test this portion of the compiler, they don't actually
6061
// mean anything
@@ -190,11 +191,22 @@ impl<'a> Visitor<()> for Context<'a> {
190191
}
191192
}
192193

193-
ast::ItemStruct(..) => {
194+
ast::ItemStruct(struct_definition, _) => {
194195
if attr::contains_name(i.attrs.as_slice(), "simd") {
195196
self.gate_feature("simd", i.span,
196197
"SIMD types are experimental and possibly buggy");
197198
}
199+
match struct_definition.super_struct {
200+
Some(ref path) => self.gate_feature("struct_inherit", path.span,
201+
"struct inheritance is experimental \
202+
and possibly buggy"),
203+
None => {}
204+
}
205+
if struct_definition.is_virtual {
206+
self.gate_feature("struct_inherit", i.span,
207+
"struct inheritance (`virtual` keyword) is \
208+
experimental and possibly buggy");
209+
}
198210
}
199211

200212
_ => {}

branches/try/src/librustc/metadata/common.rs

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ pub static tag_path_len: uint = 0x25;
9292
pub static tag_path_elem_mod: uint = 0x26;
9393
pub static tag_path_elem_name: uint = 0x27;
9494
pub static tag_item_field: uint = 0x28;
95+
pub static tag_item_field_origin: uint = 0x29;
9596

9697
pub static tag_item_variances: uint = 0x2a;
9798
/*
@@ -102,43 +103,43 @@ pub static tag_item_variances: uint = 0x2a;
102103
both, tag_item_trait_method and tag_item_impl_method have to be two
103104
different tags.
104105
*/
105-
pub static tag_item_impl_method: uint = 0x2c;
106-
pub static tag_item_trait_method_explicit_self: uint = 0x2d;
106+
pub static tag_item_impl_method: uint = 0x30;
107+
pub static tag_item_trait_method_explicit_self: uint = 0x31;
107108

108109

109110
// Reexports are found within module tags. Each reexport contains def_ids
110111
// and names.
111-
pub static tag_items_data_item_reexport: uint = 0x2f;
112-
pub static tag_items_data_item_reexport_def_id: uint = 0x30;
113-
pub static tag_items_data_item_reexport_name: uint = 0x31;
112+
pub static tag_items_data_item_reexport: uint = 0x38;
113+
pub static tag_items_data_item_reexport_def_id: uint = 0x39;
114+
pub static tag_items_data_item_reexport_name: uint = 0x3a;
114115

115116
// used to encode crate_ctxt side tables
116117
#[deriving(Eq)]
117118
#[repr(uint)]
118-
pub enum astencode_tag { // Reserves 0x32 -- 0x45
119-
tag_ast = 0x32,
120-
121-
tag_tree = 0x33,
122-
123-
tag_id_range = 0x34,
124-
125-
tag_table = 0x35,
126-
tag_table_id = 0x36,
127-
tag_table_val = 0x37,
128-
tag_table_def = 0x38,
129-
tag_table_node_type = 0x39,
130-
tag_table_node_type_subst = 0x3a,
131-
tag_table_freevars = 0x3b,
132-
tag_table_tcache = 0x3c,
133-
tag_table_param_defs = 0x3d,
134-
tag_table_mutbl = 0x3e,
135-
tag_table_last_use = 0x3f,
136-
tag_table_spill = 0x40,
137-
tag_table_method_map = 0x41,
138-
tag_table_vtable_map = 0x42,
139-
tag_table_adjustments = 0x43,
140-
tag_table_moves_map = 0x44,
141-
tag_table_capture_map = 0x45
119+
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
120+
tag_ast = 0x40,
121+
122+
tag_tree = 0x41,
123+
124+
tag_id_range = 0x42,
125+
126+
tag_table = 0x43,
127+
tag_table_id = 0x44,
128+
tag_table_val = 0x45,
129+
tag_table_def = 0x46,
130+
tag_table_node_type = 0x47,
131+
tag_table_node_type_subst = 0x48,
132+
tag_table_freevars = 0x49,
133+
tag_table_tcache = 0x4a,
134+
tag_table_param_defs = 0x4b,
135+
tag_table_mutbl = 0x4c,
136+
tag_table_last_use = 0x4d,
137+
tag_table_spill = 0x4e,
138+
tag_table_method_map = 0x4f,
139+
tag_table_vtable_map = 0x50,
140+
tag_table_adjustments = 0x51,
141+
tag_table_moves_map = 0x52,
142+
tag_table_capture_map = 0x53
142143
}
143144
static first_astencode_tag: uint = tag_ast as uint;
144145
static last_astencode_tag: uint = tag_table_capture_map as uint;
@@ -151,9 +152,9 @@ impl astencode_tag {
151152
}
152153
}
153154

154-
pub static tag_item_trait_method_sort: uint = 0x46;
155+
pub static tag_item_trait_method_sort: uint = 0x60;
155156

156-
pub static tag_item_impl_type_basename: uint = 0x47;
157+
pub static tag_item_impl_type_basename: uint = 0x61;
157158

158159
// Language items are a top-level directory (for speed). Hierarchy:
159160
//
@@ -162,42 +163,42 @@ pub static tag_item_impl_type_basename: uint = 0x47;
162163
// - tag_lang_items_item_id: u32
163164
// - tag_lang_items_item_node_id: u32
164165

165-
pub static tag_lang_items: uint = 0x48;
166-
pub static tag_lang_items_item: uint = 0x49;
167-
pub static tag_lang_items_item_id: uint = 0x4a;
168-
pub static tag_lang_items_item_node_id: uint = 0x4b;
166+
pub static tag_lang_items: uint = 0x70;
167+
pub static tag_lang_items_item: uint = 0x71;
168+
pub static tag_lang_items_item_id: uint = 0x72;
169+
pub static tag_lang_items_item_node_id: uint = 0x73;
169170

170-
pub static tag_item_unnamed_field: uint = 0x4c;
171-
pub static tag_items_data_item_visibility: uint = 0x4e;
171+
pub static tag_item_unnamed_field: uint = 0x74;
172+
pub static tag_items_data_item_visibility: uint = 0x76;
172173

173-
pub static tag_item_method_tps: uint = 0x51;
174-
pub static tag_item_method_fty: uint = 0x52;
174+
pub static tag_item_method_tps: uint = 0x79;
175+
pub static tag_item_method_fty: uint = 0x7a;
175176

176-
pub static tag_mod_child: uint = 0x53;
177-
pub static tag_misc_info: uint = 0x54;
178-
pub static tag_misc_info_crate_items: uint = 0x55;
177+
pub static tag_mod_child: uint = 0x7b;
178+
pub static tag_misc_info: uint = 0x7c;
179+
pub static tag_misc_info_crate_items: uint = 0x7d;
179180

180-
pub static tag_item_method_provided_source: uint = 0x56;
181-
pub static tag_item_impl_vtables: uint = 0x57;
181+
pub static tag_item_method_provided_source: uint = 0x7e;
182+
pub static tag_item_impl_vtables: uint = 0x7f;
182183

183-
pub static tag_impls: uint = 0x58;
184-
pub static tag_impls_impl: uint = 0x59;
184+
pub static tag_impls: uint = 0x80;
185+
pub static tag_impls_impl: uint = 0x81;
185186

186-
pub static tag_items_data_item_inherent_impl: uint = 0x5a;
187-
pub static tag_items_data_item_extension_impl: uint = 0x5b;
187+
pub static tag_items_data_item_inherent_impl: uint = 0x82;
188+
pub static tag_items_data_item_extension_impl: uint = 0x83;
188189

189-
pub static tag_region_param_def: uint = 0x5c;
190-
pub static tag_region_param_def_ident: uint = 0x5d;
191-
pub static tag_region_param_def_def_id: uint = 0x5e;
190+
pub static tag_region_param_def: uint = 0x84;
191+
pub static tag_region_param_def_ident: uint = 0x85;
192+
pub static tag_region_param_def_def_id: uint = 0x86;
192193

193-
pub static tag_native_libraries: uint = 0x5f;
194-
pub static tag_native_libraries_lib: uint = 0x60;
195-
pub static tag_native_libraries_name: uint = 0x61;
196-
pub static tag_native_libraries_kind: uint = 0x62;
194+
pub static tag_native_libraries: uint = 0x87;
195+
pub static tag_native_libraries_lib: uint = 0x88;
196+
pub static tag_native_libraries_name: uint = 0x89;
197+
pub static tag_native_libraries_kind: uint = 0x8a;
197198

198-
pub static tag_macro_registrar_fn: uint = 0x63;
199-
pub static tag_exported_macros: uint = 0x64;
200-
pub static tag_macro_def: uint = 0x65;
199+
pub static tag_macro_registrar_fn: uint = 0x8b;
200+
pub static tag_exported_macros: uint = 0x8c;
201+
pub static tag_macro_def: uint = 0x8d;
201202

202203
#[deriving(Clone, Show)]
203204
pub struct LinkMeta {

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,21 +975,27 @@ pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
975975
// FIXME #6993: name should be of type Name, not Ident
976976
let name = item_name(&*intr, an_item);
977977
let did = item_def_id(an_item, cdata);
978+
let tagdoc = reader::get_doc(an_item, tag_item_field_origin);
979+
let origin_id = translate_def_id(cdata, reader::with_doc_data(tagdoc, parse_def_id));
978980
result.push(ty::field_ty {
979981
name: name.name,
980-
id: did, vis:
981-
struct_field_family_to_visibility(f),
982+
id: did,
983+
vis: struct_field_family_to_visibility(f),
984+
origin: origin_id,
982985
});
983986
}
984987
true
985988
});
986989
reader::tagged_docs(item, tag_item_unnamed_field, |an_item| {
987990
let did = item_def_id(an_item, cdata);
991+
let tagdoc = reader::get_doc(an_item, tag_item_field_origin);
988992
let f = item_family(an_item);
993+
let origin_id = translate_def_id(cdata, reader::with_doc_data(tagdoc, parse_def_id));
989994
result.push(ty::field_ty {
990995
name: special_idents::unnamed_field.name,
991996
id: did,
992997
vis: struct_field_family_to_visibility(f),
998+
origin: origin_id,
993999
});
9941000
true
9951001
});

0 commit comments

Comments
 (0)