Skip to content

Rolling up PRs in the queue #19352

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

Closed
wants to merge 68 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
865c2db
add MoveItems to RingBuf, fixes #19085
Gankra Nov 23, 2014
59d1382
rustdoc: Render Sized? on traits and generics
tomjakubowski Nov 24, 2014
ba9e02f
remove the generation of grammar from the reference
steveklabnik Nov 24, 2014
3b9dfd6
Clean up FileType enum following enum namespacing
ogham Nov 24, 2014
36372b9
std: Export BinarySearchResult
alexcrichton Nov 24, 2014
2a6f197
Implement union, intersection, and difference functions for TrieSet.
csouth3 Nov 25, 2014
fbde112
Allow constant struct fields and tuple indexing
aochagavia Nov 24, 2014
080e625
Add tests for issue 19244
aochagavia Nov 25, 2014
4671f7f
Stop indenting error messages. It throws off M-x next-error in emacs …
nikomatsakis Nov 25, 2014
96880be
Change 'Failure' to 'Panic' in Bug Report Docs
killercup Nov 25, 2014
b1e720f
Make HashMap::take not corrupt the map. Fixes #19292
Gankra Nov 25, 2014
71b8b04
Make note about cross-borrowing.
steveklabnik Nov 25, 2014
d7b29a6
Make note that examples need a main()
steveklabnik Nov 25, 2014
c9816be
vec: add missing out-of-memory check
thestinger Nov 25, 2014
72beb1f
Extra note about struct matching order
steveklabnik Nov 25, 2014
8369a60
add slice patterns to the guide
steveklabnik Nov 25, 2014
55853c5
We now support 64 bit Windows.
steveklabnik Nov 25, 2014
79d9beb
Fix xcrate enum namespacing
sfackler Nov 25, 2014
4ce3ba4
Improve documentation for unreachable
steveklabnik Nov 25, 2014
80d520f
Don't use the same llvmdeps.rs for every host.
DiamondLovesYou Nov 25, 2014
f17faf4
Never generate multiple extern {} blocks in mklldeps.py.
DiamondLovesYou Nov 25, 2014
6cb03ba
Fix formatting of the pointers guide.
ucarion Nov 26, 2014
4653ad0
Make syntax::owned_slice a Box<[T]> wrapper.
huonw Nov 24, 2014
ce507c6
Don't forget the tests.
DiamondLovesYou Nov 26, 2014
945b4ed
Allow mutable access to wrapped internal type in Buffered*
sfackler Nov 26, 2014
f38e4e6
/** -> ///
steveklabnik Nov 25, 2014
d48886c
Make BinaryHeap's Items iterator implement DoubleEnded and ExactSize
csouth3 Nov 26, 2014
b7520f5
fix errors in the guide
apasel422 Nov 26, 2014
ce238d7
Unpublicize reexports, unprefix JSON type aliases
frewsxcv Nov 22, 2014
74a1041
Implement the new parsing rules for types in the parser, modifying th…
nikomatsakis Nov 20, 2014
f4e29e7
Fixup various places that were doing `&T+'a` and do `&(T+'a)`
nikomatsakis Nov 20, 2014
c4a3be6
Rote changes due to the fact that ast paths no longer carry this extr…
nikomatsakis Nov 20, 2014
bc23565
Fix rustdoc
nikomatsakis Nov 21, 2014
1479a90
Fix odd example where bounds were permitted and then ignored
nikomatsakis Nov 21, 2014
21d5d13
Add tests for the parsing of `+` and the error messages if people get…
nikomatsakis Nov 25, 2014
97495da
rollup merge of #19224: frewsxcv/unprefix-json-types
alexcrichton Nov 26, 2014
74f0ceb
rollup merge of #19231: Gankro/ringbuf-into-iter
alexcrichton Nov 26, 2014
51d146a
rollup merge of #19266: aochagavia/const
alexcrichton Nov 26, 2014
52d4526
rollup merge of #19272: tomjakubowski/rustdoc-sized
alexcrichton Nov 26, 2014
3649c2a
rollup merge of #19273: ogham/rename-file-types
alexcrichton Nov 26, 2014
60299d7
rollup merge of #19282: steveklabnik/remove_grammar
alexcrichton Nov 26, 2014
34b98b3
rollup merge of #19287: alexcrichton/issue-19272
alexcrichton Nov 26, 2014
f40fa83
rollup merge of #19288: steveklabnik/doc_style_cleanup
alexcrichton Nov 26, 2014
702127f
rollup merge of #19296: csouth3/trieset-union
alexcrichton Nov 26, 2014
f4a7756
rollup merge of #19298: nikomatsakis/unboxed-closure-parse-the-plus
alexcrichton Nov 26, 2014
24349fb
rollup merge of #19299: nikomatsakis/stop-indenting-test-output
alexcrichton Nov 26, 2014
b095eb1
rollup merge of #19300: killercup/patch-1
alexcrichton Nov 26, 2014
69e7554
rollup merge of #19301: Gankro/take-fix
alexcrichton Nov 26, 2014
ea49442
rollup merge of #19304: steveklabnik/gh19302
alexcrichton Nov 26, 2014
6939e4f
rollup merge of #19307: steveklabnik/gh19199
alexcrichton Nov 26, 2014
989d7a7
rollup merge of #19308: thestinger/oom
alexcrichton Nov 26, 2014
8790ab1
rollup merge of #19310: steveklabnik/gh19178
alexcrichton Nov 26, 2014
935a39b
rollup merge of #19312: steveklabnik/gh19177
alexcrichton Nov 26, 2014
52ca952
rollup merge of #19313: steveklabnik/gh18844
alexcrichton Nov 26, 2014
8999a79
rollup merge of #19316: steveklabnik/gh18876
alexcrichton Nov 26, 2014
99338cf
rollup merge of #19317: sfackler/xcrate-namespace
alexcrichton Nov 26, 2014
4c5b966
rollup merge of #19322: DiamondLovesYou/multi-llvmdeps
alexcrichton Nov 26, 2014
9c27ab6
rollup merge of #19325: ucarion/pointers-doc-formatting
alexcrichton Nov 26, 2014
2298084
rollup merge of #19326: huonw/safer-syntax
alexcrichton Nov 26, 2014
3a1d538
rollup merge of #19328: sfackler/buffered-get-mut
alexcrichton Nov 26, 2014
8f94ea0
rollup merge of #19330: csouth3/binaryheap-iter
alexcrichton Nov 26, 2014
62137b6
rollup merge of #19336: apasel422/guide
alexcrichton Nov 26, 2014
60541cd
Test fixes and rebase conflicts
alexcrichton Nov 26, 2014
cd5c823
/*! -> //!
steveklabnik Nov 26, 2014
e8d743e
rollup merge of #19329: steveklabnik/doc_style_cleanup2
alexcrichton Nov 26, 2014
c064961
More test fixes and rebase conflicts!
alexcrichton Nov 26, 2014
1ae0ed4
Fix extraneous +Send
nikomatsakis Nov 27, 2014
dabc62d
Fix diagnostic conflict
nikomatsakis Nov 27, 2014
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
1 change: 0 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,6 @@ probe CFG_LD ld
probe CFG_VALGRIND valgrind
probe CFG_PERF perf
probe CFG_ISCC iscc
probe CFG_LLNEXTGEN LLnextgen
probe CFG_JAVAC javac
probe CFG_ANTLR4 antlr4
probe CFG_GRUN grun
Expand Down
23 changes: 2 additions & 21 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -246,26 +246,6 @@ endef
$(foreach lang,$(L10N_LANGS),$(eval $(call DEF_L10N_DOC,$(lang),guide)))


######################################################################
# LLnextgen (grammar analysis from refman)
######################################################################

ifeq ($(CFG_LLNEXTGEN),)
$(info cfg: no llnextgen found, omitting grammar-verification)
else
.PHONY: verify-grammar

doc/rust.g: $(D)/rust.md $(S)src/etc/extract_grammar.py
@$(call E, extract_grammar: $@)
$(Q)$(CFG_PYTHON) $(S)src/etc/extract_grammar.py $< >$@

verify-grammar: doc/rust.g
@$(call E, LLnextgen: $<)
$(Q)$(CFG_LLNEXTGEN) --generate-lexer-wrapper=no $< >$@
$(Q)rm -f doc/rust.c doc/rust.h
endif


######################################################################
# Rustdoc (libstd/extra)
######################################################################
Expand Down Expand Up @@ -299,7 +279,8 @@ $(2) += doc/$(1)/index.html
doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/
@$$(call E, rustdoc: $$@)
$$(Q)$$(RUSTDOC) --cfg dox --cfg stage2 $$<
$$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(CFG_BUILD)) \
$$(RUSTDOC) --cfg dox --cfg stage2 $$<
endef

$(foreach crate,$(DOC_CRATES),$(eval $(call DEF_LIB_DOC,$(crate),DOC_TARGETS)))
Expand Down
24 changes: 17 additions & 7 deletions mk/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ else
LLVM_STDCPP_LOCATION_$(1) =
endif


# LLVM linkage:
LLVM_LINKAGE_PATH_$(1):=$$(abspath $$(RT_OUTPUT_DIR_$(1))/llvmdeps.rs)
$$(LLVM_LINKAGE_PATH_$(1)): $(S)src/etc/mklldeps.py $$(LLVM_CONFIG_$(1))
$(Q)$(CFG_PYTHON) "$$<" "$$@" "$$(LLVM_COMPONENTS)" "$$(CFG_ENABLE_LLVM_STATIC_STDCPP)" \
$$(LLVM_CONFIG_$(1))
endef

$(foreach host,$(CFG_HOST), \
Expand All @@ -57,10 +63,14 @@ $(foreach host,$(CFG_HOST), \
$(foreach host,$(CFG_HOST), \
$(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))

$(S)src/librustc_llvm/llvmdeps.rs: \
$(LLVM_CONFIGS) \
$(S)src/etc/mklldeps.py \
$(MKFILE_DEPS)
$(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
"$@" "$(LLVM_COMPONENTS)" "$(CFG_ENABLE_LLVM_STATIC_STDCPP)" \
$(LLVM_CONFIGS)
# This can't be done in target.mk because it's included before this file.
define LLVM_LINKAGE_DEPS
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $$(LLVM_LINKAGE_PATH_$(3))
endef

$(foreach source,$(CFG_HOST), \
$(foreach target,$(CFG_TARGET), \
$(eval $(call LLVM_LINKAGE_DEPS,0,$(target),$(source))) \
$(eval $(call LLVM_LINKAGE_DEPS,1,$(target),$(source))) \
$(eval $(call LLVM_LINKAGE_DEPS,2,$(target),$(source))) \
$(eval $(call LLVM_LINKAGE_DEPS,3,$(target),$(source)))))
5 changes: 2 additions & 3 deletions mk/target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$(4): \
$$(dir $$@)$$(call CFG_LIB_GLOB_$(2),$(4)))
$$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
$$(dir $$@)$$(call CFG_RLIB_GLOB,$(4)))
$$(STAGE$(1)_T_$(2)_H_$(3)) \
$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
$$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) \
$$(RUST_LIB_FLAGS_ST$(1)) \
-L "$$(RT_OUTPUT_DIR_$(2))" \
-L "$$(LLVM_LIBDIR_$(2))" \
Expand Down Expand Up @@ -134,8 +135,6 @@ SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))

define TARGET_HOST_RULES

$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.rustc_llvm: $(S)src/librustc_llvm/llvmdeps.rs

$$(TBIN$(1)_T_$(2)_H_$(3))/:
mkdir -p $$@

Expand Down
6 changes: 4 additions & 2 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,8 @@ $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
$$(CRATEFILE_$(4)) \
$$(TESTDEP_$(1)_$(2)_$(3)_$(4))
@$$(call E, rustc: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
$$(subst @,,$$(STAGE$(1)_T_$(2)_H_$(3))) -o $$@ $$< --test \
-L "$$(RT_OUTPUT_DIR_$(2))" \
-L "$$(LLVM_LIBDIR_$(2))" \
$$(RUSTFLAGS_$(4))
Expand Down Expand Up @@ -890,7 +891,8 @@ endif
ifeq ($(2),$$(CFG_BUILD))
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
@$$(call E, run doc-crate-$(4) [$(2)])
$$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
$$(Q)CFG_LLVM_LINKAGE_FILE=$$(LLVM_LINKAGE_PATH_$(2)) \
$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test --cfg dox \
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
else
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
Expand Down
2 changes: 1 addition & 1 deletion src/doc/complement-bugreport.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# I think I found a bug in the compiler!

If you see this message: `error: internal compiler error: unexpected failure`,
If you see this message: `error: internal compiler error: unexpected panic`,
then you have definitely found a bug in the compiler. It's also possible that
your code is not well-typed, but if you saw this message, it's still a bug in
error reporting.
Expand Down
31 changes: 26 additions & 5 deletions src/doc/guide-pointers.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,32 @@ fn succ(x: &int) -> int { *x + 1 }
to

```{rust}
use std::rc::Rc;

fn box_succ(x: Box<int>) -> int { *x + 1 }

fn rc_succ(x: std::rc::Rc<int>) -> int { *x + 1 }
fn rc_succ(x: Rc<int>) -> int { *x + 1 }
```

Note that the caller of your function will have to modify their calls slightly:

```{rust}
use std::rc::Rc;

fn succ(x: &int) -> int { *x + 1 }

let ref_x = &5i;
let box_x = box 5i;
let rc_x = Rc::new(5i);

succ(ref_x);
succ(&*box_x);
succ(&*rc_x);
```

The initial `*` dereferences the pointer, and then `&` takes a reference to
those contents.

# Boxes

`Box<T>` is Rust's 'boxed pointer' type. Boxes provide the simplest form of
Expand Down Expand Up @@ -572,7 +593,7 @@ fn add_one(x: &mut int) -> int {
fn main() {
let x = box 5i;

println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
// of `&`-pointer as mutable
}
```
Expand Down Expand Up @@ -700,9 +721,9 @@ This gives you flexibility without sacrificing performance.

You may think that this gives us terrible performance: return a value and then
immediately box it up ?! Isn't that the worst of both worlds? Rust is smarter
than that. There is no copy in this code. main allocates enough room for the
`box , passes a pointer to that memory into foo as x, and then foo writes the
value straight into that pointer. This writes the return value directly into
than that. There is no copy in this code. `main` allocates enough room for the
`box`, passes a pointer to that memory into `foo` as `x`, and then `foo` writes
the value straight into that pointer. This writes the return value directly into
the allocated box.

This is important enough that it bears repeating: pointers are not for
Expand Down
57 changes: 46 additions & 11 deletions src/doc/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ the easiest way to keep people updated while Rust is in its alpha state.

Oh, we should also mention the officially supported platforms:

* Windows (7, 8, Server 2008 R2), x86 only
* Windows (7, 8, Server 2008 R2)
* Linux (2.6.18 or later, various distributions), x86 and x86-64
* OSX 10.7 (Lion) or greater, x86 and x86-64

Expand Down Expand Up @@ -378,9 +378,15 @@ of your time with Rust.
The first thing we'll learn about are 'variable bindings.' They look like this:

```{rust}
let x = 5i;
fn main() {
let x = 5i;
}
```

Putting `fn main() {` in each example is a bit tedious, so we'll leave that out
in the future. If you're following along, make sure to edit your `main()`
function, rather than leaving it off. Otherwise, you'll get an error.

In many languages, this is called a 'variable.' But Rust's variable bindings
have a few tricks up their sleeves. Rust has a very powerful feature called
'pattern matching' that we'll get into detail with later, but the left
Expand Down Expand Up @@ -683,7 +689,7 @@ fn main() {
```

This is the simplest possible function declaration. As we mentioned before,
`fn` says 'this is a function,' followed by the name, some parenthesis because
`fn` says 'this is a function,' followed by the name, some parentheses because
this function takes no arguments, and then some curly braces to indicate the
body. Here's a function named `foo`:

Expand Down Expand Up @@ -884,7 +890,7 @@ Tuples are an ordered list of a fixed size. Like this:
let x = (1i, "hello");
```

The parenthesis and commas form this two-length tuple. Here's the same code, but
The parentheses and commas form this two-length tuple. Here's the same code, but
with the type annotated:

```rust
Expand All @@ -908,9 +914,9 @@ let (x, y, z) = (1i, 2i, 3i);
println!("x is {}", x);
```

Remember before when I said the left hand side of a `let` statement was more
Remember before when I said the left-hand side of a `let` statement was more
powerful than just assigning a binding? Here we are. We can put a pattern on
the left hand side of the `let`, and if it matches up to the right hand side,
the left-hand side of the `let`, and if it matches up to the right-hand side,
we can assign multiple bindings at once. In this case, `let` 'destructures,'
or 'breaks up,' the tuple, and assigns the bits to three bindings.

Expand Down Expand Up @@ -1453,9 +1459,9 @@ focus. Any time you have a data structure of variable size, things can get
tricky, and strings are a re-sizable data structure. That said, Rust's strings
also work differently than in some other systems languages, such as C.

Let's dig into the details. A **string** is a sequence of unicode scalar values
Let's dig into the details. A **string** is a sequence of Unicode scalar values
encoded as a stream of UTF-8 bytes. All strings are guaranteed to be
validly-encoded UTF-8 sequences. Additionally, strings are not null-terminated
validly encoded UTF-8 sequences. Additionally, strings are not null-terminated
and can contain null bytes.

Rust has two main types of strings: `&str` and `String`.
Expand Down Expand Up @@ -3933,7 +3939,7 @@ match x {
}
```

Here, the `val` inside the `match` has type `int`. In other words, the left hand
Here, the `val` inside the `match` has type `int`. In other words, the left-hand
side of the pattern destructures the value. If we have `&5i`, then in `&val`, `val`
would be `5i`.

Expand Down Expand Up @@ -3991,6 +3997,35 @@ match origin {
}
```

You can do this kind of match on any member, not just the first:

```{rust}
# #![allow(non_shorthand_field_patterns)]
struct Point {
x: int,
y: int,
}

let origin = Point { x: 0i, y: 0i };

match origin {
Point { y: y, .. } => println!("y is {}", y),
}
```

If you want to match against a slice or array, you can use `[]`:

```{rust}
fn main() {
let v = vec!["match_this", "1"];

match v.as_slice() {
["match_this", second] => println!("The second element is {}", second),
_ => {},
}
}
```

Whew! That's a lot of different ways to match things, and they can all be
mixed and matched, depending on what you're doing:

Expand Down Expand Up @@ -4681,7 +4716,7 @@ let x: Option<int> = Some(5i);

In the type declaration, we say `Option<int>`. Note how similar this looks to
`Option<T>`. So, in this particular `Option`, `T` has the value of `int`. On
the right hand side of the binding, we do make a `Some(T)`, where `T` is `5i`.
the right-hand side of the binding, we do make a `Some(T)`, where `T` is `5i`.
Since that's an `int`, the two sides match, and Rust is happy. If they didn't
match, we'd get an error:

Expand Down Expand Up @@ -5249,7 +5284,7 @@ immediately.

## Success and failure

Tasks don't always succeed, they can also panic. A task that wishes to panic
Tasks don't always succeed, they can also panic. A task that wishes to panic
can call the `panic!` macro, passing a message:

```{rust}
Expand Down
Loading