Commit Graph

26416 Commits

Author SHA1 Message Date
Steven Fackler
23fdbcf7dd Add a method to LimitReader to return the limit
This is useful in contexts like this:

let size = rdr.read_be_i32() as uint;
let mut limit = LimitReader::new(rdr.by_ref(), size);
let thing = read_a_thing(&mut limit);
assert!(limit.limit() == 0);
2014-02-15 14:22:56 -08:00
bors
a7aa4c477e auto merge of #12286 : sfackler/rust/no-conditions, r=alexcrichton 2014-02-15 03:56:27 -08:00
bors
fba32ea79f auto merge of #12283 : kballard/rust/env-args-bytes, r=erickt
Change `os::args()` and `os::env()` to use `str::from_utf8_lossy()`.
Add new functions `os::args_as_bytes()` and `os::env_as_bytes()` to retrieve the args/env as byte vectors instead.

The existing methods were left returning strings because I expect that the common use-case is to want string handling.

Fixes #7188.
2014-02-15 02:36:27 -08:00
bors
c9f13b47fe auto merge of #12230 : DaGenix/rust/io-decorator-changes, r=sfackler
I created RefReader and RefWriter structs that wrap a mutable reference to a Reader or Writer value. This works exactly like the ByRef struct in the iter module and allows passing a reference to a Reader or Writer to function expecting a Reader or Writer by value with the caller retaining ownership to the original value.

I also modified LimitReader to take the wrapped Reader by value instead of by reference.

@sfackler
2014-02-14 23:46:29 -08:00
Steven Fackler
e7147ce84f Remove broken link to old conditions tutorial 2014-02-14 23:45:57 -08:00
Palmer Cox
4c233d1c73 Update LimitReader to take the Reader to wrap by value 2014-02-15 00:58:44 -05:00
Palmer Cox
d4dd4c68f8 Create RefReader and RefWriter adaptor structs
RefReader and RefWriter allow a caller to pass a Reader or Writer
instance by reference to generic functions that are expecting arguments
by value.
2014-02-15 00:58:43 -05:00
Kevin Ballard
d22b1646aa Use str::from_utf8_lossy() for os::env() and friends
Parse the environment by default with from_utf8_lossy. Also provide
byte-vector equivalents (e.g. os::env_as_bytes()).

Unfortunately, setenv() can't have a byte-vector equivalent because of
Windows support, unless we want to define a setenv_bytes() that fails
under Windows for non-UTF8 (or non-UTF16).
2014-02-14 21:23:37 -08:00
Kevin Ballard
c73d5ce8ab Use str::from_utf8_lossy() in os::args(), add os::args_as_bytes()
os::args() was using str::raw::from_c_str(), which would assert if the
C-string wasn't valid UTF-8. Switch to using from_utf8_lossy() instead,
and add a separate function os::args_as_bytes() that returns the ~[u8]
byte-vectors instead.
2014-02-14 21:23:37 -08:00
Kevin Ballard
8cc8eb7b8e Add c_str::CString.as_bytes_no_nul() 2014-02-14 21:23:37 -08:00
bors
3496e93d13 auto merge of #12274 : brson/rust/mkfiles, r=alexcrichton
I've been working on binary installers and ended up taking this detour, which does a few things:

* It expands the documentation on the build system with new comments in Makefile.in
* It displays some of that documentation via `make help`
* Removes some unused and broken snapshot code
* Adds `NO_MKFILE_DEPS` to convenience makefile hacking
* Moves almost all of Makefile.in to files in `mk/`

The documentation provided by `make help` and its implementation are somewhat quirky.
2014-02-14 20:51:26 -08:00
bors
f0bad904a1 auto merge of #12276 : alexcrichton/rust/issue-8449, r=kballard
This was just waiting for compiler-rt support, which was added in #12027

Closes #8449
2014-02-14 19:31:28 -08:00
Alex Crichton
90311fc68f Enable 64-bit checked multiplication on 32-bit
This was just waiting for compiler-rt support, which was added in #12027

Closes #8449
2014-02-14 19:26:41 -08:00
Brian Anderson
8d4b675ced mk: Address review feedback 2014-02-14 19:17:50 -08:00
bors
9b173edf86 auto merge of #12277 : alexcrichton/rust/fix-rustdoc-render, r=huonw
The std macros used to be injected with a filename of "<std-macros>", but macros
are now injected with a filename of "<{} macros>" where `{}` is filled in with
the crate name. This updates rustdoc to understand this new system so it'll
render source more frequently.
2014-02-14 17:51:29 -08:00
Brian Anderson
24915c84e0 mk: Move version info to top of main.mk
Just so it's easier to find.
2014-02-14 17:45:54 -08:00
Brian Anderson
334af011f0 mk: Improve build system help commands 2014-02-14 17:45:54 -08:00
Brian Anderson
ab17f445fe mk: Add NO_MKFILE_DEPS for turning off rebuild from makefile changes 2014-02-14 17:45:54 -08:00
Brian Anderson
2852fea61e mk: Move most of Makefile.in to .mk files
Because the build system treats Makefile.in and the .mk files slightly
differently (.in is copied, .mk are included), this makes the system
more uniform. Fewer build system changes will require a complete
reconfigure.
2014-02-14 17:45:54 -08:00
Brian Anderson
94d2c8a21f mk: Remove the concept of 'snapshot transitions'
This way of doing snapshots hasn't been used since 2011.
2014-02-14 17:45:53 -08:00
Brian Anderson
b11e73d0be mk: Add some serious documentation and 'make help'
'make help' is implemented in a fairly ridiculous way, using awk
to parse comments out of Makefile.in and displaying them.
2014-02-14 17:45:53 -08:00
bors
d365c3a6e6 auto merge of #12271 : kballard/rust/vim-extern-crate, r=huonw 2014-02-14 15:51:29 -08:00
Kevin Ballard
33b2b8a16f Add crate keyword to gedit language spec 2014-02-14 15:37:22 -08:00
Kevin Ballard
fff12220af Add crate to emacs and kate modefiles 2014-02-14 14:37:07 -08:00
bors
718c13fe3d auto merge of #12195 : kballard/rust/rustdoc-strip-impls-of-stripped, r=cmr
Strip trait impls for types that are stripped either due to the strip-hidden or strip-private passes.

This fixes the search index including trait methods on stripped structs (which breaks searching), and it also removes private types from the implementors list of a trait.

Fixes #9981 and #11439.
2014-02-14 13:36:35 -08:00
Alex Crichton
1bf1eeac6e Update restrictions on rustdoc source rendering
The std macros used to be injected with a filename of "<std-macros>", but macros
are now injected with a filename of "<{} macros>" where `{}` is filled in with
the crate name. This updates rustdoc to understand this new system so it'll
render source more frequently.
2014-02-14 13:11:36 -08:00
bors
3f717bbe96 auto merge of #12267 : alexcrichton/rust/rollup, r=alexcrichton
The last commit has the closed PRs
2014-02-14 12:21:51 -08:00
Kevin Ballard
c718e0e254 Add CheckedDiv to vim syntax 2014-02-14 12:02:18 -08:00
Kevin Ballard
84c60186fc Update vim syntax for extern crate 2014-02-14 11:27:53 -08:00
Alex Crichton
2f8dbf2102 Test fixes and rebase conflicts from rollups
PRs closed as part of this:

Closes #12212 r=alexcrichton
Closes #12215 r=brson
Closes #12246 r=pcwalton
Closes #12247 r=cmr
Closes #12251 r=brson
Closes #12255 r=alexcrichton
Closes #12257 r=alexcrichton
Closes #12258 r=huonw
Closes #12259 r=huonw
Closes #12263 r=kballard
Closes #12269 r=alexcrichton
2014-02-14 10:59:22 -08:00
Corey Richardson
909fd0d829 tutorial: stronger wording in build instructions 2014-02-14 10:59:15 -08:00
Kevin Ballard
9e6c3f03bc rustdoc: Strip impls of traits on #[doc(hidden)] types
In the strip-hidden pass, record all types that were stripped, and make
a second pass stripping all impls of traits for these types.
2014-02-14 10:52:18 -08:00
Kevin Ballard
52a3d38796 rustdoc: Strip impls of stripped private types
In strip-private, also strip impls of traits for private types. This
fixes the search index so searching for "drop", "eq", etc doesn't throw
an exception.
2014-02-14 10:50:19 -08:00
Alex Crichton
8694fd1e96 Add MKFILE_DEPS to compiler-rt target
Currently when you run `make -jN` it's likely that you'll remove compiler-rt and
then it won't get cp'd back into the right place. I believe the reason for this
is that the compiler-rt library target never got updated so make decided it
never needed to copy the files back into place. The files were all there at the
beginning of `make`, but then we may clean out the stage0 versions if we unzip
the snapshot again.
2014-02-14 10:46:19 -08:00
bors
994747022a auto merge of #12205 : alexcrichton/rust/nodefaultlibs, r=brson
This will hopefully bring us closer to #11937. We're still using gcc's idea of
"startup files", but this should prevent us from leaking in dependencies that we
don't quite want (libgcc for example once compiler-rt is what we use).
2014-02-14 10:41:45 -08:00
Alex Crichton
28fa81a954 Invoke gcc with -nodefaultlibs
This will hopefully bring us closer to #11937. We're still using gcc's idea of
"startup files", but this should prevent us from leaking in dependencies that we
don't quite want (libgcc for example once compiler-rt is what we use).
2014-02-14 08:07:46 -08:00
Eduard Burtescu
6e84023596 Removed the obsolete ast::CallSugar (previously used by do). 2014-02-14 07:48:13 -08:00
Steven Fackler
07ea23e15d Expand ItemDecorator extensions in all contexts
Now that fold_item can return multiple items, this is pretty trivial. It
also recursively expands generated items so ItemDecorators can generate
items that are tagged with ItemDecorators!

Closes #4913
2014-02-14 07:48:00 -08:00
Edward Wang
c1fac65396 Add test for #8860 2014-02-14 07:47:45 -08:00
HeroesGrave
11b2515f0f Removed libextra dependency from libsyntax. 2014-02-14 07:47:31 -08:00
Dave Hodder
3f54ca1ec4 Add function doc comments for extra::url::* 2014-02-14 07:47:17 -08:00
Flavio Percoco
a289587dd3 Ensure an error is raised on infinite recursion 2014-02-14 07:47:05 -08:00
Eduard Burtescu
3af5f38f3c Don't copy &Trait and &mut Trait to temporaries for every call. 2014-02-14 07:46:41 -08:00
Alex Crichton
ee2a888860 extra: Capture stdout/stderr of tests by default
When tests fail, their stdout and stderr is printed as part of the summary, but
this helps suppress failure messages from #[should_fail] tests and generally
clean up the output of the test runner.
2014-02-14 07:46:29 -08:00
lpy
665555d58f return value/use extra::test::black_box in benchmarks 2014-02-14 07:45:34 -08:00
bors
92c5738aae auto merge of #12207 : alexcrichton/rust/up-llvm, r=sfackler
Includes an upstream commit by pcwalton to improve codegen of our enums getting
moved around.

This also introduces a new commit on top of our stack of patches to fix a mingw32 build issue. I have submitted the patch upstream: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140210/204653.html

I verified that this builds on the try bots, which amazes me because I think that c++11 is turned on now, but I guess we're still lucky!

Closes #10613 (pcwalton's patch landed)
Closes #11992 (llvm has removed these options)
2014-02-14 07:26:40 -08:00
Alex Crichton
804955f79a Upgrade LLVM
Includes an upstream commit by pcwalton to improve codegen of our enums getting
moved around.
2014-02-14 07:22:49 -08:00
bors
18477ac68a auto merge of #12234 : sfackler/rust/restructure-item-decorator, r=huonw
The old method of building up a list of items and threading it through
all of the decorators was unwieldy and not really scalable as
non-deriving ItemDecorators become possible. The API is now that the
decorator gets an immutable reference to the item it's attached to, and
a callback that it can pass new items to. If we want to add syntax
extensions that can modify the item they're attached to, we can add that
later, but I think it'll have to be separate from ItemDecorator to avoid
strange ordering issues.

@huonw
2014-02-14 06:11:43 -08:00
bors
d40b537405 auto merge of #12192 : luqmana/rust/fix-cross, r=alexcrichton
Fix some fall out from the big command line option changes.
2014-02-14 01:41:46 -08:00
bors
03b324ff44 auto merge of #12186 : alexcrichton/rust/no-sleep-2, r=brson
Any single-threaded task benchmark will spend a good chunk of time in `kqueue()` on osx and `epoll()` on linux, and the reason for this is that each time a task is terminated it will hit the syscall. When a task terminates, it context switches back to the scheduler thread, and the scheduler thread falls out of `run_sched_once` whenever it figures out that it did some work.

If we know that `epoll()` will return nothing, then we can continue to do work locally (only while there's work to be done). We must fall back to `epoll()` whenever there's active I/O in order to check whether it's ready or not, but without that (which is largely the case in benchmarks), we can prevent the costly syscall and can get a nice speedup.

I've separated the commits into preparation for this change and then the change itself, the last commit message has more details.
2014-02-14 00:26:47 -08:00