Skip to content

Commit 62d2aab

Browse files
author
Lenny222
committed
---
yaml --- r: 60154 b: refs/heads/master c: e323033 h: refs/heads/master v: v3
1 parent c80d915 commit 62d2aab

Some content is hidden

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

84 files changed

+529
-579
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1393c3a3f438c896083405dca501c8cf05767c65
2+
refs/heads/master: e3230330b7a30bc83a15cfdfc23df5ef17a070c1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
55
refs/heads/try: c50a9d5b664478e533ba1d1d353213d70c8ad589

trunk/doc/tutorial-ffi.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ pub struct Unique<T> {
157157
priv ptr: *mut T
158158
}
159159
160-
pub impl<'self, T: Owned> Unique<T> {
160+
pub impl<T: Owned> Unique<T> {
161161
fn new(value: T) -> Unique<T> {
162162
unsafe {
163163
let ptr = malloc(core::sys::size_of::<T>() as size_t) as *mut T;
@@ -168,14 +168,14 @@ pub impl<'self, T: Owned> Unique<T> {
168168
}
169169
}
170170
171-
// the 'self lifetime results in the same semantics as `&*x` with ~T
172-
fn borrow(&self) -> &'self T {
173-
unsafe { cast::transmute(self.ptr) }
171+
// the 'r lifetime results in the same semantics as `&*x` with ~T
172+
fn borrow<'r>(&'r self) -> &'r T {
173+
unsafe { cast::copy_lifetime(self, &*self.ptr) }
174174
}
175175
176-
// the 'self lifetime results in the same semantics as `&mut *x` with ~T
177-
fn borrow_mut(&mut self) -> &'self mut T {
178-
unsafe { cast::transmute(self.ptr) }
176+
// the 'r lifetime results in the same semantics as `&mut *x` with ~T
177+
fn borrow_mut<'r>(&'r mut self) -> &'r mut T {
178+
unsafe { cast::copy_mut_lifetime(self, &mut *self.ptr) }
179179
}
180180
}
181181

trunk/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ fn _arm_exec_compiled_test(config: config, props: TestProps,
764764
logv(config, fmt!("executing (%s) %s", config.target, cmdline));
765765
766766
// adb shell dose not forward stdout and stderr of internal result
767-
// to stdout and stderr seperately but to stdout only
767+
// to stdout and stderr separately but to stdout only
768768
let mut newargs_out = ~[];
769769
let mut newargs_err = ~[];
770770
let subargs = args.args;

trunk/src/libcore/at_vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub fn capacity<T>(v: @[T]) -> uint {
5252
* # Arguments
5353
*
5454
* * size - An initial size of the vector to reserve
55-
* * builder - A function that will construct the vector. It recieves
55+
* * builder - A function that will construct the vector. It receives
5656
* as an argument a function that will push an element
5757
* onto the vector being constructed.
5858
*/
@@ -70,7 +70,7 @@ pub fn build_sized<A>(size: uint, builder: &fn(push: &fn(v: A))) -> @[A] {
7070
*
7171
* # Arguments
7272
*
73-
* * builder - A function that will construct the vector. It recieves
73+
* * builder - A function that will construct the vector. It receives
7474
* as an argument a function that will push an element
7575
* onto the vector being constructed.
7676
*/
@@ -87,7 +87,7 @@ pub fn build<A>(builder: &fn(push: &fn(v: A))) -> @[A] {
8787
* # Arguments
8888
*
8989
* * size - An option, maybe containing initial size of the vector to reserve
90-
* * builder - A function that will construct the vector. It recieves
90+
* * builder - A function that will construct the vector. It receives
9191
* as an argument a function that will push an element
9292
* onto the vector being constructed.
9393
*/

trunk/src/libcore/cast.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ pub unsafe fn copy_lifetime<'a,S,T>(_ptr: &'a S, ptr: &T) -> &'a T {
108108
transmute_region(ptr)
109109
}
110110

111+
/// Transforms lifetime of the second pointer to match the first.
112+
#[inline(always)]
113+
pub unsafe fn copy_mut_lifetime<'a,S,T>(_ptr: &'a mut S, ptr: &mut T) -> &'a mut T {
114+
transmute_mut_region(ptr)
115+
}
116+
111117
/// Transforms lifetime of the second pointer to match the first.
112118
#[inline(always)]
113119
pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {

trunk/src/libcore/iter.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ breaking out of iteration. The adaptors in the module work with any such iterato
1717
tied to specific traits. For example:
1818
1919
~~~~
20-
use core::iter::iter_to_vec;
21-
println(iter_to_vec(|f| uint::range(0, 20, f)).to_str());
20+
println(iter::to_vec(|f| uint::range(0, 20, f)).to_str());
2221
~~~~
2322
2423
An external iterator object implementing the interface in the `iterator` module can be used as an
@@ -55,12 +54,12 @@ pub trait Times {
5554
*
5655
* ~~~
5756
* let xs = ~[1, 2, 3];
58-
* let ys = do iter_to_vec |f| { xs.each(|x| f(*x)) };
57+
* let ys = do iter::to_vec |f| { xs.each(|x| f(*x)) };
5958
* assert_eq!(xs, ys);
6059
* ~~~
6160
*/
6261
#[inline(always)]
63-
pub fn iter_to_vec<T>(iter: &fn(f: &fn(T) -> bool)) -> ~[T] {
62+
pub fn to_vec<T>(iter: &fn(f: &fn(T) -> bool)) -> ~[T] {
6463
let mut v = ~[];
6564
for iter |x| { v.push(x) }
6665
v
@@ -185,9 +184,9 @@ mod tests {
185184
use prelude::*;
186185

187186
#[test]
188-
fn test_iter_to_vec() {
187+
fn test_to_vec() {
189188
let xs = ~[1, 2, 3];
190-
let ys = do iter_to_vec |f| { xs.each(|x| f(*x)) };
189+
let ys = do to_vec |f| { xs.each(|x| f(*x)) };
191190
assert_eq!(xs, ys);
192191
}
193192

trunk/src/libcore/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ mod tests {
378378
#[test]
379379
fn test_counter_to_vec() {
380380
let mut it = Counter::new(0, 5).take(10);
381-
let xs = iter::iter_to_vec(|f| it.advance(f));
381+
let xs = iter::to_vec(|f| it.advance(f));
382382
assert_eq!(xs, ~[0, 5, 10, 15, 20, 25, 30, 35, 40, 45]);
383383
}
384384

trunk/src/libcore/rt/io/extensions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! Utility mixins that apply to all Readers and Writers
1212
1313
// XXX: Not sure how this should be structured
14-
// XXX: Iteration should probably be considered seperately
14+
// XXX: Iteration should probably be considered separately
1515

1616
pub trait ReaderUtil {
1717

trunk/src/libcore/task/local_data_priv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ unsafe fn get_newsched_local_map(local: *mut LocalStorage) -> TaskLocalMap {
133133

134134
unsafe fn key_to_key_value<T: 'static>(key: LocalDataKey<T>) -> *libc::c_void {
135135
// Keys are closures, which are (fnptr,envptr) pairs. Use fnptr.
136-
// Use reintepret_cast -- transmute would leak (forget) the closure.
136+
// Use reinterpret_cast -- transmute would leak (forget) the closure.
137137
let pair: (*libc::c_void, *libc::c_void) = cast::transmute_copy(&key);
138138
pair.first()
139139
}

trunk/src/libcore/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub fn build<A>(builder: &fn(push: &fn(v: A))) -> ~[A] {
219219
* # Arguments
220220
*
221221
* * size - An option, maybe containing initial size of the vector to reserve
222-
* * builder - A function that will construct the vector. It recieves
222+
* * builder - A function that will construct the vector. It receives
223223
* as an argument a function that will push an element
224224
* onto the vector being constructed.
225225
*/

trunk/src/librustc/back/link.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,8 @@ pub fn exported_name(sess: Session,
698698
vers: &str) -> ~str {
699699
return mangle(sess,
700700
vec::append_one(
701-
vec::append_one(path, path_name(sess.ident_of(hash))),
702-
path_name(sess.ident_of(vers))));
701+
vec::append_one(path, path_name(sess.ident_of(hash.to_owned()))),
702+
path_name(sess.ident_of(vers.to_owned()))));
703703
}
704704
705705
pub fn mangle_exported_name(ccx: @CrateContext,
@@ -717,14 +717,14 @@ pub fn mangle_internal_name_by_type_only(ccx: @CrateContext,
717717
let s = ppaux::ty_to_short_str(ccx.tcx, t);
718718
let hash = get_symbol_hash(ccx, t);
719719
return mangle(ccx.sess,
720-
~[path_name(ccx.sess.ident_of(name)),
720+
~[path_name(ccx.sess.ident_of(name.to_owned())),
721721
path_name(ccx.sess.ident_of(s)),
722-
path_name(ccx.sess.ident_of(hash))]);
722+
path_name(ccx.sess.ident_of(hash.to_owned()))]);
723723
}
724724
725725
pub fn mangle_internal_name_by_path_and_seq(ccx: @CrateContext,
726726
path: path,
727-
flav: &str) -> ~str {
727+
flav: ~str) -> ~str {
728728
return mangle(ccx.sess,
729729
vec::append_one(path, path_name((ccx.names)(flav))));
730730
}
@@ -733,7 +733,7 @@ pub fn mangle_internal_name_by_path(ccx: @CrateContext, path: path) -> ~str {
733733
return mangle(ccx.sess, path);
734734
}
735735
736-
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, flav: &str) -> ~str {
736+
pub fn mangle_internal_name_by_seq(ccx: @CrateContext, flav: ~str) -> ~str {
737737
return fmt!("%s_%u", flav, (ccx.names)(flav).repr);
738738
}
739739

trunk/src/librustc/driver/session.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ pub impl Session_ {
284284
fn str_of(@self, id: ast::ident) -> @~str {
285285
self.parse_sess.interner.get(id)
286286
}
287-
fn ident_of(@self, st: &str) -> ast::ident {
288-
self.parse_sess.interner.intern(st)
287+
fn ident_of(@self, st: ~str) -> ast::ident {
288+
self.parse_sess.interner.intern(@st)
289289
}
290290
fn intr(@self) -> @syntax::parse::token::ident_interner {
291291
self.parse_sess.interner

trunk/src/librustc/front/core_inject.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn inject_libcore_ref(sess: Session,
4242
let n1 = sess.next_node_id();
4343
let vi1 = @ast::view_item {
4444
node: ast::view_item_extern_mod(
45-
sess.ident_of("core"), ~[], n1),
45+
sess.ident_of(~"core"), ~[], n1),
4646
attrs: ~[
4747
spanned(ast::attribute_ {
4848
style: ast::attr_inner,
@@ -78,8 +78,8 @@ fn inject_libcore_ref(sess: Session,
7878
span: dummy_sp(),
7979
global: false,
8080
idents: ~[
81-
sess.ident_of("core"),
82-
sess.ident_of("prelude")
81+
sess.ident_of(~"core"),
82+
sess.ident_of(~"prelude")
8383
],
8484
rp: None,
8585
types: ~[]

trunk/src/librustc/front/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ fn mk_std(cx: &TestCtxt) -> @ast::view_item {
274274
let vers = nospan(vers);
275275
let mi = ast::meta_name_value(@~"vers", vers);
276276
let mi = nospan(mi);
277-
let id_std = cx.sess.ident_of("std");
277+
let id_std = cx.sess.ident_of(~"std");
278278
let vi = if is_std(cx) {
279279
ast::view_item_use(
280280
~[@nospan(ast::view_path_simple(id_std,
@@ -322,7 +322,7 @@ fn mk_test_module(cx: &TestCtxt) -> @ast::item {
322322
attr::mk_attr(attr::mk_word_item(@~"!resolve_unexported"));
323323

324324
let item = ast::item {
325-
ident: cx.sess.ident_of("__test"),
325+
ident: cx.sess.ident_of(~"__test"),
326326
attrs: ~[resolve_unexported_attr],
327327
id: cx.sess.next_node_id(),
328328
node: item_,

trunk/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub fn get_item_path(tcx: ty::ctxt, def: ast::def_id) -> ast_map::path {
7070
// FIXME #1920: This path is not always correct if the crate is not linked
7171
// into the root namespace.
7272
vec::append(~[ast_map::path_mod(tcx.sess.ident_of(
73-
*cdata.name))], path)
73+
/*bad*/copy *cdata.name))], path)
7474
}
7575

7676
pub enum found_ast {

trunk/src/librustc/metadata/decoder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ fn item_path(intr: @ident_interner, item_doc: ebml::Doc) -> ast_map::path {
294294
for reader::docs(path_doc) |tag, elt_doc| {
295295
if tag == tag_path_elt_mod {
296296
let str = reader::doc_as_str(elt_doc);
297-
result.push(ast_map::path_mod(intr.intern(str)));
297+
result.push(ast_map::path_mod(intr.intern(@str)));
298298
} else if tag == tag_path_elt_name {
299299
let str = reader::doc_as_str(elt_doc);
300-
result.push(ast_map::path_name(intr.intern(str)));
300+
result.push(ast_map::path_name(intr.intern(@str)));
301301
} else {
302302
// ignore tag_path_len element
303303
}
@@ -311,7 +311,7 @@ fn item_name(intr: @ident_interner, item: ebml::Doc) -> ast::ident {
311311
do reader::with_doc_data(name) |data| {
312312
let string = str::from_bytes_slice(data);
313313
match intr.find_equiv(&StringRef(string)) {
314-
None => intr.intern(string),
314+
None => intr.intern(@(string.to_owned())),
315315
Some(val) => val,
316316
}
317317
}
@@ -828,7 +828,7 @@ pub fn get_type_name_if_impl(intr: @ident_interner,
828828
}
829829

830830
for reader::tagged_docs(item, tag_item_impl_type_basename) |doc| {
831-
return Some(intr.intern(str::from_bytes(reader::doc_data(doc))));
831+
return Some(intr.intern(@str::from_bytes(reader::doc_data(doc))));
832832
}
833833

834834
return None;
@@ -1080,7 +1080,7 @@ pub fn get_crate_deps(intr: @ident_interner, data: @~[u8]) -> ~[crate_dep] {
10801080
}
10811081
for reader::tagged_docs(depsdoc, tag_crate_dep) |depdoc| {
10821082
deps.push(crate_dep {cnum: crate_num,
1083-
name: intr.intern(docstr(depdoc, tag_crate_dep_name)),
1083+
name: intr.intern(@docstr(depdoc, tag_crate_dep_name)),
10841084
vers: @docstr(depdoc, tag_crate_dep_vers),
10851085
hash: @docstr(depdoc, tag_crate_dep_hash)});
10861086
crate_num += 1;

trunk/src/librustc/middle/astencode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ trait fake_ext_ctxt {
11631163
fn cfg(&self) -> ast::crate_cfg;
11641164
fn parse_sess(&self) -> @mut parse::ParseSess;
11651165
fn call_site(&self) -> span;
1166-
fn ident_of(&self, st: &str) -> ast::ident;
1166+
fn ident_of(&self, st: ~str) -> ast::ident;
11671167
}
11681168

11691169
#[cfg(test)]
@@ -1180,8 +1180,8 @@ impl fake_ext_ctxt for fake_session {
11801180
expn_info: None
11811181
}
11821182
}
1183-
fn ident_of(&self, st: &str) -> ast::ident {
1184-
self.interner.intern(st)
1183+
fn ident_of(&self, st: ~str) -> ast::ident {
1184+
self.interner.intern(@st)
11851185
}
11861186
}
11871187

trunk/src/librustc/middle/resolve.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ pub struct PrimitiveTypeTable {
708708
}
709709
710710
pub impl PrimitiveTypeTable {
711-
fn intern(&mut self, intr: @ident_interner, string: &str,
711+
fn intern(&mut self, intr: @ident_interner, string: @~str,
712712
primitive_type: prim_ty) {
713713
let ident = intr.intern(string);
714714
self.primitive_types.insert(ident, primitive_type);
@@ -720,22 +720,22 @@ pub fn PrimitiveTypeTable(intr: @ident_interner) -> PrimitiveTypeTable {
720720
primitive_types: HashMap::new()
721721
};
722722
723-
table.intern(intr, "bool", ty_bool);
724-
table.intern(intr, "char", ty_int(ty_char));
725-
table.intern(intr, "float", ty_float(ty_f));
726-
table.intern(intr, "f32", ty_float(ty_f32));
727-
table.intern(intr, "f64", ty_float(ty_f64));
728-
table.intern(intr, "int", ty_int(ty_i));
729-
table.intern(intr, "i8", ty_int(ty_i8));
730-
table.intern(intr, "i16", ty_int(ty_i16));
731-
table.intern(intr, "i32", ty_int(ty_i32));
732-
table.intern(intr, "i64", ty_int(ty_i64));
733-
table.intern(intr, "str", ty_str);
734-
table.intern(intr, "uint", ty_uint(ty_u));
735-
table.intern(intr, "u8", ty_uint(ty_u8));
736-
table.intern(intr, "u16", ty_uint(ty_u16));
737-
table.intern(intr, "u32", ty_uint(ty_u32));
738-
table.intern(intr, "u64", ty_uint(ty_u64));
723+
table.intern(intr, @~"bool", ty_bool);
724+
table.intern(intr, @~"char", ty_int(ty_char));
725+
table.intern(intr, @~"float", ty_float(ty_f));
726+
table.intern(intr, @~"f32", ty_float(ty_f32));
727+
table.intern(intr, @~"f64", ty_float(ty_f64));
728+
table.intern(intr, @~"int", ty_int(ty_i));
729+
table.intern(intr, @~"i8", ty_int(ty_i8));
730+
table.intern(intr, @~"i16", ty_int(ty_i16));
731+
table.intern(intr, @~"i32", ty_int(ty_i32));
732+
table.intern(intr, @~"i64", ty_int(ty_i64));
733+
table.intern(intr, @~"str", ty_str);
734+
table.intern(intr, @~"uint", ty_uint(ty_u));
735+
table.intern(intr, @~"u8", ty_uint(ty_u8));
736+
table.intern(intr, @~"u16", ty_uint(ty_u16));
737+
table.intern(intr, @~"u32", ty_uint(ty_u32));
738+
table.intern(intr, @~"u64", ty_uint(ty_u64));
739739
740740
return table;
741741
}
@@ -1675,7 +1675,7 @@ pub impl Resolver {
16751675

16761676
let mut current_module = root;
16771677
for pieces.each |ident_str| {
1678-
let ident = self.session.ident_of(*ident_str);
1678+
let ident = self.session.ident_of(/*bad*/copy *ident_str);
16791679
// Create or reuse a graph node for the child.
16801680
let (child_name_bindings, new_parent) =
16811681
self.add_child(ident,

0 commit comments

Comments
 (0)