Commit Graph

27590 Commits

Author SHA1 Message Date
Kiet Tran 19d913bf25 Prefer lifetime suggestion over generic error 2014-03-24 18:58:37 -04:00
bors bcaaffbe1e auto merge of #13080 : alexcrichton/rust/possible-osx-deadlock, r=brson
The OSX bots have been deadlocking recently in the rustdoc tests. I have only
been able to rarely reproduce the deadlock on my local setup. When reproduced,
it looks like the child process is spinning on the malloc mutex, which I
presume is locked with no other threads to unlock it.

I'm not convinced that this is what's happening, because OSX should protect
against this with pthread_atfork by default. Regardless, running as little code
as possible in the child after fork() is normally a good idea anyway, so this
commit moves all allocation to the parent process to run before the child
executes.

After running 6k iterations of rustdoc tests, this deadlocked twice before, and
after 20k iterations afterwards, it never deadlocked. I draw the conclusion that
this is either sweeping the bug under the rug, or it did indeed fix the
underlying problem.
2014-03-24 14:32:09 -07:00
Brian Anderson 39b48fb883 mk: Make distcheck depend on dist-docs 2014-03-24 14:29:23 -07:00
Brian Anderson d62163188a Revert "mk: Run 'make install' through install.sh"
This reverts commit e93709a911637194835268420e67d768ee19b5df.
2014-03-24 14:29:22 -07:00
Brian Anderson c796f89dbc mk: Fix prepare.mk
The way it was formulated you could only 'prepare' one directory per build.
2014-03-24 14:29:20 -07:00
Brian Anderson 70a10758de mk: Fix a minor UI bug 2014-03-24 14:29:19 -07:00
Brian Anderson a2e8e30b11 mk: Don't rm 'dist' during clean, just its contents
This is not for temporaries now
2014-03-24 14:29:19 -07:00
Brian Anderson ba98689f09 mk: Remove some debug logging 2014-03-24 14:29:19 -07:00
Brian Anderson fe5bd8857d install: Don't try to run binaries on install
I think there are likely to be scenarios where this script is run
to move files to the correct place during cross-compiles.
2014-03-24 14:29:18 -07:00
Brian Anderson eed808b532 install: Improve error handling 2014-03-24 14:29:18 -07:00
Brian Anderson 169f08dd59 mk: Cleanup dist.mk yet more 2014-03-24 14:29:18 -07:00
Brian Anderson c2e5e62135 mk: Fix some dist deps for parallel builds 2014-03-24 14:29:18 -07:00
Brian Anderson cc5fae720a install: Error on uninstall if manifest can't be found 2014-03-24 14:29:18 -07:00
Brian Anderson 8694c28762 mk: Run 'make install' through install.sh 2014-03-24 14:29:17 -07:00
Brian Anderson 805d0e53fd mk: Fix location of man pages in prepare.mk 2014-03-24 14:29:17 -07:00
Brian Anderson b8138e0cf2 mk: Wire up everything to dist and distcheck
Fix some misc bugs
2014-03-24 14:29:17 -07:00
Brian Anderson dd7a60e0c3 mk: Fix distcheck
Also, add more distcheck tests
2014-03-24 14:29:17 -07:00
Brian Anderson ae0e47a6eb mk: Add FIXME about making windows installer support all hosts 2014-03-24 14:29:17 -07:00
Brian Anderson 116ebe5af8 mk: Add docs to dist prep
For integrating doc upload into the dist-snap process
2014-03-24 14:29:16 -07:00
Brian Anderson 92d8181bde mk: Put win installer in correct dir 2014-03-24 14:29:16 -07:00
Brian Anderson 44842db533 mk: Cleanup version handling and add support for nightly dists 2014-03-24 14:29:16 -07:00
Brian Anderson 669a0554da mk: Make OS X .pkg for all arches 2014-03-24 14:29:16 -07:00
Brian Anderson 4176cf47df mk: Cleanup 2014-03-24 14:29:15 -07:00
Brian Anderson df141e624d mk: Reorder definitions in dist.mk
Just to be more logical, put big headers between different installers
2014-03-24 14:29:15 -07:00
Brian Anderson e30ab71e08 mk: Stop building OS X .pkg as part of 'make dist'
This doesn't work quite right yet (we need to build packages for all hosts)
and I'm not ready to turn on new dist artifacts yet, but I want to start doing
dry runs for 0.10, so I'm turning this off for now.
2014-03-24 14:29:15 -07:00
bors e06348ea55 auto merge of #13049 : alexcrichton/rust/io-fill, r=huonw
This method can be used to fill a byte slice of data entirely, and it's considered an error if any error happens before its entirely filled.
2014-03-24 12:06:58 -07:00
Alex Crichton e2ae458548 doc: Update the runtime guide with green changes
This updates a few code examples about booting libgreen/libnative and also
spells out how the event loop factory is required.
2014-03-24 11:19:28 -07:00
Alex Crichton 3ccad75641 rustc: Remove all crate map support
The crate map is no longer necessary now that logging and event loop factories
have been moved out.

Closes #11617
Closes #11731
2014-03-24 11:19:28 -07:00
Alex Crichton b19261a749 green: Remove the dependence on the crate map
This is the final nail in the coffin for the crate map. The `start` function for
libgreen now has a new added parameter which is the event loop factory instead
of inferring it from the crate map. The two current valid values for this
parameter are `green::basic::event_loop` and `rustuv::event_loop`.
2014-03-24 11:19:28 -07:00
Flavio Percoco 9021a3f988 rustc: Completely forbid borrows of unsafe statics
Summary:
It was possible to borrow unsafe static items in static initializers.
This patch implements a small `Visitor` that walks static initializer's
expressions and checks borrows aliasability.

Fixes #13005

Test Plan: make check

Differential Revision: http://phabricator.octayn.net/D2
2014-03-24 18:04:10 +01:00
bors e6468a8215 auto merge of #13113 : pnkfelix/rust/correct-static-kind-doc, r=huonw
While double-checking my understanding of the meaning of `'static`, I made the following test program:

```rust
fn foo<X:'static>(_x: X) { }

#[cfg(not(acceptable))]
fn bar() {
    let a = 3;
    let b = &a;
    foo(b);
}

#[cfg(acceptable)]
fn bar() {
    static c : int = 4;;
    let d : &'static int = &c;
    foo(d);
}

fn main() {
    bar();
}
```

Transcript of compiling above program, illustrating that the `--cfg acceptable` variant of `bar` compiles successfully, showing that the`'static` kind bound only disallows non-`static` references, not *all* references:

```
% rustc --version
/Users/fklock/opt/rust-dbg/bin/rustc 0.10-pre (caf17fe 2014-03-21 02:21:50 -0700)
host: x86_64-apple-darwin
% rustc /tmp/s.rs
/tmp/s.rs:7:5: 7:8 error: instantiating a type parameter with an incompatible type `&int`, which does not fulfill `'static`
/tmp/s.rs:7     foo(b);
                ^~~
error: aborting due to previous error
% rustc --cfg acceptable /tmp/s.rs
% ./s
%
```

(Note that the explicit type annotation on `let d : &'static int` is necessary; it did not suffice for me to just write `let d = &'static c;`. That might be a latent bug, I am not sure yet.)

Anyway, a fix to the documentation seemed prudent.
2014-03-24 10:01:57 -07:00
bors f8f60d80bf auto merge of #12998 : huonw/rust/log_syntax, r=alexcrichton
syntax: allow `trace_macros!` and `log_syntax!` in item position.

Previously

    trace_macros!(true)
    fn main() {}

would complain about `trace_macros` being an expression macro in item
position. This is a pointless limitation, because the macro is purely
compile-time, with no runtime effect. (And similarly for log_syntax.)

This also changes the behaviour of `trace_macros!` very slightly, it
used to be equivalent to

    macro_rules! trace_macros {
        (true $($_x: tt)*) => { true };
        (false $($_x: tt)*) => { false }
    }

I.e. you could invoke it with arbitrary trailing arguments, which were
ignored. It is changed to accept only exactly `true` or `false` (with no
trailing arguments) and expands to `()`.
2014-03-24 07:11:59 -07:00
Felix S. Klock II 57ac379a63 Correct overly broad definition of `'static` kind bound.
While double-checking my understanding of the meaning of `'static`,
I made the following test program:

```rust
fn foo<X:'static>(_x: X) { }

#[cfg(not(acceptable))]
fn bar() {
    let a = 3;
    let b = &a;
    foo(b);
}

#[cfg(acceptable)]
fn bar() {
    static c : int = 4;;
    let d : &'static int = &c;
    foo(d);
}

fn main() {
    bar();
}
```

Transcript of compiling above program, illustrating that the `--cfg
acceptable` variant of `bar` compiles successfully, showing that the
`'static` kind bound only disallows non-`static` references, not *all*
references:

```
% rustc --version
/Users/fklock/opt/rust-dbg/bin/rustc 0.10-pre (caf17fe 2014-03-21 02:21:50 -0700)
host: x86_64-apple-darwin
% rustc /tmp/s.rs
/tmp/s.rs:7:5: 7:8 error: instantiating a type parameter with an incompatible type `&int`, which does not fulfill `'static`
/tmp/s.rs:7     foo(b);
                ^~~
error: aborting due to previous error
% rustc --cfg acceptable /tmp/s.rs
% ./s
%
```

(Note that the explicit type annotation on `let d : &'static int` is
necessary; it did not suffice for me to just write `let d = &'static
c;`.  That might be a latent bug, I am not sure yet.)

Anyway, a fix to the documentation seemed prudent.
2014-03-24 13:03:43 +01:00
bors 11d9483d58 auto merge of #12948 : olleolleolle/rust/master, r=huonw
Rust doc sprint: adding doc strings to the Terminfo library.

This is my very first Rust repository PR, so please do not hold back any formatting, nit-picky commentary. I need it.
2014-03-24 04:41:53 -07:00
Olle Jonsson a6c14dda21 Documentation sprint: Terminfo 2014-03-24 12:16:15 +01:00
noam 4b224af72a Added suggested notes
* Note on while loop not supporting named breaks.
* Note on hygienic macros (and example of such within loops)
2014-03-24 00:43:43 -04:00
bors 2c7f3b850c auto merge of #13096 : sstewartgallus/rust/cleanup-test-warnings, r=huonw 2014-03-23 16:31:52 -07:00
noam 7dfa4b2982 docs: named lifetimes
* Include tip given by Leo Testard in mailing list about labeled `break`
and `continue`:
https://mail.mozilla.org/pipermail/rust-dev/2014-March/009145.html
* cross-reference named lifetimes in tutorial -> lifetimes guide
* Broke named lifetimes section into two sub-sections.
* Added mention of `'static` lifetime.
2014-03-23 18:29:58 -04:00
bors 1599ac9cf2 auto merge of #13095 : alexcrichton/rust/serialize-tuple, r=huonw
This commit moves from {read,emit}_seq for tuples to {read,emit}_tuple, as well
as providing a generalized macro for generating these implementations from one
invocation.

Closes #13086
2014-03-23 15:16:48 -07:00
Steven Stewart-Gallus 8feb2ddf12 This commit cleans up a few test warnings 2014-03-23 14:22:17 -07:00
bors 841f31ecf9 auto merge of #13074 : pczarn/rust/build-rlib, r=alexcrichton
Fixes #12992

I tried to increase the number of deflate's probes. Reduction of 0.5% or 2% is not enough.
2014-03-23 14:01:52 -07:00
bors bc37b8fde5 auto merge of #13103 : mozilla-servo/rust/url-totaleq, r=alexcrichton 2014-03-23 11:56:54 -07:00
Alex Crichton e46e9332d9 serialize: Read/emit tuples with {read,emit}_tuple
This commit moves from {read,emit}_seq for tuples to {read,emit}_tuple, as well
as providing a generalized macro for generating these implementations from one
invocation.

Closes #13086
2014-03-23 10:10:13 -07:00
Alex Crichton 4d5aafd3a6 sync: Introduce new wrapper types for locking
This introduces new synchronization types which are meant to be the foundational
building blocks for sharing data among tasks. The new Mutex and RWLock types
have a type parameter which is the internal data that is accessed. Access to the
data is all performed through the guards returned, and the guards all have
autoderef implemented for easy access.
2014-03-23 09:45:20 -07:00
Alex Crichton ae049e82f8 sync: Rewrite the base primitives
This commit rewrites the core primitives of the sync library: Mutex, RWLock, and
Semaphore. These primitives now have updated, more modernized apis:

* Guards are returned instead of locking with closures. All condition variables
  have moved inside the guards and extraneous methods have been removed.
* Downgrading on an rwlock is now done through the guard instead of the rwlock
  itself.

These types are meant to be general locks, not locks of an internal type (for
external usage). New types will be introduced for locking shared data.
2014-03-23 09:45:20 -07:00
Alex Crichton 53e451f410 sync: Move Once to using &self
Similarly to the rest of the previous commits, this moves the once primitive to
using &self instead of &mut self for proper sharing among many threads now.
2014-03-23 09:45:20 -07:00
Alex Crichton 3572a30e7a sync: Move the Mutex type to using &self
This also uses the Unsafe type for any interior mutability in the type to avoid
transmutes.
2014-03-23 09:45:20 -07:00
Alex Crichton d6b3f1f231 sync: Move the concurrent queue to using &self
This commit also lifts it up a level in the module hierarchy in the soon-to-come
reorganization of libsync.
2014-03-23 09:45:19 -07:00
Alex Crichton dd64bd83b7 std: Move NativeMutex from &mut self to &self
The proper usage of shared types is now sharing through `&self` rather than
`&mut self` because the mutable version will provide stronger guarantees (no
aliasing on *any* thread).
2014-03-23 09:45:19 -07:00
Alex Crichton da118e88d5 Snapshot cleanup 2014-03-23 09:45:13 -07:00