Commit Graph

24175 Commits

Author SHA1 Message Date
Daniel Micay
c1eb20b5f8 rewrite part of the tutorial
This begins a rewrite of some sections the tutorial as an introduction
to concepts through the implementation of a simple data structure. I
think this would be a good way to introduce references, traits and many
other concepts too. For example, the section introducing alternatives to
ownership can demonstrate a persistent list.
2013-12-04 16:55:03 -05:00
bors
693ec73b9b auto merge of #10747 : alexcrichton/rust/snapshots, r=cmr
This registers new snapshots after the landing of #10528, and then goes on to tweak the build process to build a monolithic `rustc` binary for use in future snapshots. This mainly involved dropping the dynamic dependency on `librustllvm`, so that's now built as a static library (with a dynamically generated rust file listing LLVM dependencies).

This currently doesn't actually make the snapshot any smaller (24MB => 23MB), but I noticed that the executable has 11MB of metadata so once progress is made on #10740 we should have a much smaller snapshot.

There's not really a super-compelling reason to distribute just a binary because we have all the infrastructure for dealing with a directory structure, but to me it seems "more correct" that a snapshot compiler is just a `rustc` binary.
2013-12-03 14:36:59 -08:00
Alex Crichton
acc5e32e53 Register new snapshots 2013-12-03 14:31:54 -08:00
bors
69186efc19 auto merge of #10768 : Blei/rust/logging-enabled-macros, r=alexcrichton
This is useful when the information that is needed to do useful logging
is expensive to produce.
2013-12-03 12:11:25 -08:00
bors
899217c11b auto merge of #10757 : TeXitoi/rust/mut-split-iter, r=alexcrichton
I've renamed `MutableVector::mut_split(at)` to `MutableVector::mut_split_at(at)` to be coherent with ImmutableVector.  As specified in the commit log, The `size_hint` method is not optimal because of #9629.
2013-12-03 10:11:25 -08:00
Guillaume Pinot
44fc3c6ea8 add MutableVector::mut_split(self, pred) -> DoubleEndedIterator<&mut [T]>
This method is the mutable version of ImmutableVector::split.  It is
a DoubleEndedIterator, making mut_rsplit irrelevent.  The size_hint
method is not optimal because of #9629.

At the same time, clarify *split* iterator doc.
2013-12-03 17:31:15 +01:00
bors
e2d192c9f4 auto merge of #10777 : alexcrichton/rust/issue-10743, r=luqmana
Commit messages have the fun details, the focus of this is closing #10743 though
2013-12-03 08:21:26 -08:00
Alex Crichton
0dc9f62779 Resume propagation of linking to native dylibs
The reasons for this are outlined in issue #10743 as well as the comment I have
now placed in the code.

Closes #10743
2013-12-03 08:19:33 -08:00
Alex Crichton
6437122e64 Tidy up a few problems with run-make tests
Use the correct set of dependencies as well as CFG_PYTHON instead of assuming
'python' is the right one.
2013-12-03 08:13:00 -08:00
Alex Crichton
2bd80758a2 Continue tightening holes in reachability
* Don't flag any address_insignificant statics as reachable because the whole
  point of the address_insignificant optimization is that the static is not
  reachable. Additionally, there's no need for it to be reachable because LLVM
  optimizes it away.

* Be sure to not leak external node ids into our reachable set, this can
  spuriously cause local items to be considered reachable if the node ids just
  happen to line up
2013-12-03 08:13:00 -08:00
bors
6a9db409e5 auto merge of #10782 : alexcrichton/rust/rustdoc-lib, r=thestinger
This makes sure that when generating documentation we don't waste time doing
things like looking for a main function.
2013-12-03 01:51:26 -08:00
bors
f1ef36ea2f auto merge of #10773 : jvns/rust/patch-1, r=cmr
The section on closure types was missing, so I added one. I'm new to Rust, so there are probably important things to say about closure types that I'm missing here.

I tested the example with the latest Rust nightly.
2013-12-02 23:32:33 -08:00
Philipp Brüschweiler
a68917190b Add test to check for debug logging disabled at compile time 2013-12-03 07:44:46 +01:00
bors
18084be316 auto merge of #10772 : alexcrichton/rust/issue-3053, r=alexcrichton
Rebasing #10446 with a `pub fn main`
2013-12-02 21:32:38 -08:00
Alex Crichton
6600ba97c3 rustdoc: Tell rustc we're building a library
This makes sure that when generating documentation we don't waste time doing
things like looking for a main function.
2013-12-02 21:26:40 -08:00
bors
fc3b7c1450 auto merge of #10770 : alexcrichton/rust/static-librustrt, r=alexcrichton
This wasn't uncovered during testing because the librustrt is available locally
in the build directory (and it needs to be for all the tests to link against it
as well).

Closes #10765
2013-12-02 20:16:51 -08:00
bors
8cb59d3868 auto merge of #10771 : pnkfelix/rust/fix-make-check-for-ccacheless-clang, r=acrichto
This fixes a problem with `make check` clang -Werror failing due to an unused -Llib arg.
2013-12-02 19:02:07 -08:00
bors
3a3ffab69b auto merge of #10759 : SiegeLord/rust/placeholder, r=cmr
This makes the search bar more visible.
2013-12-02 17:31:42 -08:00
bors
0e66baf013 auto merge of #10736 : Blei/rust/fix_c_vec, r=alexcrichton
Controversial change: make the constructors safe, but instead mark the
setters and getters as unsafe. This follows the tradition that construction
of *T is safe, but the access is unsafe instead.
2013-12-02 16:06:40 -08:00
bors
c8b60a2d9e auto merge of #10742 : alexcrichton/rust/frameworks, r=cmr
Commits have the fun details, and scrutiny on the new documentation would be appreciated!
2013-12-02 13:36:41 -08:00
Philipp Brüschweiler
870fb7d75c c_vec: Modernize
Generally use more modern constructs (such as using `CVec::new()` as
constructor and move to more method usage).

Potentially controversial changes:
* change `get()` to return a reference instead of cloning
* remove `set()`, add `get_mut()` instead
* add an `unwrap()` method that destroys the CVec without running any
  associated destructor
2013-12-02 21:53:23 +01:00
Philipp Brüschweiler
a75f72d45a Add a macro to check if logging at a given label is enabled
This is useful when the information that is needed to do useful logging
is expensive to produce.
2013-12-02 21:47:57 +01:00
bors
fc4540d23e auto merge of #10728 : sanxiyn/rust/proc, r=cmr
Fix #10718.
2013-12-02 12:21:32 -08:00
Julia Evans
94c02af873 Add section on closure types to manual 2013-12-02 14:39:11 -05:00
Alex Crichton
d4c40b519b Bring the linkage documentation up-to-date
This includes documentation for all the previous changes done to linking
in #10582. Additionally, this brings the list of feature-gates up-to-date with
the currently recognized list of features.
2013-12-02 11:10:40 -08:00
Niko Matsakis
7067561189 Add test for #3053. Fixes #3053. 2013-12-02 10:33:17 -08:00
Felix S. Klock II
5e00d5c790 Make the ccache-free case look like the ccache case.
This fixes a problem with `make check` clang -Werror failing due to an
unused -Llib arg.
2013-12-02 19:25:14 +01:00
Alex Crichton
837a770b21 Declare librustrt a static dependency of libextra
This wasn't uncovered during testing because the librustrt is available locally
in the build directory (and it needs to be for all the tests to link against it
as well).

Closes #10765
2013-12-02 09:39:02 -08:00
Seo Sanghyeon
e41c331b2e Fix type inference for proc expressions 2013-12-02 21:39:53 +09:00
Guillaume Pinot
25bb1a406c rename MutableVector::mut_split(at) to MutableVector::mut_split_at(at) 2013-12-02 08:58:07 +01:00
SiegeLord
e73d50653f Add a type="search" to the search bar in the documentation. 2013-12-01 21:36:59 -05:00
SiegeLord
a3aa325c93 Add placeholder text to the search bar in the documentation. 2013-12-01 20:42:38 -05:00
bors
61443dc1f5 auto merge of #10753 : alexcrichton/rust/fix-make-install, r=huonw
Turns out that we only want to install the target rlibs, not the host rlibs.
I had it backwards the first time, then mixed up the second time, but this time
should get it right.

There's no need for host rlib files because none of them are needed at runtime.
2013-12-01 15:36:58 -08:00
bors
0455e4c9f8 auto merge of #10756 : thestinger/rust/transmute, r=alexcrichton 2013-12-01 12:42:16 -08:00
bors
9ac48785d6 auto merge of #10749 : Blei/rust/fix-linker-args, r=alexcrichton
This is inspired by a mystifying linker failure when using `pkg-config` to
generate the linker args: `pkg-config` produces output that ends in a
space, thus resulting in an empty linker argument.

Also added some updates to the concerning error messages that helped
spotting this bug.
2013-12-01 11:26:57 -08:00
Philipp Brüschweiler
32688f8f74 rustc: filter out empty linker args
This is inspired by a mystifying linker failure when using `pkg-config` to
generate the linker args: `pkg-config` produces output that ends in a
space, thus resulting in an empty linker argument.

Also added some updates to the concerning error messages that helped
spotting this bug.
2013-12-01 19:29:01 +01:00
Daniel Micay
b4a1733fd2 remove useless transmute_immut function 2013-12-01 10:18:47 -05:00
Alex Crichton
c6e934f447 *Actually* fix make install with rlibs
Turns out that we only want to install the target rlibs, not the host rlibs.
I had it backwards the first time, then mixed up the second time, but this time
should get it right.

There's no need for host rlib files because none of them are needed at runtime.
2013-12-01 06:58:46 -08:00
bors
df41115213 auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton 2013-12-01 05:42:06 -08:00
bors
83084e9c77 auto merge of #10748 : kballard/rust/issue-10734-rpass, r=alexcrichton
Stop relying on a malloc error to indicate failure and instead use an
explicit check. Also ensure that the value is dropped at the correct
time (e.g. that the if statement is translated into `{ expr }` instead
of `expr`).
2013-12-01 04:26:52 -08:00
bors
b2aa00ba8b auto merge of #10676 : eddyb/rust/ast-box-in-enums, r=cmr
**Note**: I only tested on top of my #10670 PR, size reductions come from both change sets.

With this, [more enums are shrinked](https://gist.github.com/eddyb/08fef0dfc6ff54e890bc), the most significant one being `ast_node`, from 104 bytes (master) to 96 (#10670) and now to 32 bytes.

My own testcase requires **200MB** less when compiling (not including the other **200MB** gained in #10670), and rustc-stage2 is down by about **130MB**.

I believe there is more to gain by fiddling with the enums' layouts.
2013-12-01 03:11:58 -08:00
Philipp Brüschweiler
47ce981903 ast: Remove one @ and fix the fallout 2013-12-01 11:24:58 +01:00
Kevin Ballard
2ffcbf11f5 Rewrite the issue-10734 rpass file
Stop relying on a malloc error to indicate failure and instead use an
explicit check. Also ensure that the value is dropped at the correct
time (e.g. that the if statement is translated into `{ expr }` instead
of `expr`).
2013-11-30 23:55:55 -08:00
bors
c470184c20 auto merge of #10746 : alexcrichton/rust/fix-make-install, r=cmr
It was only copying the host files, not the target rlib files.
2013-11-30 21:01:43 -08:00
bors
6616dbf075 auto merge of #10739 : DaGenix/rust/mut-chunks, r=alexcrichton
mut_chunks() returns an iterator that produces mutable slices. This is the mutable version of the existing chunks() method on the ImmutableVector trait.

EDIT: This uses only safe code now.

PREVIOUSLY:
I tried to get this working with safe code only, but I couldn't figure out how to make that work. Before #8624, the exact same code worked without the need for the transmute() call. With that fix and without the transmute() call, the compiler complains about the call to mut_slice(). I think the issue is that the mutable slice that is returned will live longer than the self parameter since the self parameter doesn't have an explicit lifetime. However, that is the way that the Iterator trait defines the next() method. I'm sure there is a good reason for that, although I don't quite understand why. Anyway, I think the interface is safe, since the MutChunkIter will only hand out non-overlapping pointers and there is no way to get it to hand out the same pointer twice.
2013-11-30 19:46:35 -08:00
Alex Crichton
8b964bf349 Fix make install to install rlib files
It was only copying the host files, not the target rlib files.
2013-11-30 18:58:09 -08:00
bors
7c889a2fb5 auto merge of #10733 : alexcrichton/rust/ignore-on-windows, r=pcwalton
I've seen this fail on windows twice now, and it's not clear to me why it's
failing. For now, ignore it on that platform while investigation enuses.
2013-11-30 18:31:46 -08:00
bors
1998b3e21e auto merge of #10738 : sfackler/rust/buffered-fixes, r=alexcrichton
BufferedWriter::inner flushes before returning the underlying writer.

BufferedWriter::write no longer flushes the underlying writer.

LineBufferedWriter::write flushes up to the *last* newline in the input
string, not the first.
2013-11-30 17:16:37 -08:00
Palmer Cox
2a8dfc3f22 Implement DoubleEndedIterator for MutChunkIter. 2013-11-30 19:54:28 -05:00
Palmer Cox
f2a01ea277 Implement mut_chunks() method for MutableVector trait.
mut_chunks() returns an iterator that produces mutable slices. This is the
mutable version of the existing chunks() method on the ImmutableVector trait.
2013-11-30 19:07:56 -05:00