Skip to content

Commit 09f9396

Browse files
committed
---
yaml --- r: 130267 b: refs/heads/auto c: 3c610af h: refs/heads/master i: 130265: 02b68b7 130263: 6a74106 v: v3
1 parent f16c794 commit 09f9396

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

+179
-600
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: f7ec95efbb96f8e9bcb8b5e71b5d13803e840dc9
16+
refs/heads/auto: 3c610af6706a66b185807b8ec721f454e16625de
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/complement-lang-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ We want to maintain the option to parametrize at runtime. We may eventually chan
8383

8484
## Why aren't values type-parametric? Why only items?
8585

86-
Doing so would make type inference much more complex, and require the implementation strategy of runtime parameterization.
86+
Doing so would make type inference much more complex, and require the implementation strategy of runtime parametrization.
8787

8888
## Why are enumerations nominal and closed?
8989

branches/auto/src/doc/guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1808,7 +1808,7 @@ our code in this file. We'll talk about multiple-file projects later on in the
18081808
guide.
18091809

18101810
Before we move on, let me show you one more Cargo command: `run`. `cargo run`
1811-
is kind of like `cargo build`, but it also then runs the produced executable.
1811+
is kind of like `cargo build`, but it also then runs the produced exectuable.
18121812
Try it out:
18131813

18141814
```{notrust,ignore}

branches/auto/src/doc/rust.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,7 @@ On `struct`s:
19541954

19551955
- `repr` - specifies the representation to use for this struct. Takes a list
19561956
of options. The currently accepted ones are `C` and `packed`, which may be
1957-
combined. `C` will use a C ABI compatible struct layout, and `packed` will
1957+
combined. `C` will use a C ABI comptible struct layout, and `packed` will
19581958
remove any padding between fields (note that this is very fragile and may
19591959
break platforms which require aligned access).
19601960

@@ -2367,7 +2367,7 @@ One can indicate the stability of an API using the following attributes:
23672367
These levels are directly inspired by
23682368
[Node.js' "stability index"](http://nodejs.org/api/documentation.html).
23692369

2370-
Stability levels are inherited, so an item's stability attribute is the
2370+
Stability levels are inherited, so an items's stability attribute is the
23712371
default stability for everything nested underneath it.
23722372

23732373
There are lints for disallowing items marked with certain levels: `deprecated`,
@@ -2444,7 +2444,7 @@ The currently implemented features of the reference compiler are:
24442444

24452445
* `concat_idents` - Allows use of the `concat_idents` macro, which is in many
24462446
ways insufficient for concatenating identifiers, and may
2447-
be removed entirely for something more wholesome.
2447+
be removed entirely for something more wholsome.
24482448

24492449
* `default_type_params` - Allows use of default type parameters. The future of
24502450
this feature is uncertain.
@@ -3604,7 +3604,7 @@ of the type.[^structtype]
36043604

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

3607-
The memory layout of a `struct` is undefined by default to allow for compiler optimizations like
3607+
The memory layout of a `struct` is undefined by default to allow for compiler optimziations like
36083608
field reordering, but it can be fixed with the `#[repr(...)]` attribute.
36093609
In either case, fields may be given in any order in a corresponding struct *expression*;
36103610
the resulting `struct` value will always have the same memory layout.
@@ -3668,17 +3668,32 @@ let a: List<int> = Cons(7, box Cons(13, box Nil));
36683668

36693669
All pointers in Rust are explicit first-class values.
36703670
They can be copied, stored into data structures, and returned from functions.
3671-
There are two varieties of pointer in Rust:
3671+
There are four varieties of pointer in Rust:
3672+
3673+
* Owning pointers (`Box`)
3674+
: These point to owned heap allocations (or "boxes") in the shared, inter-task heap.
3675+
Each owned box has a single owning pointer; pointer and pointee retain a 1:1 relationship at all times.
3676+
Owning pointers are written `Box<content>`,
3677+
for example `Box<int>` means an owning pointer to an owned box containing an integer.
3678+
Copying an owned box is a "deep" operation:
3679+
it involves allocating a new owned box and copying the contents of the old box into the new box.
3680+
Releasing an owning pointer immediately releases its corresponding owned box.
36723681

36733682
* References (`&`)
36743683
: These point to memory _owned by some other value_.
3675-
A reference type is written `&type` for some lifetime-variable `f`,
3676-
or just `&'a type` when you need an explicit lifetime.
3684+
References arise by (automatic) conversion from owning pointers, managed pointers,
3685+
or by applying the borrowing operator `&` to some other value,
3686+
including [lvalues, rvalues or temporaries](#lvalues,-rvalues-and-temporaries).
3687+
A borrow expression is written `&content`.
3688+
3689+
A reference type is written `&'f type` for some lifetime-variable `f`,
3690+
or just `&type` when the lifetime can be elided;
3691+
for example `&int` means a reference to an integer.
36773692
Copying a reference is a "shallow" operation:
36783693
it involves only copying the pointer itself.
36793694
Releasing a reference typically has no effect on the value it points to,
3680-
with the exception of temporary values, which are released when the last
3681-
reference to them is released.
3695+
with the exception of temporary values,
3696+
which are released when the last reference to them is released.
36823697

36833698
* Raw pointers (`*`)
36843699
: Raw pointers are pointers without safety or liveness guarantees.
@@ -3691,9 +3706,6 @@ There are two varieties of pointer in Rust:
36913706
they exist to support interoperability with foreign code,
36923707
and writing performance-critical or low-level functions.
36933708

3694-
The standard library contains addtional 'smart pointer' types beyond references
3695-
and raw pointers.
3696-
36973709
### Function types
36983710

36993711
The function type constructor `fn` forms new function types.
@@ -4202,7 +4214,7 @@ be ignored in favor of only building the artifacts specified by command line.
42024214
purpose of this output type is to create a static library containing all of
42034215
the local crate's code along with all upstream dependencies. The static
42044216
library is actually a `*.a` archive on linux and osx and a `*.lib` file on
4205-
windows. This format is recommended for use in situations such as linking
4217+
windows. This format is recommended for use in situtations such as linking
42064218
Rust code into an existing non-Rust application because it will not have
42074219
dynamic dependencies on other Rust code.
42084220

branches/auto/src/libnum/complex.rs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
//! Complex numbers.
1313
1414
use std::fmt;
15-
use std::num::{Zero, One, ToStrRadix};
15+
use std::num::{Zero,One,ToStrRadix};
1616

1717
// FIXME #1284: handle complex NaN & infinity etc. This
1818
// probably doesn't map to C's _Complex correctly.
1919

2020
/// A complex number in Cartesian form.
21-
#[deriving(PartialEq, Clone, Hash)]
21+
#[deriving(PartialEq,Clone)]
2222
pub struct Complex<T> {
2323
/// Real portion of the complex number
2424
pub re: T,
@@ -36,8 +36,10 @@ impl<T: Clone + Num> Complex<T> {
3636
Complex { re: re, im: im }
3737
}
3838

39-
/// Returns the square of the norm (since `T` doesn't necessarily
40-
/// have a sqrt function), i.e. `re^2 + im^2`.
39+
/**
40+
Returns the square of the norm (since `T` doesn't necessarily
41+
have a sqrt function), i.e. `re^2 + im^2`.
42+
*/
4143
#[inline]
4244
pub fn norm_sqr(&self) -> T {
4345
self.re * self.re + self.im * self.im
@@ -191,8 +193,7 @@ mod test {
191193
#![allow(non_uppercase_statics)]
192194

193195
use super::{Complex64, Complex};
194-
use std::num::{Zero, One, Float};
195-
use std::hash::hash;
196+
use std::num::{Zero,One,Float};
196197

197198
pub static _0_0i : Complex64 = Complex { re: 0.0, im: 0.0 };
198199
pub static _1_0i : Complex64 = Complex { re: 1.0, im: 0.0 };
@@ -366,14 +367,4 @@ mod test {
366367
test(-_neg1_1i, "1-1i".to_string());
367368
test(_05_05i, "0.5+0.5i".to_string());
368369
}
369-
370-
#[test]
371-
fn test_hash() {
372-
let a = Complex::new(0i32, 0i32);
373-
let b = Complex::new(1i32, 0i32);
374-
let c = Complex::new(0i32, 1i32);
375-
assert!(hash(&a) != hash(&b));
376-
assert!(hash(&b) != hash(&c));
377-
assert!(hash(&c) != hash(&a));
378-
}
379370
}

branches/auto/src/libnum/rational.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::num::{Zero, One, ToStrRadix, FromStrRadix};
2121
use bigint::{BigInt, BigUint, Sign, Plus, Minus};
2222

2323
/// Represents the ratio between 2 numbers.
24-
#[deriving(Clone, Hash)]
24+
#[deriving(Clone)]
2525
#[allow(missing_doc)]
2626
pub struct Ratio<T> {
2727
numer: T,
@@ -380,7 +380,6 @@ mod test {
380380
use super::{Ratio, Rational, BigRational};
381381
use std::num::{Zero, One, FromStrRadix, FromPrimitive, ToStrRadix};
382382
use std::from_str::FromStr;
383-
use std::hash::hash;
384383
use std::num;
385384

386385
pub static _0 : Rational = Ratio { numer: 0, denom: 1};
@@ -752,10 +751,4 @@ mod test {
752751
assert!(! _neg1_2.is_positive());
753752
assert!(! _1_2.is_negative());
754753
}
755-
756-
#[test]
757-
fn test_hash() {
758-
assert!(hash(&_0) != hash(&_1));
759-
assert!(hash(&_0) != hash(&_3_2));
760-
}
761754
}

branches/auto/src/librustc/diagnostics.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,5 @@ register_diagnostics!(
170170
E0156,
171171
E0157,
172172
E0158,
173-
E0159,
174-
E0160
173+
E0159
175174
)

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

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@ struct TestCtxt<'a> {
5050
path: Vec<ast::Ident>,
5151
ext_cx: ExtCtxt<'a>,
5252
testfns: Vec<Test>,
53+
reexport_mod_ident: ast::Ident,
5354
reexport_test_harness_main: Option<InternedString>,
5455
is_test_crate: bool,
5556
config: ast::CrateConfig,
56-
57-
// top-level re-export submodule, filled out after folding is finished
58-
toplevel_reexport: Option<ast::Ident>,
5957
}
6058

6159
// Traverse the crate, collecting all the test functions, eliding any
@@ -85,9 +83,7 @@ pub fn modify_for_testing(sess: &Session,
8583
struct TestHarnessGenerator<'a> {
8684
cx: TestCtxt<'a>,
8785
tests: Vec<ast::Ident>,
88-
89-
// submodule name, gensym'd identifier for re-exports
90-
tested_submods: Vec<(ast::Ident, ast::Ident)>,
86+
tested_submods: Vec<ast::Ident>,
9187
}
9288

9389
impl<'a> fold::Folder for TestHarnessGenerator<'a> {
@@ -172,14 +168,10 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
172168
*i = nomain(*i);
173169
}
174170
if !tests.is_empty() || !tested_submods.is_empty() {
175-
let (it, sym) = mk_reexport_mod(&mut self.cx, tests, tested_submods);
176-
mod_folded.items.push(it);
177-
171+
mod_folded.items.push(mk_reexport_mod(&mut self.cx, tests,
172+
tested_submods));
178173
if !self.cx.path.is_empty() {
179-
self.tested_submods.push((self.cx.path[self.cx.path.len()-1], sym));
180-
} else {
181-
debug!("pushing nothing, sym: {}", sym);
182-
self.cx.toplevel_reexport = Some(sym);
174+
self.tested_submods.push(self.cx.path[self.cx.path.len()-1]);
183175
}
184176
}
185177

@@ -188,16 +180,16 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
188180
}
189181

190182
fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>,
191-
tested_submods: Vec<(ast::Ident, ast::Ident)>) -> (Gc<ast::Item>, ast::Ident) {
183+
tested_submods: Vec<ast::Ident>) -> Gc<ast::Item> {
192184
let mut view_items = Vec::new();
193185
let super_ = token::str_to_ident("super");
194186

195187
view_items.extend(tests.move_iter().map(|r| {
196188
cx.ext_cx.view_use_simple(DUMMY_SP, ast::Public,
197189
cx.ext_cx.path(DUMMY_SP, vec![super_, r]))
198190
}));
199-
view_items.extend(tested_submods.move_iter().map(|(r, sym)| {
200-
let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, sym]);
191+
view_items.extend(tested_submods.move_iter().map(|r| {
192+
let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, cx.reexport_mod_ident]);
201193
cx.ext_cx.view_use_simple_(DUMMY_SP, ast::Public, r, path)
202194
}));
203195

@@ -206,18 +198,14 @@ fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>,
206198
view_items: view_items,
207199
items: Vec::new(),
208200
};
209-
210-
let sym = token::gensym_ident("__test_reexports");
211-
let it = box(GC) ast::Item {
212-
ident: sym.clone(),
201+
box(GC) ast::Item {
202+
ident: cx.reexport_mod_ident.clone(),
213203
attrs: Vec::new(),
214204
id: ast::DUMMY_NODE_ID,
215205
node: ast::ItemMod(reexport_mod),
216206
vis: ast::Public,
217207
span: DUMMY_SP,
218-
};
219-
220-
(it, sym)
208+
}
221209
}
222210

223211
fn generate_test_harness(sess: &Session,
@@ -232,10 +220,10 @@ fn generate_test_harness(sess: &Session,
232220
}),
233221
path: Vec::new(),
234222
testfns: Vec::new(),
223+
reexport_mod_ident: token::gensym_ident("__test_reexports"),
235224
reexport_test_harness_main: reexport_test_harness_main,
236225
is_test_crate: is_test_crate(&krate),
237226
config: krate.config.clone(),
238-
toplevel_reexport: None,
239227
};
240228

241229
cx.ext_cx.bt_push(ExpnInfo {
@@ -542,14 +530,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> Gc<ast::Expr> {
542530
field("should_fail", fail_expr)]);
543531

544532

545-
let mut visible_path = match cx.toplevel_reexport {
546-
Some(id) => vec![id],
547-
None => {
548-
cx.sess.bug(
549-
"expected to find top-level re-export name, but found None"
550-
);
551-
}
552-
};
533+
let mut visible_path = vec![cx.reexport_mod_ident.clone()];
553534
visible_path.extend(path.move_iter());
554535

555536
let fn_expr = ecx.expr_path(ecx.path_global(span, visible_path));

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

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,18 +1073,9 @@ impl<'a> rbml_writer_helpers for Encoder<'a> {
10731073
this.emit_enum_variant_arg(0, |this| Ok(this.emit_unsize_kind(ecx, uk)))
10741074
})
10751075
}
1076-
&ty::AutoUnsafe(m, None) => {
1077-
this.emit_enum_variant("AutoUnsafe", 3, 2, |this| {
1078-
this.emit_enum_variant_arg(0, |this| m.encode(this));
1079-
this.emit_enum_variant_arg(1,
1080-
|this| this.emit_option(|this| this.emit_option_none()))
1081-
})
1082-
}
1083-
&ty::AutoUnsafe(m, Some(box ref a)) => {
1084-
this.emit_enum_variant("AutoUnsafe", 3, 2, |this| {
1085-
this.emit_enum_variant_arg(0, |this| m.encode(this));
1086-
this.emit_enum_variant_arg(1, |this| this.emit_option(
1087-
|this| this.emit_option_some(|this| Ok(this.emit_autoref(ecx, a)))))
1076+
&ty::AutoUnsafe(m) => {
1077+
this.emit_enum_variant("AutoUnsafe", 3, 1, |this| {
1078+
this.emit_enum_variant_arg(0, |this| m.encode(this))
10881079
})
10891080
}
10901081
}
@@ -1644,16 +1635,8 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> {
16441635
3 => {
16451636
let m: ast::Mutability =
16461637
this.read_enum_variant_arg(0, |this| Decodable::decode(this)).unwrap();
1647-
let a: Option<Box<ty::AutoRef>> =
1648-
this.read_enum_variant_arg(1, |this| this.read_option(|this, b| {
1649-
if b {
1650-
Ok(Some(box this.read_autoref(xcx)))
1651-
} else {
1652-
Ok(None)
1653-
}
1654-
})).unwrap();
16551638

1656-
ty::AutoUnsafe(m, a)
1639+
ty::AutoUnsafe(m)
16571640
}
16581641
_ => fail!("bad enum variant for ty::AutoRef")
16591642
})

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ impl<'d,'t,TYPER:mc::Typer> ExprUseVisitor<'d,'t,TYPER> {
762762
ty::BorrowKind::from_mutbl(m),
763763
AutoRef);
764764
}
765-
ty::AutoUnsizeUniq(_) | ty::AutoUnsize(_) | ty::AutoUnsafe(..) => {}
765+
ty::AutoUnsizeUniq(_) | ty::AutoUnsize(_) | ty::AutoUnsafe(_) => {}
766766
}
767767
}
768768

branches/auto/src/librustc/middle/trans/adt.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,8 @@ impl Case {
296296

297297
for (i, &ty) in self.tys.iter().enumerate() {
298298
match ty::get(ty).sty {
299-
// &T/&mut T/*T could either be a thin or fat pointer depending on T
300-
ty::ty_rptr(_, ty::mt { ty, .. })
301-
| ty::ty_ptr(ty::mt { ty, .. }) => match ty::get(ty).sty {
299+
// &T/&mut T could either be a thin or fat pointer depending on T
300+
ty::ty_rptr(_, ty::mt { ty, .. }) => match ty::get(ty).sty {
302301
// &[T] and &str are a pointer and length pair
303302
ty::ty_vec(_, None) | ty::ty_str => return Some(FatPointer(i, slice_elt_base)),
304303

branches/auto/src/librustc/middle/trans/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,8 @@ pub fn compare_scalar_types<'a>(
566566

567567
match ty::get(t).sty {
568568
ty::ty_nil => f(nil_type),
569-
ty::ty_bool | ty::ty_uint(_) | ty::ty_char => f(unsigned_int),
570-
ty::ty_ptr(mt) if ty::type_is_sized(cx.tcx(), mt.ty) => f(unsigned_int),
569+
ty::ty_bool | ty::ty_ptr(_) |
570+
ty::ty_uint(_) | ty::ty_char => f(unsigned_int),
571571
ty::ty_int(_) => f(signed_int),
572572
ty::ty_float(_) => f(floating_point),
573573
// Should never get here, because t is scalar.

0 commit comments

Comments
 (0)