Skip to content

Rollup of 14 pull requests #28220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 60 commits into from
Sep 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c6b0fcc
Add long diagnostics for E0329
AlisdairO Sep 2, 2015
facdf2e
Add an intital HIR and lowering step
nrc Jul 31, 2015
cd138dc
Auto merge of #28138 - nrc:hir, r=nikomatsakis
bors Sep 2, 2015
28bf68f
Makes formatting of struct keyword consistent
id4ho Sep 3, 2015
7c8c72d
Introduce 'make doc' -> 'make docs'
steveklabnik Sep 2, 2015
69c3b39
Auto merge of #28174 - steveklabnik:gh14705, r=alexcricton
bors Sep 3, 2015
1661947
Auto merge of #28182 - jackwilsonv:patch-2, r=steveklabnik
bors Sep 3, 2015
865d6c3
Fix mistake in trait.md
xiaochuanyu Sep 3, 2015
3903ea9
Make `null()` and `null_mut()` const functions
petrochenkov Sep 2, 2015
6fcdead
Bash output fix to match real 'ruby embed.rb' call
thomas07vt Sep 3, 2015
06fb196
Use `null()`/`null_mut()` instead of `0 as *const T`/`0 as *mut T`
petrochenkov Sep 3, 2015
405c616
Use consistent terminology for byte string literals
petrochenkov Sep 3, 2015
fcad49e
remove totally useless struct-field index
Sep 1, 2015
cde09e7
rewrite metadata indexing
Sep 2, 2015
b6a3978
clippy improvements to iterators
llogiq Sep 3, 2015
a520568
Elide lifetimes in libcore
Manishearth Sep 3, 2015
e1f8919
take mapped function by mutable reference
llogiq Sep 3, 2015
9e9c83b
Auto merge of #28176 - arielb1:fast-index, r=eddyb
bors Sep 3, 2015
e5e4744
Fixes #27886 -- bitrig does not use jemalloc (yet)
Sep 3, 2015
9e79fc2
Add an issue number to this FIXME
steveklabnik Sep 3, 2015
7732ad8
Move lints to HIR
Manishearth Sep 3, 2015
0762f58
Auto merge of #28192 - Manishearth:lint-hir, r=eddyb
bors Sep 3, 2015
130e8d4
add long diagnostics for E0214
AlisdairO Sep 3, 2015
2a40e46
Rollup merge of #28164 - AlisdairO:diagnostics329, r=Manishearth
Manishearth Sep 3, 2015
8b2b949
book: replace comma with a more suitable character
tshepang Sep 3, 2015
83aee74
reference grammar: loop label should be optional
matklad Sep 3, 2015
3525a13
book: "word" feels more suitable than "name"
tshepang Sep 3, 2015
986f523
Take method invocation semantics out of chapter on deref coercion.
benschulz Sep 3, 2015
000fe00
reference grammar: remove duplicate else_tail rule
matklad Sep 3, 2015
59f2343
reference grammar: remove procedure_type
matklad Sep 3, 2015
197cec6
book: Rust is a language, so no need to mention that fact here
tshepang Sep 3, 2015
23956ae
book: improve flow
tshepang Sep 3, 2015
355847f
doc: reduce indentation of examples to 4 spaces
tshepang Sep 3, 2015
0c29243
Rollup merge of #28184 - xiaochuanyu:patch-1, r=alexcrichton
Manishearth Sep 3, 2015
67616f7
Rollup merge of #28186 - thomas07vt:thomas07vt-patch-trpl-rust-inside…
Manishearth Sep 3, 2015
9ea8f3e
Rollup merge of #28187 - petrochenkov:null, r=aturon
Manishearth Sep 3, 2015
cac4a1c
Rollup merge of #28188 - Manishearth:elide-core, r=alexcrichton
Manishearth Sep 3, 2015
3c4d6d6
Rollup merge of #28191 - llogiq:iter, r=Manishearth
Manishearth Sep 3, 2015
75ca401
Rollup merge of #28193 - dhuseby:fixing_bitrig_alloc_crate_tests, r=a…
Manishearth Sep 3, 2015
956c597
Rollup merge of #28194 - steveklabnik:add_fixme, r=alexcrichton
Manishearth Sep 3, 2015
94807b2
Rollup merge of #28195 - AlisdairO:diagnostics214, r=Manishearth
Manishearth Sep 3, 2015
e6e175b
Add ptr import (fixup #28187)
Manishearth Sep 3, 2015
1b908be
Auto merge of #28200 - Manishearth:rollup, r=Manishearth
bors Sep 3, 2015
6cdba4f
book: it is RwLock, not RWLock
tshepang Sep 3, 2015
f7d5c25
reference grammar: whitespace cleanup
matklad Sep 3, 2015
73a6199
reference grammar: fix item definition
matklad Sep 3, 2015
055c23d
Rollup merge of #28167 - petrochenkov:bytelit, r=nikomatsakis
steveklabnik Sep 4, 2015
b96618e
Rollup merge of #28202 - matklad:grammar-loop-labels, r=steveklabnik
steveklabnik Sep 4, 2015
723ebc2
Rollup merge of #28203 - benschulz:book-deref-coercion, r=brson
steveklabnik Sep 4, 2015
3501973
Rollup merge of #28204 - matklad:grammar-duplicate-else-tail, r=steve…
steveklabnik Sep 4, 2015
54279e0
Rollup merge of #28205 - matklad:grammar-remove-proc, r=alexcrichton
steveklabnik Sep 4, 2015
a10e876
Rollup merge of #28207 - tshepang:flow, r=steveklabnik
steveklabnik Sep 4, 2015
ff7f5cd
Rollup merge of #28208 - matklad:grammar-whitespace-cleanup, r=stevek…
steveklabnik Sep 4, 2015
1401b46
Rollup merge of #28209 - tshepang:must-be-four-spaces, r=steveklabnik
steveklabnik Sep 4, 2015
e903d9c
Rollup merge of #28210 - tshepang:typo, r=steveklabnik
steveklabnik Sep 4, 2015
5b8241c
Rollup merge of #28212 - tshepang:rust-is-a-language, r=steveklabnik
steveklabnik Sep 4, 2015
ce20719
Rollup merge of #28213 - tshepang:replace-comma, r=steveklabnik
steveklabnik Sep 4, 2015
fd10ded
Rollup merge of #28214 - tshepang:word-not-name, r=steveklabnik
steveklabnik Sep 4, 2015
79ea0ee
Rollup merge of #28215 - matklad:grammar-extern-block-item, r=stevekl…
steveklabnik Sep 4, 2015
6c9549d
Rollup merge of #28216 - christopherdumas:fix_28196, r=steveklabnik
steveklabnik Sep 4, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ TARGET_CRATES := libc std flate arena term \
alloc_system
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_resolve rustc_driver \
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
rustc_data_structures rustc_platform_intrinsics
rustc_data_structures rustc_front rustc_platform_intrinsics
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc fmt_macros
TOOLS := compiletest rustdoc rustc rustbook error-index-generator

Expand All @@ -71,23 +71,24 @@ DEPS_graphviz := std
DEPS_syntax := std term serialize log fmt_macros arena libc rustc_bitflags
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
rustc_typeck rustc_resolve log syntax serialize rustc_llvm \
rustc_trans rustc_privacy rustc_lint
rustc_trans rustc_privacy rustc_lint rustc_front

DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
log syntax serialize rustc_llvm rustc_platform_intrinsics
DEPS_rustc_typeck := rustc syntax rustc_platform_intrinsics
DEPS_rustc_borrowck := rustc log graphviz syntax
DEPS_rustc_resolve := rustc log syntax
DEPS_rustc_privacy := rustc log syntax
log syntax serialize rustc_llvm rustc_front rustc_platform_intrinsics
DEPS_rustc_typeck := rustc syntax rustc_front rustc_platform_intrinsics
DEPS_rustc_borrowck := rustc rustc_front log graphviz syntax
DEPS_rustc_resolve := rustc rustc_front log syntax
DEPS_rustc_privacy := rustc rustc_front log syntax
DEPS_rustc_lint := rustc log syntax
DEPS_rustc := syntax flate arena serialize getopts rbml \
log graphviz rustc_llvm rustc_back rustc_data_structures
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
DEPS_rustc_platform_intrinsics := rustc rustc_llvm
DEPS_rustc_back := std syntax rustc_llvm flate log libc
DEPS_rustc_back := std syntax rustc_llvm rustc_front flate log libc
DEPS_rustc_front := std syntax log serialize
DEPS_rustc_data_structures := std log serialize
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
test rustc_lint
test rustc_lint rustc_front
DEPS_rustc_bitflags := core
DEPS_flate := std native:miniz
DEPS_arena := std
Expand Down
1 change: 1 addition & 0 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ ifdef CFG_DISABLE_DOCS
endif

docs: $(DOC_TARGETS)
doc: docs
compiler-docs: $(COMPILER_DOC_TARGETS)

trpl: doc/book/index.html
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
// FIXME (#9639): This needs to handle non-utf8 paths
let mut args = vec!("-".to_owned(),
"-Zunstable-options".to_owned(),
"--pretty".to_owned(),
"--unpretty".to_owned(),
pretty_type,
format!("--target={}", config.target),
"-L".to_owned(),
Expand Down
19 changes: 8 additions & 11 deletions src/doc/grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ type_path_tail : '<' type_expr [ ',' type_expr ] + '>'
## Macros

```antlr
expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ';'
expr_macro_rules : "macro_rules" '!' ident '(' macro_rule * ')' ';'
| "macro_rules" '!' ident '{' macro_rule * '}' ;
macro_rule : '(' matcher * ')' "=>" '(' transcriber * ')' ';' ;
matcher : '(' matcher * ')' | '[' matcher * ']'
Expand All @@ -306,7 +306,7 @@ transcriber : '(' transcriber * ')' | '[' transcriber * ']'

```antlr
item : vis ? mod_item | fn_item | type_item | struct_item | enum_item
| const_item | static_item | trait_item | impl_item | extern_block ;
| const_item | static_item | trait_item | impl_item | extern_block_item ;
```

### Type Parameters
Expand Down Expand Up @@ -636,31 +636,31 @@ lambda_expr : '|' ident_list '|' expr ;
### While loops

```antlr
while_expr : [ lifetime ':' ] "while" no_struct_literal_expr '{' block '}' ;
while_expr : [ lifetime ':' ] ? "while" no_struct_literal_expr '{' block '}' ;
```

### Infinite loops

```antlr
loop_expr : [ lifetime ':' ] "loop" '{' block '}';
loop_expr : [ lifetime ':' ] ? "loop" '{' block '}';
```

### Break expressions

```antlr
break_expr : "break" [ lifetime ];
break_expr : "break" [ lifetime ] ?;
```

### Continue expressions

```antlr
continue_expr : "continue" [ lifetime ];
continue_expr : "continue" [ lifetime ] ?;
```

### For expressions

```antlr
for_expr : [ lifetime ':' ] "for" pat "in" no_struct_literal_expr '{' block '}' ;
for_expr : [ lifetime ':' ] ? "for" pat "in" no_struct_literal_expr '{' block '}' ;
```

### If expressions
Expand Down Expand Up @@ -688,13 +688,12 @@ match_pat : pat [ '|' pat ] * [ "if" expr ] ? ;
```antlr
if_let_expr : "if" "let" pat '=' expr '{' block '}'
else_tail ? ;
else_tail : "else" [ if_expr | if_let_expr | '{' block '}' ] ;
```

### While let loops

```antlr
while_let_expr : "while" "let" pat '=' expr '{' block '}' ;
while_let_expr : [ lifetime ':' ] ? "while" "let" pat '=' expr '{' block '}' ;
```

### Return expressions
Expand Down Expand Up @@ -754,8 +753,6 @@ return_expr : "return" expr ? ;
```antlr
closure_type := [ 'unsafe' ] [ '<' lifetime-list '>' ] '|' arg-list '|'
[ ':' bound-list ] [ '->' type ]
procedure_type := 'proc' [ '<' lifetime-list '>' ] '(' arg-list ')'
[ ':' bound-list ] [ '->' type ]
lifetime-list := lifetime | lifetime ',' lifetime-list
arg-list := ident ':' type | ident ':' type ',' arg-list
bound-list := bound | bound '+' bound-list
Expand Down
12 changes: 6 additions & 6 deletions src/doc/trpl/choosing-your-guarantees.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% Choosing your Guarantees

One important feature of Rust as language is that it lets us control the costs and guarantees
One important feature of Rust is that it lets us control the costs and guarantees
of a program.

There are various &ldquo;wrapper type&rdquo; abstractions in the Rust standard library which embody
Expand All @@ -18,9 +18,9 @@ Before proceeding, it is highly recommended that one reads about [ownership][own

## `Box<T>`

[`Box<T>`][box] is pointer which is &ldquo;owned&rdquo;, or a &ldquo;box&rdquo;. While it can hand
out references to the contained data, it is the only owner of the data. In particular, when
something like the following occurs:
[`Box<T>`][box] is an &ldquo;owned&rdquo; pointer, or a &ldquo;box&rdquo;. While it can hand
out references to the contained data, it is the only owner of the data. In particular, consider
the following:

```rust
let x = Box::new(1);
Expand All @@ -40,7 +40,7 @@ allowed to share references to this by the regular borrowing rules, checked at c

[box]: ../std/boxed/struct.Box.html

## `&T` and `&mut T`
## `&T` and `&mut T`

These are immutable and mutable references respectively. They follow the &ldquo;read-write lock&rdquo;
pattern, such that one may either have only one mutable reference to some data, or any number of
Expand Down Expand Up @@ -243,7 +243,7 @@ Many of the types above cannot be used in a threadsafe manner. Particularly, `Rc
`RefCell<T>`, which both use non-atomic reference counts (_atomic_ reference counts are those which
can be incremented from multiple threads without causing a data race), cannot be used this way. This
makes them cheaper to use, but we need thread safe versions of these too. They exist, in the form of
`Arc<T>` and `Mutex<T>`/`RWLock<T>`
`Arc<T>` and `Mutex<T>`/`RwLock<T>`

Note that the non-threadsafe types _cannot_ be sent between threads, and this is checked at compile
time.
Expand Down
10 changes: 5 additions & 5 deletions src/doc/trpl/deref-coercions.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ Vectors can `Deref` to a slice.

## Deref and method calls

`Deref` will also kick in when calling a method. In other words, these are
the same two things in Rust:
`Deref` will also kick in when calling a method. Consider the following
example.

```rust
struct Foo;
Expand All @@ -99,13 +99,13 @@ impl Foo {
fn foo(&self) { println!("Foo"); }
}

let f = Foo;
let f = &&Foo;

f.foo();
```

Even though `f` isn’t a reference, and `foo` takes `&self`, this works.
That’s because these things are the same:
Even though `f` is a `&&Foo` and `foo` takes `&self`, this works. That’s
because these things are the same:

```rust,ignore
f.foo();
Expand Down
11 changes: 11 additions & 0 deletions src/doc/trpl/rust-inside-other-languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,17 @@ And finally, we can try running it:

```bash
$ ruby embed.rb
Thread finished with count=5000000
Thread finished with count=5000000
Thread finished with count=5000000
Thread finished with count=5000000
Thread finished with count=5000000
Thread finished with count=5000000
Thread finished with count=5000000
Thread finished with count=5000000
Thread finished with count=5000000
Thread finished with count=5000000
done!
done!
$
```
Expand Down
22 changes: 11 additions & 11 deletions src/doc/trpl/structs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% Structs

Structs are a way of creating more complex data types. For example, if we were
`struct`s are a way of creating more complex data types. For example, if we were
doing calculations involving coordinates in 2D space, we would need both an `x`
and a `y` value:

Expand All @@ -9,7 +9,7 @@ let origin_x = 0;
let origin_y = 0;
```

A struct lets us combine these two into a single, unified datatype:
A `struct` lets us combine these two into a single, unified datatype:

```rust
struct Point {
Expand All @@ -28,14 +28,14 @@ There’s a lot going on here, so let’s break it down. We declare a `struct` w
the `struct` keyword, and then with a name. By convention, `struct`s begin with
a capital letter and are camel cased: `PointInSpace`, not `Point_In_Space`.

We can create an instance of our struct via `let`, as usual, but we use a `key:
We can create an instance of our `struct` via `let`, as usual, but we use a `key:
value` style syntax to set each field. The order doesn’t need to be the same as
in the original declaration.

Finally, because fields have names, we can access the field through dot
notation: `origin.x`.

The values in structs are immutable by default, like other bindings in Rust.
The values in `struct`s are immutable by default, like other bindings in Rust.
Use `mut` to make them mutable:

```rust
Expand Down Expand Up @@ -91,7 +91,7 @@ fn main() {
# Update syntax

A `struct` can include `..` to indicate that you want to use a copy of some
other struct for some of the values. For example:
other `struct` for some of the values. For example:

```rust
struct Point3d {
Expand Down Expand Up @@ -121,7 +121,7 @@ let point = Point3d { z: 1, x: 2, .. origin };
# Tuple structs

Rust has another data type that’s like a hybrid between a [tuple][tuple] and a
struct, called a ‘tuple struct’. Tuple structs have a name, but
`struct`, called a ‘tuple struct’. Tuple structs have a name, but
their fields don’t:

```rust
Expand All @@ -140,7 +140,7 @@ let black = Color(0, 0, 0);
let origin = Point(0, 0, 0);
```

It is almost always better to use a struct than a tuple struct. We would write
It is almost always better to use a `struct` than a tuple struct. We would write
`Color` and `Point` like this instead:

```rust
Expand All @@ -158,7 +158,7 @@ struct Point {
```

Now, we have actual names, rather than positions. Good names are important,
and with a struct, we have actual names.
and with a `struct`, we have actual names.

There _is_ one case when a tuple struct is very useful, though, and that’s a
tuple struct with only one element. We call this the ‘newtype’ pattern, because
Expand All @@ -180,13 +180,13 @@ destructuring `let`, just as with regular tuples. In this case, the

# Unit-like structs

You can define a struct with no members at all:
You can define a `struct` with no members at all:

```rust
struct Electron;
```

Such a struct is called ‘unit-like’ because it resembles the empty
Such a `struct` is called ‘unit-like’ because it resembles the empty
tuple, `()`, sometimes called ‘unit’. Like a tuple struct, it defines a
new type.

Expand All @@ -195,6 +195,6 @@ marker type), but in combination with other features, it can become
useful. For instance, a library may ask you to create a structure that
implements a certain [trait][trait] to handle events. If you don’t have
any data you need to store in the structure, you can just create a
unit-like struct.
unit-like `struct`.

[trait]: traits.html
4 changes: 2 additions & 2 deletions src/doc/trpl/the-stack-and-the-heap.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ local variables and some other information. This is called a ‘stack frame’,
for the purpose of this tutorial, we’re going to ignore the extra information
and just consider the local variables we’re allocating. So in this case, when
`main()` is run, we’ll allocate a single 32-bit integer for our stack frame.
This is automatically handled for you, as you can see, we didn’t have to write
This is automatically handled for you, as you can see; we didn’t have to write
any special Rust code or anything.

When the function is over, its stack frame gets deallocated. This happens
Expand All @@ -51,7 +51,7 @@ we’ll throw them all away at the same time as well, we can get rid of it very
fast too.

The downside is that we can’t keep values around if we need them for longer
than a single function. We also haven’t talked about what that name, ‘stack’
than a single function. We also haven’t talked about what the word, ‘stack’,
means. To do that, we need a slightly more complicated example:

```rust
Expand Down
2 changes: 1 addition & 1 deletion src/doc/trpl/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ fn normal<T: ConvertTo<i64>>(x: &T) -> i64 {

// can be called with T == i64
fn inverse<T>() -> T
// this is using ConvertTo as if it were "ConvertFrom<i32>"
// this is using ConvertTo as if it were "ConvertTo<i64>"
where i32: ConvertTo<T> {
42.convert()
}
Expand Down
8 changes: 4 additions & 4 deletions src/grammar/RustLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ tokens {
BINOPEQ, AT, DOT, DOTDOT, DOTDOTDOT, COMMA, SEMI, COLON,
MOD_SEP, RARROW, FAT_ARROW, LPAREN, RPAREN, LBRACKET, RBRACKET,
LBRACE, RBRACE, POUND, DOLLAR, UNDERSCORE, LIT_CHAR, LIT_BYTE,
LIT_INTEGER, LIT_FLOAT, LIT_STR, LIT_STR_RAW, LIT_BINARY,
LIT_BINARY_RAW, QUESTION, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
LIT_INTEGER, LIT_FLOAT, LIT_STR, LIT_STR_RAW, LIT_BYTE_STR,
LIT_BYTE_STR_RAW, QUESTION, IDENT, LIFETIME, WHITESPACE, DOC_COMMENT,
COMMENT, SHEBANG, UTF8_BOM
}

Expand Down Expand Up @@ -148,8 +148,8 @@ LIT_STR
: '"' ('\\\n' | '\\\r\n' | '\\' CHAR_ESCAPE | .)*? '"' SUFFIX?
;

LIT_BINARY : 'b' LIT_STR ;
LIT_BINARY_RAW : 'b' LIT_STR_RAW ;
LIT_BYTE_STR : 'b' LIT_STR ;
LIT_BYTE_STR_RAW : 'b' LIT_STR_RAW ;

/* this is a bit messy */

Expand Down
Loading