Skip to content

Commit a06493a

Browse files
committed
---
yaml --- r: 209375 b: refs/heads/auto c: 23ec007 h: refs/heads/master i: 209373: 60aeca7 209371: 57d0516 209367: 2e64ef2 209359: 4af750b 209343: 082b8e6 v: v3
1 parent 524005e commit a06493a

File tree

21 files changed

+81
-134
lines changed

21 files changed

+81
-134
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 4f66d881a54d1f94d0684174b9c5cc32fe8e69ce
13+
refs/heads/auto: 23ec00751e8da1b8f138745cfcf6d861c0987915
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ that all delimiters be balanced.
160160
## `->` for function return type
161161

162162
This is to make the language easier to parse for humans, especially in the face
163-
of higher-order functions. `fn foo<T>(f: fn(i32): i32, fn(T): U): U` is not
163+
of higher-order functions. `fn foo<T>(f: fn(int): int, fn(T): U): U` is not
164164
particularly easy to read.
165165

166166
## Why is `let` used to introduce variables?

branches/auto/src/doc/style/errors/ergonomics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use std::io::{File, Open, Write, IoError};
1414

1515
struct Info {
1616
name: String,
17-
age: i32,
18-
rating: i32
17+
age: int,
18+
rating: int
1919
}
2020

2121
fn write_info(info: &Info) -> Result<(), IoError> {
@@ -36,8 +36,8 @@ use std::io::{File, Open, Write, IoError};
3636

3737
struct Info {
3838
name: String,
39-
age: i32,
40-
rating: i32
39+
age: int,
40+
rating: int
4141
}
4242

4343
fn write_info(info: &Info) -> Result<(), IoError> {

branches/auto/src/doc/style/features/functions-and-methods/input.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ it becomes.
5757
Prefer
5858

5959
```rust
60-
fn foo<T: Iterator<i32>>(c: T) { ... }
60+
fn foo<T: Iterator<int>>(c: T) { ... }
6161
```
6262

6363
over any of
6464

6565
```rust
66-
fn foo(c: &[i32]) { ... }
67-
fn foo(c: &Vec<i32>) { ... }
68-
fn foo(c: &SomeOtherCollection<i32>) { ... }
66+
fn foo(c: &[int]) { ... }
67+
fn foo(c: &Vec<int>) { ... }
68+
fn foo(c: &SomeOtherCollection<int>) { ... }
6969
```
7070

7171
if the function only needs to iterate over the data.
@@ -121,7 +121,7 @@ The primary exception: sometimes a function is meant to modify data
121121
that the caller already owns, for example to re-use a buffer:
122122

123123
```rust
124-
fn read(&mut self, buf: &mut [u8]) -> IoResult<usize>
124+
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>
125125
```
126126

127127
(From the [Reader trait](http://static.rust-lang.org/doc/master/std/io/trait.Reader.html#tymethod.read).)

branches/auto/src/doc/style/features/functions-and-methods/output.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ Prefer
1919
```rust
2020
struct SearchResult {
2121
found: bool, // item in container?
22-
expected_index: usize // what would the item's index be?
22+
expected_index: uint // what would the item's index be?
2323
}
2424

2525
fn binary_search(&self, k: Key) -> SearchResult
2626
```
2727
or
2828

2929
```rust
30-
fn binary_search(&self, k: Key) -> (bool, usize)
30+
fn binary_search(&self, k: Key) -> (bool, uint)
3131
```
3232

3333
over

branches/auto/src/doc/style/features/let.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Prefer
66

77
```rust
8-
fn use_mutex(m: sync::mutex::Mutex<i32>) {
8+
fn use_mutex(m: sync::mutex::Mutex<int>) {
99
let guard = m.lock();
1010
do_work(guard);
1111
drop(guard); // unlock the lock
@@ -16,7 +16,7 @@ fn use_mutex(m: sync::mutex::Mutex<i32>) {
1616
over
1717

1818
```rust
19-
fn use_mutex(m: sync::mutex::Mutex<i32>) {
19+
fn use_mutex(m: sync::mutex::Mutex<int>) {
2020
do_work(m.lock());
2121
// do other work
2222
}

branches/auto/src/doc/style/features/traits/reuse.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ trait Printable {
1515
fn print(&self) { println!("{:?}", *self) }
1616
}
1717

18-
impl Printable for i32 {}
18+
impl Printable for int {}
1919

2020
impl Printable for String {
2121
fn print(&self) { println!("{}", *self) }

branches/auto/src/doc/style/features/types/newtype.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ promises to the client.
4343

4444
For example, consider a function `my_transform` that returns a compound iterator
4545
type `Enumerate<Skip<vec::MoveItems<T>>>`. We wish to hide this type from the
46-
client, so that the client's view of the return type is roughly `Iterator<(usize,
46+
client, so that the client's view of the return type is roughly `Iterator<(uint,
4747
T)>`. We can do so using the newtype pattern:
4848

4949
```rust
5050
struct MyTransformResult<T>(Enumerate<Skip<vec::MoveItems<T>>>);
51-
impl<T> Iterator<(usize, T)> for MyTransformResult<T> { ... }
51+
impl<T> Iterator<(uint, T)> for MyTransformResult<T> { ... }
5252

5353
fn my_transform<T, Iter: Iterator<T>>(iter: Iter) -> MyTransformResult<T> {
5454
...

branches/auto/src/doc/style/style/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Terminate `return` statements with semicolons:
44

55
``` rust
6-
fn foo(bar: i32) -> Option<i32> {
6+
fn foo(bar: int) -> Option<int> {
77
if some_condition() {
88
return None;
99
}

branches/auto/src/doc/style/style/imports.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ For example:
4444
use option::Option;
4545
use mem;
4646

47-
let i: isize = mem::transmute(Option(0));
47+
let i: int = mem::transmute(Option(0));
4848
```
4949

5050
> **[FIXME]** Add rationale.

branches/auto/src/doc/style/style/whitespace.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
``` rust
1212
#[deprecated = "Use `bar` instead."]
13-
fn foo(a: usize, b: usize) -> usize {
13+
fn foo(a: uint, b: uint) -> uint {
1414
a + b
1515
}
1616
```

branches/auto/src/doc/trpl/associated-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ trait Graph {
4343
Now, our clients can be abstract over a given `Graph`:
4444

4545
```rust,ignore
46-
fn distance<G: Graph>(graph: &G, start: &G::N, end: &G::N) -> usize { ... }
46+
fn distance<G: Graph>(graph: &G, start: &G::N, end: &G::N) -> uint { ... }
4747
```
4848

4949
No need to deal with the `E`dge type here!

branches/auto/src/doc/trpl/box-syntax-and-patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn main() {
5858
```
5959

6060
The idea is that by passing around a box, you're only copying a pointer, rather
61-
than the hundred `i32`s that make up the `BigStruct`.
61+
than the hundred `int`s that make up the `BigStruct`.
6262

6363
This is an antipattern in Rust. Instead, write this:
6464

branches/auto/src/doc/trpl/references-and-borrowing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ fn main() {
206206
^
207207
```
208208

209-
In other words, the mutable borow is held through the rest of our example. What
209+
In other words, the mutable borrow is held through the rest of our example. What
210210
we want is for the mutable borrow to end _before_ we try to call `println!` and
211211
make an immutable borrow. In Rust, borrowing is tied to the scope that the
212212
borrow is valid for. And our scopes look like this:

branches/auto/src/doc/trpl/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ print_area(5);
146146
We get a compile-time error:
147147

148148
```text
149-
error: the trait `HasArea` is not implemented for the type `_` [E0277]
149+
error: failed to find an implementation of trait main::HasArea for int
150150
```
151151

152152
So far, we’ve only added trait implementations to structs, but you can

branches/auto/src/libcore/num/isize.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// except according to those terms.
1010

1111
//! Operations and constants for pointer-sized signed integers (`isize` type)
12+
//!
13+
//! This type was recently added to replace `int`. The rollout of the
14+
//! new type will gradually take place over the alpha cycle along with
15+
//! the development of clearer conventions around integer types.
1216
1317
#![stable(feature = "rust1", since = "1.0.0")]
1418
#![doc(primitive = "isize")]

branches/auto/src/libcore/num/usize.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// except according to those terms.
1010

1111
//! Operations and constants for pointer-sized unsigned integers (`usize` type)
12+
//!
13+
//! This type was recently added to replace `uint`. The rollout of the
14+
//! new type will gradually take place over the alpha cycle along with
15+
//! the development of clearer conventions around integer types.
1216
1317
#![stable(feature = "rust1", since = "1.0.0")]
1418
#![doc(primitive = "usize")]

branches/auto/src/librustc_trans/save/dump_csv.rs

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
508508
self.process_formals(&decl.inputs, &fn_data.qualname);
509509
self.process_generic_params(ty_params, item.span, &fn_data.qualname, item.id);
510510
} else {
511-
self.sess.span_bug(item.span, "expected FunctionData");
511+
unreachable!();
512512
}
513513

514514
for arg in &decl.inputs {
@@ -538,7 +538,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
538538
&var_data.type_value,
539539
var_data.scope);
540540
} else {
541-
self.sess.span_bug(item.span, "expected VariableData");
541+
unreachable!();
542542
}
543543

544544
self.visit_ty(&typ);
@@ -768,18 +768,22 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
768768
}
769769

770770
fn process_mod(&mut self,
771-
item: &ast::Item) { // The module in question, represented as an item.
772-
let mod_data = self.save_ctxt.get_item_data(item);
773-
if let super::Data::ModData(mod_data) = mod_data {
774-
self.fmt.mod_str(item.span,
775-
Some(mod_data.span),
776-
mod_data.id,
777-
&mod_data.qualname,
778-
mod_data.scope,
779-
&mod_data.filename);
780-
} else {
781-
self.sess.span_bug(item.span, "expected ModData");
782-
}
771+
item: &ast::Item, // The module in question, represented as an item.
772+
m: &ast::Mod) {
773+
let qualname = format!("::{}", self.analysis.ty_cx.map.path_to_string(item.id));
774+
775+
let cm = self.sess.codemap();
776+
let filename = cm.span_to_filename(m.inner);
777+
778+
let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Mod);
779+
self.fmt.mod_str(item.span,
780+
sub_span,
781+
item.id,
782+
&qualname[..],
783+
self.cur_scope,
784+
&filename[..]);
785+
786+
self.nest(item.id, |v| visit::walk_mod(v, m));
783787
}
784788

785789
fn process_path(&mut self,
@@ -1184,10 +1188,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
11841188
}
11851189
ast::ItemTrait(_, ref generics, ref trait_refs, ref methods) =>
11861190
self.process_trait(item, generics, trait_refs, methods),
1187-
ast::ItemMod(ref m) => {
1188-
self.process_mod(item);
1189-
self.nest(item.id, |v| visit::walk_mod(v, m));
1190-
}
1191+
ast::ItemMod(ref m) => self.process_mod(item, m),
11911192
ast::ItemTy(ref ty, ref ty_params) => {
11921193
let qualname = format!("::{}", self.analysis.ty_cx.map.path_to_string(item.id));
11931194
let value = ty_to_string(&**ty);
@@ -1294,22 +1295,30 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
12941295
ast::ExprStruct(ref path, ref fields, ref base) =>
12951296
self.process_struct_lit(ex, path, fields, base),
12961297
ast::ExprMethodCall(_, _, ref args) => self.process_method_call(ex, args),
1297-
ast::ExprField(ref sub_ex, _) => {
1298+
ast::ExprField(ref sub_ex, ident) => {
12981299
if generated_code(sub_ex.span) {
12991300
return
13001301
}
13011302

1302-
self.visit_expr(&sub_ex);
1303-
1304-
let field_data = self.save_ctxt.get_expr_data(ex);
1305-
if let super::Data::VariableRefData(field_data) = field_data {
1306-
self.fmt.ref_str(recorder::VarRef,
1307-
ex.span,
1308-
Some(field_data.span),
1309-
field_data.ref_id,
1310-
field_data.scope);
1311-
} else {
1312-
self.sess.span_bug(ex.span, "expected VariableRefData");
1303+
self.visit_expr(&**sub_ex);
1304+
let ty = &ty::expr_ty_adjusted(&self.analysis.ty_cx, &**sub_ex).sty;
1305+
match *ty {
1306+
ty::ty_struct(def_id, _) => {
1307+
let fields = ty::lookup_struct_fields(&self.analysis.ty_cx, def_id);
1308+
for f in &fields {
1309+
if f.name == ident.node.name {
1310+
let sub_span = self.span.span_for_last_ident(ex.span);
1311+
self.fmt.ref_str(recorder::VarRef,
1312+
ex.span,
1313+
sub_span,
1314+
f.id,
1315+
self.cur_scope);
1316+
break;
1317+
}
1318+
}
1319+
}
1320+
_ => self.sess.span_bug(ex.span,
1321+
&format!("Expected struct type, found {:?}", ty)),
13131322
}
13141323
},
13151324
ast::ExprTupField(ref sub_ex, idx) => {

0 commit comments

Comments
 (0)