Skip to content

Commit 4c2f928

Browse files
committed
---
yaml --- r: 47099 b: refs/heads/try c: 6e40314 h: refs/heads/master i: 47097: b8a7d24 47095: a70e797 v: v3
1 parent 8381e0b commit 4c2f928

Some content is hidden

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

47 files changed

+1164
-439
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: 3bbcac322669cff3abde5be937cc4ec3860f3985
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
5-
refs/heads/try: b29476374ba90573a117ae2c3cac7c3183b69f33
5+
refs/heads/try: 6e40314bbf9c6e810e836296018de082c0e15d12
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rust.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ This requirement most often affects name-designator pairs when they occur at the
549549

550550
* `log_syntax!` : print out the arguments at compile time
551551
* `trace_macros!` : supply `true` or `false` to enable or disable printing of the macro expansion process.
552-
* `ident_to_str!` : turn the identifier argument into a string literal
552+
* `stringify!` : turn the identifier argument into a string literal
553553
* `concat_idents!` : create a new identifier by concatenating the arguments
554554

555555

@@ -1117,7 +1117,6 @@ a = Cat{ name: ~"Spotty", weight: 2.7 };
11171117

11181118
In this example, `Cat` is a _struct-like enum variant_,
11191119
whereas `Dog` is simply called an enum variant.
1120-
11211120
### Constants
11221121

11231122
~~~~~~~~ {.ebnf .gram}

branches/try/src/libcore/vec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,6 +1865,7 @@ pub trait OwnedVector<T> {
18651865
fn consume(self, f: fn(uint, v: T));
18661866
fn filter(self, f: fn(t: &T) -> bool) -> ~[T];
18671867
fn partition(self, f: pure fn(&T) -> bool) -> (~[T], ~[T]);
1868+
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
18681869
}
18691870

18701871
impl<T> OwnedVector<T> for ~[T] {
@@ -1936,6 +1937,11 @@ impl<T> OwnedVector<T> for ~[T] {
19361937
fn partition(self, f: fn(&T) -> bool) -> (~[T], ~[T]) {
19371938
partition(self, f)
19381939
}
1940+
1941+
#[inline]
1942+
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>) {
1943+
grow_fn(self, n, op);
1944+
}
19391945
}
19401946

19411947
impl<T> Mutable for ~[T] {
@@ -1946,7 +1952,6 @@ impl<T> Mutable for ~[T] {
19461952
pub trait OwnedCopyableVector<T: Copy> {
19471953
fn push_all(&mut self, rhs: &[const T]);
19481954
fn grow(&mut self, n: uint, initval: &T);
1949-
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
19501955
fn grow_set(&mut self, index: uint, initval: &T, val: T);
19511956
}
19521957

@@ -1961,11 +1966,6 @@ impl<T: Copy> OwnedCopyableVector<T> for ~[T] {
19611966
grow(self, n, initval);
19621967
}
19631968

1964-
#[inline]
1965-
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>) {
1966-
grow_fn(self, n, op);
1967-
}
1968-
19691969
#[inline]
19701970
fn grow_set(&mut self, index: uint, initval: &T, val: T) {
19711971
grow_set(self, index, initval, val);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ fn inject_libcore_ref(sess: Session,
4545
fold_crate: |crate, span, fld| {
4646
let n1 = sess.next_node_id();
4747
let vi1 = @ast::view_item {
48-
node: ast::view_item_use(sess.ident_of(~"core"), ~[], n1),
48+
node: ast::view_item_extern_mod(
49+
sess.ident_of(~"core"), ~[], n1),
4950
attrs: ~[
5051
spanned(ast::attribute_ {
5152
style: ast::attr_inner,
@@ -86,7 +87,7 @@ fn inject_libcore_ref(sess: Session,
8687
};
8788

8889
let vp = @spanned(ast::view_path_glob(prelude_path, n2));
89-
let vi2 = @ast::view_item { node: ast::view_item_import(~[vp]),
90+
let vi2 = @ast::view_item { node: ast::view_item_use(~[vp]),
9091
attrs: ~[],
9192
vis: ast::private,
9293
span: dummy_sp() };

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,13 @@ fn mk_std(cx: &TestCtxt) -> @ast::view_item {
266266
let mi = nospan(mi);
267267
let id_std = cx.sess.ident_of(~"std");
268268
let vi = if is_std(cx) {
269-
ast::view_item_import(
269+
ast::view_item_use(
270270
~[@nospan(ast::view_path_simple(id_std,
271271
path_node(~[id_std]),
272272
ast::type_value_ns,
273273
cx.sess.next_node_id()))])
274274
} else {
275-
ast::view_item_use(id_std, ~[@mi],
275+
ast::view_item_extern_mod(id_std, ~[@mi],
276276
cx.sess.next_node_id())
277277
};
278278
let vi = ast::view_item {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ fn visit_crate(e: @mut Env, c: ast::crate) {
142142

143143
fn visit_view_item(e: @mut Env, i: @ast::view_item) {
144144
match /*bad*/copy i.node {
145-
ast::view_item_use(ident, meta_items, id) => {
146-
debug!("resolving use stmt. ident: %?, meta: %?", ident, meta_items);
145+
ast::view_item_extern_mod(ident, meta_items, id) => {
146+
debug!("resolving extern mod stmt. ident: %?, meta: %?",
147+
ident, meta_items);
147148
let cnum = resolve_crate(e, ident, meta_items, ~"", i.span);
148-
cstore::add_use_stmt_cnum(e.cstore, id, cnum);
149+
cstore::add_extern_mod_stmt_cnum(e.cstore, id, cnum);
149150
}
150151
_ => ()
151152
}

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ pub type crate_metadata = @{name: ~str,
4040

4141
pub struct CStore {
4242
priv metas: oldmap::HashMap<ast::crate_num, crate_metadata>,
43-
priv use_crate_map: use_crate_map,
43+
priv extern_mod_crate_map: extern_mod_crate_map,
4444
priv used_crate_files: ~[Path],
4545
priv used_libraries: ~[~str],
4646
priv used_link_args: ~[~str],
4747
intr: @ident_interner
4848
}
4949

50-
// Map from node_id's of local use statements to crate numbers
51-
type use_crate_map = oldmap::HashMap<ast::node_id, ast::crate_num>;
50+
// Map from node_id's of local extern mod statements to crate numbers
51+
type extern_mod_crate_map = oldmap::HashMap<ast::node_id, ast::crate_num>;
5252

5353
pub fn mk_cstore(intr: @ident_interner) -> CStore {
5454
let meta_cache = oldmap::HashMap();
5555
let crate_map = oldmap::HashMap();
5656
return CStore {
5757
metas: meta_cache,
58-
use_crate_map: crate_map,
58+
extern_mod_crate_map: crate_map,
5959
used_crate_files: ~[],
6060
used_libraries: ~[],
6161
used_link_args: ~[],
@@ -127,18 +127,18 @@ pub fn get_used_link_args(cstore: @mut CStore) -> ~[~str] {
127127
return /*bad*/copy cstore.used_link_args;
128128
}
129129

130-
pub fn add_use_stmt_cnum(cstore: @mut CStore,
131-
use_id: ast::node_id,
132-
cnum: ast::crate_num) {
133-
let use_crate_map = cstore.use_crate_map;
134-
use_crate_map.insert(use_id, cnum);
130+
pub fn add_extern_mod_stmt_cnum(cstore: @mut CStore,
131+
emod_id: ast::node_id,
132+
cnum: ast::crate_num) {
133+
let extern_mod_crate_map = cstore.extern_mod_crate_map;
134+
extern_mod_crate_map.insert(emod_id, cnum);
135135
}
136136

137-
pub fn find_use_stmt_cnum(cstore: @mut CStore,
138-
use_id: ast::node_id)
137+
pub fn find_extern_mod_stmt_cnum(cstore: @mut CStore,
138+
emod_id: ast::node_id)
139139
-> Option<ast::crate_num> {
140-
let use_crate_map = cstore.use_crate_map;
141-
use_crate_map.find(&use_id)
140+
let extern_mod_crate_map = cstore.extern_mod_crate_map;
141+
extern_mod_crate_map.find(&emod_id)
142142
}
143143

144144
// returns hashes of crates directly used by this crate. Hashes are
@@ -147,8 +147,8 @@ pub fn get_dep_hashes(cstore: @mut CStore) -> ~[~str] {
147147
type crate_hash = {name: ~str, hash: ~str};
148148
let mut result = ~[];
149149

150-
let use_crate_map = cstore.use_crate_map;
151-
for use_crate_map.each_value |&cnum| {
150+
let extern_mod_crate_map = cstore.extern_mod_crate_map;
151+
for extern_mod_crate_map.each_value |&cnum| {
152152
let cdata = cstore::get_crate_data(cstore, cnum);
153153
let hash = decoder::get_crate_hash(cdata.data);
154154
debug!("Add hash[%s]: %s", cdata.name, hash);

branches/try/src/librustc/middle/resolve.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use driver::session::Session;
1515
use metadata::csearch::{each_path, get_method_names_if_trait};
1616
use metadata::csearch::{get_static_methods_if_impl, get_struct_fields};
1717
use metadata::csearch::{get_type_name_if_impl};
18-
use metadata::cstore::find_use_stmt_cnum;
18+
use metadata::cstore::find_extern_mod_stmt_cnum;
1919
use metadata::decoder::{def_like, dl_def, dl_field, dl_impl};
2020
use middle::lang_items::LanguageItems;
2121
use middle::lint::{deny, allow, forbid, level, unused_imports, warn};
@@ -55,7 +55,7 @@ use syntax::ast::{ty_bool, ty_char, ty_f, ty_f32, ty_f64, ty_float, ty_i};
5555
use syntax::ast::{ty_i16, ty_i32, ty_i64, ty_i8, ty_int, ty_param, ty_path};
5656
use syntax::ast::{ty_str, ty_u, ty_u16, ty_u32, ty_u64, ty_u8, ty_uint};
5757
use syntax::ast::{type_value_ns, ty_param_bound, unnamed_field};
58-
use syntax::ast::{variant, view_item, view_item_import};
58+
use syntax::ast::{variant, view_item, view_item_extern_mod};
5959
use syntax::ast::{view_item_use, view_path_glob, view_path_list};
6060
use syntax::ast::{view_path_simple, visibility, anonymous, named, not};
6161
use syntax::ast::{unsafe_fn};
@@ -1388,7 +1388,7 @@ pub impl Resolver {
13881388
&&_visitor: vt<ReducedGraphParent>) {
13891389
let privacy = visibility_to_privacy(view_item.vis);
13901390
match /*bad*/copy view_item.node {
1391-
view_item_import(view_paths) => {
1391+
view_item_use(view_paths) => {
13921392
for view_paths.each |view_path| {
13931393
// Extract and intern the module part of the path. For
13941394
// globs and lists, the path is found directly in the AST;
@@ -1462,8 +1462,9 @@ pub impl Resolver {
14621462
}
14631463
}
14641464
1465-
view_item_use(name, _, node_id) => {
1466-
match find_use_stmt_cnum(self.session.cstore, node_id) {
1465+
view_item_extern_mod(name, _, node_id) => {
1466+
match find_extern_mod_stmt_cnum(self.session.cstore,
1467+
node_id) {
14671468
Some(crate_id) => {
14681469
let (child_name_bindings, new_parent) =
14691470
self.add_child(name, parent, ForbidDuplicateTypes,

branches/try/src/librustc/middle/typeck/check/_match.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ pub fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
362362
ast::pat_ident(*) if pat_is_const(tcx.def_map, pat) => {
363363
let const_did = ast_util::def_id_of_def(tcx.def_map.get(&pat.id));
364364
let const_tpt = ty::lookup_item_type(tcx, const_did);
365+
demand::suptype(fcx, pat.span, expected, const_tpt.ty);
365366
fcx.write_ty(pat.id, const_tpt.ty);
366367
}
367368
ast::pat_ident(bm, name, sub) if pat_is_binding(tcx.def_map, pat) => {

0 commit comments

Comments
 (0)