]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #12103 : alexcrichton/rust/unix, r=brson
bors [Tue, 18 Feb 2014 04:01:52 +0000 (20:01 -0800)]
auto merge of #12103 : alexcrichton/rust/unix, r=brson

There's a few parts to this PR

* Implement unix pipes in libnative for unix platforms (thanks @Geal!)
* Implement named pipes in libnative for windows (terrible, terrible code)
* Remove `#[cfg(unix)]` from `mod unix` in `std::io::net`. This is a terrible name for what it is, but that's the topic of #12093.

The windows implementation was significantly more complicated than I thought it would be, but it seems to be passing all the tests. now.

Closes #11201

10 years agoauto merge of #12243 : dguenther/rust/extend-tidy, r=alexcrichton
bors [Tue, 18 Feb 2014 02:46:48 +0000 (18:46 -0800)]
auto merge of #12243 : dguenther/rust/extend-tidy, r=alexcrichton

Extends the license and formatting check to `*.js` files in `src/doc` and `*.sh`, `*.pl`, `*.c`, and `*.h` files in `src/etc`. As best as I could tell, these files should be covered under the Rust project license.

cc @brson: Do any other scripts need a license? I'd like to double-check that this PR closes #4534.

10 years agoauto merge of #12232 : kballard/rust/taskbuilder-is-a-builder, r=alexcrichton
bors [Tue, 18 Feb 2014 01:31:52 +0000 (17:31 -0800)]
auto merge of #12232 : kballard/rust/taskbuilder-is-a-builder, r=alexcrichton

Delete all the documentation from std::task that references linked
failure.

Tweak TaskBuilder to be more builder-like. `.name()` is now `.named()` and
`.add_wrapper()` is now `.with_wrapper()`. Remove `.watched()` and
`.unwatched()` as they didn't actually do anything.

Closes #6399.

10 years agoauto merge of #12146 : gentlefolk/rust/issue-2404, r=alexcrichton
bors [Tue, 18 Feb 2014 00:11:52 +0000 (16:11 -0800)]
auto merge of #12146 : gentlefolk/rust/issue-2404, r=alexcrichton

Addresses FIXME described in issue #2404

10 years agoUpdated metadata::creader::resolve_crate_deps to use the correct span. Clarified...
gentlefolk [Mon, 10 Feb 2014 03:29:21 +0000 (22:29 -0500)]
Updated metadata::creader::resolve_crate_deps to use the correct span. Clarified error message when an external crate's dependency is missing. Closes #2404.

10 years agoauto merge of #12352 : alexcrichton/rust/fix-master, r=brson
bors [Mon, 17 Feb 2014 22:16:53 +0000 (14:16 -0800)]
auto merge of #12352 : alexcrichton/rust/fix-master, r=brson

This deadlock was caused when the channel was closed at just the right time, so
the extra `self.cnt.fetch_add` actually should have preserved the DISCONNECTED
state of the channel. by modifying this the channel entered a state such that
the port would never succeed in dropping.

This also moves the increment of self.steals until after the MAX_STEALS block.
The reason for this is that in 'fn recv()' the steals variable is decremented
immediately after the try_recv(), which could in theory set steals to -1 if it
was previously set to 0 in try_recv().

Closes #12340

10 years agoFix a deadlock in channels, again.
Alex Crichton [Mon, 17 Feb 2014 21:59:25 +0000 (13:59 -0800)]
Fix a deadlock in channels, again.

This deadlock was caused when the channel was closed at just the right time, so
the extra `self.cnt.fetch_add` actually should have preserved the DISCONNECTED
state of the channel. by modifying this the channel entered a state such that
the port would never succeed in dropping.

This also moves the increment of self.steals until after the MAX_STEALS block.
The reason for this is that in 'fn recv()' the steals variable is decremented
immediately after the try_recv(), which could in theory set steals to -1 if it
was previously set to 0 in try_recv().

Closes #12340

10 years agoauto merge of #12337 : nick29581/rust/generic_extern, r=alexcrichton
bors [Mon, 17 Feb 2014 17:26:48 +0000 (09:26 -0800)]
auto merge of #12337 : nick29581/rust/generic_extern, r=alexcrichton

and fix up some formatting.

10 years agoAdded more scripts to tidy check
Derek Guenther [Thu, 13 Feb 2014 16:42:52 +0000 (10:42 -0600)]
Added more scripts to tidy check

10 years agoauto merge of #12331 : bjz/rust/count-ones, r=alexcrichton
bors [Mon, 17 Feb 2014 16:06:49 +0000 (08:06 -0800)]
auto merge of #12331 : bjz/rust/count-ones, r=alexcrichton

This is inspired by the [function naming in the Julia standard library](http://docs.julialang.org/en/release-0.2/stdlib/base/#Base.count_ones). It seems like a more self-explanatory name, and is more consistent with the accompanying methods, `leading_zeros` and `trailing_zeros`.

10 years agoauto merge of #12325 : big-guy/rust/doc-fixes, r=alexcrichton
bors [Mon, 17 Feb 2014 14:11:51 +0000 (06:11 -0800)]
auto merge of #12325 : big-guy/rust/doc-fixes, r=alexcrichton

* Change '...your own time' => '...your own type'
* Fix typo in the Vector2D example

10 years agoauto merge of #12284 : brson/rust/install, r=alexcrichton
bors [Mon, 17 Feb 2014 11:26:51 +0000 (03:26 -0800)]
auto merge of #12284 : brson/rust/install, r=alexcrichton

Work toward #9876.

This adds `prepare.mk`, which is simply a more heavily-parameterized `install.mk`, then uses `prepare` to implement both `install` and the windows installer (`dist`). Smoke tested on both Linux and Windows.

10 years agoForbid use of generics with foreign functions. Closes #10353.
Nick Cameron [Mon, 17 Feb 2014 05:52:11 +0000 (18:52 +1300)]
Forbid use of generics with foreign functions. Closes #10353.

10 years agoRename Bitwise::population_count to Bitwise::count_ones and add Bitwise::count_zeros
Brendan Zabarauskas [Sun, 16 Feb 2014 23:12:10 +0000 (10:12 +1100)]
Rename Bitwise::population_count to Bitwise::count_ones and add Bitwise::count_zeros

These are inspired by the [functions in the Julia standard library](http://docs.julialang.org/en/release-0.2/stdlib/base/#Base.count_ones).

10 years agoImplement named pipes for windows, touch up unix
Alex Crichton [Fri, 7 Feb 2014 18:37:58 +0000 (10:37 -0800)]
Implement named pipes for windows, touch up unix

* Implementation of pipe_win32 filled out for libnative
* Reorganize pipes to be clone-able
* Fix a few file descriptor leaks on error
* Factor out some common code into shared functions
* Make use of the if_ok!() macro for less indentation

Closes #11201

10 years agoMove unix pipes implementation to pipe_unix.rs
Alex Crichton [Fri, 7 Feb 2014 18:10:48 +0000 (10:10 -0800)]
Move unix pipes implementation to pipe_unix.rs

The windows named pipes implementation will have almost nothing to do with unix
pipes, so I think it's best if they live in separate files.

10 years agoImplement Unix domain sockets in libnative
Geoffroy Couprie [Thu, 16 Jan 2014 15:56:21 +0000 (16:56 +0100)]
Implement Unix domain sockets in libnative

10 years agoAddress review feedback
Brian Anderson [Sun, 16 Feb 2014 05:47:28 +0000 (21:47 -0800)]
Address review feedback

10 years agoauto merge of #12085 : alexcrichton/rust/issue-12082, r=brson
bors [Mon, 17 Feb 2014 00:46:39 +0000 (16:46 -0800)]
auto merge of #12085 : alexcrichton/rust/issue-12082, r=brson

This just copies the libuv implementation for libnative which seems reasonable
enough (uid/gid fail on windows).

Closes #12082

10 years agoUpgrade libuv
Alex Crichton [Sun, 16 Feb 2014 20:57:40 +0000 (12:57 -0800)]
Upgrade libuv

This notably includes joyent/libuv@6f62d62c in order to fix when processes fail
to spawn on windows

10 years agoAllow configuration of uid/gid/detach on processes
Alex Crichton [Fri, 7 Feb 2014 06:38:05 +0000 (22:38 -0800)]
Allow configuration of uid/gid/detach on processes

This just copies the libuv implementation for libnative which seems reasonable
enough (uid/gid fail on windows).

Closes #12082

10 years agoUpdate clients of the TaskBuilder API
Kevin Ballard [Thu, 13 Feb 2014 06:03:36 +0000 (22:03 -0800)]
Update clients of the TaskBuilder API

10 years agoClean up std::task docs, make TaskBuilder a real builder
Kevin Ballard [Thu, 13 Feb 2014 06:02:09 +0000 (22:02 -0800)]
Clean up std::task docs, make TaskBuilder a real builder

Delete all the documentation from std::task that references linked
failure.

Tweak TaskBuilder to be more builder-like. .name() is now .named() and
.add_wrapper() is now .with_wrapper(). Remove .watched() and
.unwatched() as they didn't actually do anything.

10 years agoauto merge of #12319 : SimonSapin/rust/build-symlink, r=alexcrichton
bors [Sun, 16 Feb 2014 20:51:40 +0000 (12:51 -0800)]
auto merge of #12319 : SimonSapin/rust/build-symlink, r=alexcrichton

10 years agoauto merge of #12312 : brson/rust/doc, r=alexcrichton
bors [Sun, 16 Feb 2014 19:36:40 +0000 (11:36 -0800)]
auto merge of #12312 : brson/rust/doc, r=alexcrichton

Only single out std. Put everything else in a consistent list.

10 years agoMinor documentation fixes in std::fmt
Sterling Greene [Sun, 16 Feb 2014 18:02:43 +0000 (13:02 -0500)]
Minor documentation fixes in std::fmt

* Change '...your own time' => '...your own type'
* Fix typo in the Vector2D example

10 years agoauto merge of #12313 : bjz/rust/tuple, r=huonw
bors [Sun, 16 Feb 2014 15:11:34 +0000 (07:11 -0800)]
auto merge of #12313 : bjz/rust/tuple, r=huonw

This renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters. It also removes the `CloneableTuple` and `ImmutableTuple` traits.

10 years agoRemove CloneableTuple and ImmutableTuple traits
Brendan Zabarauskas [Sun, 16 Feb 2014 09:36:43 +0000 (20:36 +1100)]
Remove CloneableTuple and ImmutableTuple traits

These are adequately covered by the Tuple2 trait.

10 years agoImprove naming of tuple getters, and add mutable tuple getter
Brendan Zabarauskas [Sun, 16 Feb 2014 11:19:41 +0000 (22:19 +1100)]
Improve naming of tuple getters, and add mutable tuple getter

Renames the `n*` and `n*_ref` tuple getters to `val*` and `ref*` respectively, and adds `mut*` getters.

10 years agoIgnore /build even if it’s a symlink.
Simon Sapin [Sun, 16 Feb 2014 12:41:41 +0000 (12:41 +0000)]
Ignore /build even if it’s a symlink.

10 years agoMerge ImmutableTuple* traits into their respective Tuple* trait
Brendan Zabarauskas [Sun, 16 Feb 2014 09:25:28 +0000 (20:25 +1100)]
Merge ImmutableTuple* traits into their respective Tuple* trait

10 years agoauto merge of #12310 : brson/rust/mkfilecleanup, r=sfackler
bors [Sun, 16 Feb 2014 08:51:33 +0000 (00:51 -0800)]
auto merge of #12310 : brson/rust/mkfilecleanup, r=sfackler

Two small fixes

10 years agodoc: Reorganize the library index
Brian Anderson [Sun, 16 Feb 2014 08:21:08 +0000 (00:21 -0800)]
doc: Reorganize the library index

Only single out std. Put everything else in a consistent list.

10 years agoDelegate ToStr implementation to Show for tuples
Brendan Zabarauskas [Sun, 16 Feb 2014 07:27:46 +0000 (18:27 +1100)]
Delegate ToStr implementation to Show for tuples

10 years agoImplement Show for 1-12 element tuples
Brendan Zabarauskas [Fri, 14 Feb 2014 14:20:43 +0000 (01:20 +1100)]
Implement Show for 1-12 element tuples

10 years agoauto merge of #12302 : alexcrichton/rust/issue-12295, r=brson
bors [Sun, 16 Feb 2014 07:36:26 +0000 (23:36 -0800)]
auto merge of #12302 : alexcrichton/rust/issue-12295, r=brson

The previous code erroneously assumed that 'steals > cnt' was always true, but
that was a false assumption. The code was altered to decrement steals to a
minimum of 0 instead of taking all of cnt into account.

I didn't include the exact test from #12295 because it could run for quite
awhile, and instead set the threshold for MAX_STEALS to much lower during
testing. I found that this triggered the old bug quite frequently when running
without this fix.

Closes #12295

10 years agomk: Fix typo, NO_MAKEFILE_DEPS -> NO_MKFILE_DEPS
Brian Anderson [Sun, 16 Feb 2014 07:12:56 +0000 (23:12 -0800)]
mk: Fix typo, NO_MAKEFILE_DEPS -> NO_MKFILE_DEPS

10 years agomk: Remove check-notidy, check-full, check-test
Brian Anderson [Sun, 16 Feb 2014 07:11:54 +0000 (23:11 -0800)]
mk: Remove check-notidy, check-full, check-test

Mostly useless

10 years agoauto merge of #12301 : FlaPer87/rust/issue-8893, r=alexcrichton
bors [Sun, 16 Feb 2014 06:06:27 +0000 (22:06 -0800)]
auto merge of #12301 : FlaPer87/rust/issue-8893, r=alexcrichton

10 years agoauto merge of #12305 : luqmana/rust/ub, r=sfackler
bors [Sun, 16 Feb 2014 04:46:26 +0000 (20:46 -0800)]
auto merge of #12305 : luqmana/rust/ub, r=sfackler

These are no longer valid options as of the recent llvm upgrade.

10 years agoauto merge of #12299 : sfackler/rust/limit-return, r=alexcrichton
bors [Sun, 16 Feb 2014 02:56:29 +0000 (18:56 -0800)]
auto merge of #12299 : sfackler/rust/limit-return, r=alexcrichton

This is useful in contexts like this:

```rust
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);
```

10 years agomk: Remove old flags to llc for arm.
Luqman Aden [Sun, 16 Feb 2014 01:08:33 +0000 (20:08 -0500)]
mk: Remove old flags to llc for arm.

10 years agoauto merge of #12298 : alexcrichton/rust/rustdoc-testing, r=sfackler
bors [Sun, 16 Feb 2014 00:36:27 +0000 (16:36 -0800)]
auto merge of #12298 : alexcrichton/rust/rustdoc-testing, r=sfackler

It's too easy to forget the `rust` tag to test something.

Closes #11698

10 years agoCorrectly reset steals when hitting MAX_STEALS
Alex Crichton [Sat, 15 Feb 2014 23:54:29 +0000 (15:54 -0800)]
Correctly reset steals when hitting MAX_STEALS

The previous code erroneously assumed that 'steals > cnt' was always true, but
that was a false assumption. The code was altered to decrement steals to a
minimum of 0 instead of taking all of cnt into account.

I didn't include the exact test from #12295 because it could run for quite
awhile, and instead set the threshold for MAX_STEALS to much lower during
testing. I found that this triggered the old bug quite frequently when running
without this fix.

Closes #12295

10 years agoSilence some unused import warnings
Alex Crichton [Sat, 15 Feb 2014 23:53:52 +0000 (15:53 -0800)]
Silence some unused import warnings

10 years agoauto merge of #12235 : huonw/rust/raii-lock, r=alexcrichton
bors [Sat, 15 Feb 2014 23:21:28 +0000 (15:21 -0800)]
auto merge of #12235 : huonw/rust/raii-lock, r=alexcrichton

- adds a `LockGuard` type returned by `.lock` and `.trylock` that unlocks the mutex in the destructor
- renames `mutex::Mutex` to `StaticNativeMutex`
- adds a `NativeMutex` type with a destructor
- removes `LittleLock`
- adds `#[must_use]` to `sync::mutex::Guard` to remind people to use it

10 years agoConvert some unnecessary StaticNativeMutexes to NativeMutexes.
Huon Wilson [Sat, 15 Feb 2014 04:01:00 +0000 (15:01 +1100)]
Convert some unnecessary StaticNativeMutexes to NativeMutexes.

10 years agostd::unstable::mutex: streamline & clarify documentation.
Huon Wilson [Sat, 15 Feb 2014 03:24:51 +0000 (14:24 +1100)]
std::unstable::mutex: streamline & clarify documentation.

10 years agosync: Add `#[must_use]` to the Mutex guard.
Huon Wilson [Sat, 15 Feb 2014 01:53:23 +0000 (12:53 +1100)]
sync: Add `#[must_use]` to the Mutex guard.

This helps people remember to save the return value to keep the mutex
locked as appropriate.

10 years agostd: add a NativeMutex type as a wrapper to destroy StaticNativeMutex.
Huon Wilson [Sat, 15 Feb 2014 01:01:52 +0000 (12:01 +1100)]
std: add a NativeMutex type as a wrapper to destroy StaticNativeMutex.

This obsoletes LittleLock, and so it is removed.

10 years agostd: Rename unstable::mutex::Mutex to StaticNativeMutex.
Huon Wilson [Sat, 15 Feb 2014 00:18:49 +0000 (11:18 +1100)]
std: Rename unstable::mutex::Mutex to StaticNativeMutex.

This better reflects its purpose and design.

10 years agostd: add tests for the _noguard lock/signal/wait methods on Mutex.
Huon Wilson [Thu, 13 Feb 2014 08:29:13 +0000 (19:29 +1100)]
std: add tests for the _noguard lock/signal/wait methods on Mutex.

10 years agostd: add an RAII unlocker to Mutex.
Huon Wilson [Thu, 13 Feb 2014 06:17:50 +0000 (17:17 +1100)]
std: add an RAII unlocker to Mutex.

This automatically unlocks its lock when it goes out of scope, and
provides a safe(ish) method to call .wait.

10 years agoAdd test and close #8893
Flavio Percoco [Sat, 15 Feb 2014 23:00:38 +0000 (00:00 +0100)]
Add test and close #8893

10 years agoAdd a method to LimitReader to return the limit
Steven Fackler [Sat, 15 Feb 2014 21:51:37 +0000 (13:51 -0800)]
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);

10 years agomk: Base the windows dist target on prepare.mk
Brian Anderson [Thu, 13 Feb 2014 08:22:18 +0000 (00:22 -0800)]
mk: Base the windows dist target on prepare.mk

10 years agomk: Fix a dist bug
Brian Anderson [Sat, 15 Feb 2014 03:36:56 +0000 (19:36 -0800)]
mk: Fix a dist bug

Fallout from moving doc/ to src/doc

10 years agomk: Base the install target on prepare.mk
Brian Anderson [Thu, 13 Feb 2014 07:53:36 +0000 (23:53 -0800)]
mk: Base the install target on prepare.mk

10 years agomk: Add prepare.mk
Brian Anderson [Thu, 13 Feb 2014 01:26:10 +0000 (17:26 -0800)]
mk: Add prepare.mk

This is a slightly more generic rewrite of install.mk. Currently
used for nothing, but we'll base all the binary distributables off it.

10 years agoauto merge of #12272 : alexcrichton/rust/snapshot, r=kballard
bors [Sat, 15 Feb 2014 22:06:26 +0000 (14:06 -0800)]
auto merge of #12272 : alexcrichton/rust/snapshot, r=kballard

This notably contains the `extern mod` => `extern crate` change.

Closes #9880

10 years agoauto merge of #12296 : dotdash/rust/byval_noalias, r=cmr
bors [Sat, 15 Feb 2014 20:46:23 +0000 (12:46 -0800)]
auto merge of #12296 : dotdash/rust/byval_noalias, r=cmr

Function parameters that are to be passed by value but don't fit into a
single register are currently passed by creating a copy on the stack and
passing a pointer to that copy to the callee. Since the copy is made
just for the function call, there are no aliases.

For example, this sometimes allows LLVM to eliminate unnecessary calls
to drop glue. Given

````rust
struct Foo {
    a: int,
    b: Option<~str>,
}

extern {
    fn eat(eat: Option<~str>);
}

pub fn foo(v: Foo) {
    match v {
        Foo { a: _, b } => unsafe { eat(b) }
    }
}
````

LLVM currently can't eliminate the drop call for the string, because it
only sees a _pointer_ to Foo, for which it has to expect an alias. So we
get:

````llvm
; Function Attrs: uwtable
define void @_ZN3foo20h9f32c90ae7201edbxaa4v0.0E(%struct.Foo* nocapture) unnamed_addr #0 {
"_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit":
  %1 = getelementptr inbounds %struct.Foo* %0, i64 0, i32 1, i32 0
  %2 = load { i64, i64, [0 x i8] }** %1, align 8
  store { i64, i64, [0 x i8] }* null, { i64, i64, [0 x i8] }** %1, align 8
  %3 = ptrtoint { i64, i64, [0 x i8] }* %2 to i64
  %.fca.0.insert = insertvalue { i64 } undef, i64 %3, 0
  tail call void @eat({ i64 } %.fca.0.insert)
  %4 = load { i64, i64, [0 x i8] }** %1, align 8
  %5 = icmp eq { i64, i64, [0 x i8] }* %4, null
  br i1 %5, label %_ZN3Foo9glue_drop17hf611996539d3036fE.exit, label %"_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i"

"_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i": ; preds = %"_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit"
  %6 = bitcast { i64, i64, [0 x i8] }* %4 to i8*
  tail call void @free(i8* %6) #1
  br label %_ZN3Foo9glue_drop17hf611996539d3036fE.exit

_ZN3Foo9glue_drop17hf611996539d3036fE.exit:       ; preds = %"_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit", %"_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i"
  ret void
}
````

But with the `noalias` attribute, it can safely optimize that to:

````llvm
define void @_ZN3foo20hd28431f929f0d6c4xaa4v0.0E(%struct.Foo* noalias nocapture) unnamed_addr #0 {
_ZN3Foo9glue_drop17he9afbc09d4e9c851E.exit:
  %1 = getelementptr inbounds %struct.Foo* %0, i64 0, i32 1, i32 0
  %2 = load { i64, i64, [0 x i8] }** %1, align 8
  store { i64, i64, [0 x i8] }* null, { i64, i64, [0 x i8] }** %1, align 8
  %3 = ptrtoint { i64, i64, [0 x i8] }* %2 to i64
  %.fca.0.insert = insertvalue { i64 } undef, i64 %3, 0
  tail call void @eat({ i64 } %.fca.0.insert)
  ret void
}
````

10 years agoDeclare by-value on-stack parameters to be noalias
Björn Steinbrink [Sat, 15 Feb 2014 20:31:20 +0000 (21:31 +0100)]
Declare by-value on-stack parameters to be noalias

Function parameters that are to be passed by value but don't fit into a
single register are currently passed by creating a copy on the stack and
passing a pointer to that copy to the callee. Since the copy is made
just for the function call, there are no aliases.

For example, this sometimes allows LLVM to eliminate unnecessary calls
to drop glue. Given

````rust
struct Foo {
    a: int,
    b: Option<~str>,
}

extern {
    fn eat(eat: Option<~str>);
}

pub fn foo(v: Foo) {
    match v {
        Foo { a: _, b } => unsafe { eat(b) }
    }
}
````

LLVM currently can't eliminate the drop call for the string, because it
only sees a _pointer_ to Foo, for which it has to expect an alias. So we
get:

````llvm
; Function Attrs: uwtable
define void @_ZN3foo20h9f32c90ae7201edbxaa4v0.0E(%struct.Foo* nocapture) unnamed_addr #0 {
"_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit":
  %1 = getelementptr inbounds %struct.Foo* %0, i64 0, i32 1, i32 0
  %2 = load { i64, i64, [0 x i8] }** %1, align 8
  store { i64, i64, [0 x i8] }* null, { i64, i64, [0 x i8] }** %1, align 8
  %3 = ptrtoint { i64, i64, [0 x i8] }* %2 to i64
  %.fca.0.insert = insertvalue { i64 } undef, i64 %3, 0
  tail call void @eat({ i64 } %.fca.0.insert)
  %4 = load { i64, i64, [0 x i8] }** %1, align 8
  %5 = icmp eq { i64, i64, [0 x i8] }* %4, null
  br i1 %5, label %_ZN3Foo9glue_drop17hf611996539d3036fE.exit, label %"_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i"

"_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i": ; preds = %"_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit"
  %6 = bitcast { i64, i64, [0 x i8] }* %4 to i8*
  tail call void @free(i8* %6) #1
  br label %_ZN3Foo9glue_drop17hf611996539d3036fE.exit

_ZN3Foo9glue_drop17hf611996539d3036fE.exit:       ; preds = %"_ZN34std..option..Option$LT$$UP$str$GT$9glue_drop17hc39b3015f3b9c69dE.exit", %"_ZN8_$UP$str9glue_drop17h15dbdbe2b8897a98E.exit.i.i"
  ret void
}
````

But with the `noalias` attribute, it can safely optimize that to:

````llvm
define void @_ZN3foo20hd28431f929f0d6c4xaa4v0.0E(%struct.Foo* noalias nocapture) unnamed_addr #0 {
_ZN3Foo9glue_drop17he9afbc09d4e9c851E.exit:
  %1 = getelementptr inbounds %struct.Foo* %0, i64 0, i32 1, i32 0
  %2 = load { i64, i64, [0 x i8] }** %1, align 8
  store { i64, i64, [0 x i8] }* null, { i64, i64, [0 x i8] }** %1, align 8
  %3 = ptrtoint { i64, i64, [0 x i8] }* %2 to i64
  %.fca.0.insert = insertvalue { i64 } undef, i64 %3, 0
  tail call void @eat({ i64 } %.fca.0.insert)
  ret void
}
````

10 years agoauto merge of #12270 : bstrie/rust/pnoise, r=huonw
bors [Sat, 15 Feb 2014 18:51:26 +0000 (10:51 -0800)]
auto merge of #12270 : bstrie/rust/pnoise, r=huonw

Mostly just style fixes, but also remove a heap allocation and switch to using a buffered writer rather than doing 60,000 `println!`s.

10 years agoClean up the Perlin noise benchmark
Ben Striegel [Fri, 14 Feb 2014 19:03:39 +0000 (14:03 -0500)]
Clean up the Perlin noise benchmark

10 years agoauto merge of #12282 : cmr/rust/cleanup-ptr, r=huonw
bors [Sat, 15 Feb 2014 17:36:26 +0000 (09:36 -0800)]
auto merge of #12282 : cmr/rust/cleanup-ptr, r=huonw

10 years agoimpl fmt::Pointer for &T and &mut T
Corey Richardson [Sat, 15 Feb 2014 05:10:31 +0000 (00:10 -0500)]
impl fmt::Pointer for &T and &mut T

10 years agostd: clean up ptr a bit
Corey Richardson [Fri, 14 Feb 2014 23:42:01 +0000 (18:42 -0500)]
std: clean up ptr a bit

10 years agoauto merge of #12286 : sfackler/rust/no-conditions, r=alexcrichton
bors [Sat, 15 Feb 2014 11:56:27 +0000 (03:56 -0800)]
auto merge of #12286 : sfackler/rust/no-conditions, r=alexcrichton

10 years agomk: Clean up conditions for including dist.mk
Brian Anderson [Wed, 12 Feb 2014 22:23:59 +0000 (14:23 -0800)]
mk: Clean up conditions for including dist.mk

10 years agoauto merge of #12283 : kballard/rust/env-args-bytes, r=erickt
bors [Sat, 15 Feb 2014 10:36:27 +0000 (02:36 -0800)]
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.

10 years agoFix all code examples
Alex Crichton [Sat, 15 Feb 2014 07:44:22 +0000 (23:44 -0800)]
Fix all code examples

10 years agoauto merge of #12230 : DaGenix/rust/io-decorator-changes, r=sfackler
bors [Sat, 15 Feb 2014 07:46:29 +0000 (23:46 -0800)]
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

10 years agoRemove broken link to old conditions tutorial
Steven Fackler [Sat, 15 Feb 2014 07:44:31 +0000 (23:44 -0800)]
Remove broken link to old conditions tutorial

10 years agoUpdate rustdoc testing to test all code blocks
Alex Crichton [Sat, 15 Feb 2014 07:30:10 +0000 (23:30 -0800)]
Update rustdoc testing to test all code blocks

It's too easy to forget the `rust` tag to have a code example tested, and it's
far more common to have testable code than untestable code.

This alters rustdoc to have only two directives, `ignore` and `should_fail`. The
`ignore` directive ignores the code block entirely, and the `should_fail`
directive has been fixed to only fail the test if the code execution fails, not
also compilation.

10 years agoextern mod => extern crate
Alex Crichton [Fri, 14 Feb 2014 18:10:06 +0000 (10:10 -0800)]
extern mod => extern crate

This was previously implemented, and it just needed a snapshot to go through

10 years agoRegister new snapshots
Alex Crichton [Fri, 14 Feb 2014 18:03:53 +0000 (10:03 -0800)]
Register new snapshots

This enables the parser error for `extern mod` => `extern crate` transitions.

10 years agoUpdate LimitReader to take the Reader to wrap by value
Palmer Cox [Fri, 14 Feb 2014 04:28:11 +0000 (23:28 -0500)]
Update LimitReader to take the Reader to wrap by value

10 years agoCreate RefReader and RefWriter adaptor structs
Palmer Cox [Fri, 14 Feb 2014 04:27:53 +0000 (23:27 -0500)]
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.

10 years agoUse str::from_utf8_lossy() for os::env() and friends
Kevin Ballard [Fri, 14 Feb 2014 23:18:51 +0000 (15:18 -0800)]
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).

10 years agoUse str::from_utf8_lossy() in os::args(), add os::args_as_bytes()
Kevin Ballard [Fri, 14 Feb 2014 22:42:40 +0000 (14:42 -0800)]
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.

10 years agoAdd c_str::CString.as_bytes_no_nul()
Kevin Ballard [Fri, 14 Feb 2014 23:42:35 +0000 (15:42 -0800)]
Add c_str::CString.as_bytes_no_nul()

10 years agoauto merge of #12274 : brson/rust/mkfiles, r=alexcrichton
bors [Sat, 15 Feb 2014 04:51:26 +0000 (20:51 -0800)]
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.

10 years agoauto merge of #12276 : alexcrichton/rust/issue-8449, r=kballard
bors [Sat, 15 Feb 2014 03:31:28 +0000 (19:31 -0800)]
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

10 years agoEnable 64-bit checked multiplication on 32-bit
Alex Crichton [Fri, 14 Feb 2014 20:54:15 +0000 (12:54 -0800)]
Enable 64-bit checked multiplication on 32-bit

This was just waiting for compiler-rt support, which was added in #12027

Closes #8449

10 years agomk: Address review feedback
Brian Anderson [Sat, 15 Feb 2014 03:17:50 +0000 (19:17 -0800)]
mk: Address review feedback

10 years agoauto merge of #12277 : alexcrichton/rust/fix-rustdoc-render, r=huonw
bors [Sat, 15 Feb 2014 01:51:29 +0000 (17:51 -0800)]
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.

10 years agomk: Move version info to top of main.mk
Brian Anderson [Fri, 14 Feb 2014 19:24:22 +0000 (11:24 -0800)]
mk: Move version info to top of main.mk

Just so it's easier to find.

10 years agomk: Improve build system help commands
Brian Anderson [Fri, 14 Feb 2014 11:34:18 +0000 (03:34 -0800)]
mk: Improve build system help commands

10 years agomk: Add NO_MKFILE_DEPS for turning off rebuild from makefile changes
Brian Anderson [Fri, 14 Feb 2014 08:10:06 +0000 (00:10 -0800)]
mk: Add NO_MKFILE_DEPS for turning off rebuild from makefile changes

10 years agomk: Move most of Makefile.in to .mk files
Brian Anderson [Fri, 14 Feb 2014 07:55:49 +0000 (23:55 -0800)]
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.

10 years agomk: Remove the concept of 'snapshot transitions'
Brian Anderson [Fri, 14 Feb 2014 07:25:07 +0000 (23:25 -0800)]
mk: Remove the concept of 'snapshot transitions'

This way of doing snapshots hasn't been used since 2011.

10 years agomk: Add some serious documentation and 'make help'
Brian Anderson [Fri, 14 Feb 2014 05:22:08 +0000 (21:22 -0800)]
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.

10 years agoauto merge of #12271 : kballard/rust/vim-extern-crate, r=huonw
bors [Fri, 14 Feb 2014 23:51:29 +0000 (15:51 -0800)]
auto merge of #12271 : kballard/rust/vim-extern-crate, r=huonw

10 years agoAdd crate keyword to gedit language spec
Kevin Ballard [Fri, 14 Feb 2014 23:37:22 +0000 (15:37 -0800)]
Add crate keyword to gedit language spec

10 years agoAdd crate to emacs and kate modefiles
Kevin Ballard [Fri, 14 Feb 2014 22:36:37 +0000 (14:36 -0800)]
Add crate to emacs and kate modefiles

10 years agoauto merge of #12195 : kballard/rust/rustdoc-strip-impls-of-stripped, r=cmr
bors [Fri, 14 Feb 2014 21:36:35 +0000 (13:36 -0800)]
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.

10 years agoUpdate restrictions on rustdoc source rendering
Alex Crichton [Fri, 14 Feb 2014 21:11:36 +0000 (13:11 -0800)]
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.

10 years agoauto merge of #12267 : alexcrichton/rust/rollup, r=alexcrichton
bors [Fri, 14 Feb 2014 20:21:51 +0000 (12:21 -0800)]
auto merge of #12267 : alexcrichton/rust/rollup, r=alexcrichton

The last commit has the closed PRs

10 years agoAdd CheckedDiv to vim syntax
Kevin Ballard [Fri, 14 Feb 2014 20:02:18 +0000 (12:02 -0800)]
Add CheckedDiv to vim syntax

10 years agoUpdate vim syntax for extern crate
Kevin Ballard [Fri, 14 Feb 2014 19:27:53 +0000 (11:27 -0800)]
Update vim syntax for extern crate