Commit Graph

27529 Commits

Author SHA1 Message Date
Alex Crichton
ab1dd09d73 rustc: Switch defaults from libgreen to libnative
The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonable with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named "<main>"
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling
2014-03-21 12:03:13 -07:00
Alex Crichton
988664ac8a rustdoc: Fix file locking on windows
If the dwShareMode parameter is 0 on windows, it "prevents other processes from
opening a file or device if they request delete, read, or write access", which
is the opposite of what we want! This changes the 0 parameter to something which
will allow multiple processes to open the file and then lock it.
2014-03-21 09:26:34 -07:00
bors
7b957a879b auto merge of #13056 : huonw/rust/devecing-tests, r=pnkfelix
test: Remove all `~[T]` from tests, libgetopts, compiletest, librustdoc, and libnum

And most from libtest, libflate, and adds `deny(deprecated_owned_vector)`s to the smaller modules with that have zero (or nearly zero) uses of `~[T]`.

Revival of #12837
2014-03-21 08:21:51 -07:00
Huon Wilson
0384952a65 syntax: add the OwnedSlice vector wrapper.
This is a stand-in until we have a saner `~[T]` type (i.e. a proper
owned slice). It's a library version of what `~[T]` will be, i.e. an
owned pointer and a length.
2014-03-22 01:36:46 +11:00
Huon Wilson
cda33346d0 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-22 01:27:23 +11:00
Huon Wilson
40a52c0f0a Add #[deny(deprecated_owned_vector)] to several modules. 2014-03-22 01:08:57 +11:00
Huon Wilson
d50f5bd722 getopts: remove all uses of ~[].
And stop regressions with the lint.
2014-03-22 01:08:57 +11:00
Huon Wilson
bc3a10b9f9 Remove nearly all uses of ~[] from libtest.
Deny further uses, with explicit allows on a few specific functions.
2014-03-22 01:08:57 +11:00
Huon Wilson
6d778ff610 Remove outdated and unnecessary std::vec_ng::Vec imports.
(And fix some tests.)
2014-03-22 01:08:57 +11:00
bors
a0f943cd3a auto merge of #12654 : edwardw/rust/rc-arc, r=huonw
Since `Arc` has been using `Atomic`, this closes 12625.

Closes #12625.
2014-03-21 07:06:49 -07:00
Edward Wang
db5206c32a Rewrite rc::Rc using cell::Cell
Since `Arc` has been using `Atomic`, this closes 12625.

Closes #12625.
2014-03-21 20:49:18 +08:00
Patrick Walton
af79a5aa7d test: Make manual changes to deal with the fallout from removal of
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
2014-03-21 23:37:21 +11:00
Patrick Walton
579eb2400b test: Automatically remove all ~[T] from tests. 2014-03-21 23:37:21 +11:00
Patrick Walton
0b714b4ba6 libstd: Add some methods to Vec<T>. 2014-03-21 23:37:21 +11:00
bors
caf17fea06 auto merge of #13029 : FlaPer87/rust/master, r=alexcrichton
This should prevent lot of doc errors in Rust's buildbot and it shouldn't take long to run on travis. We could probably limit it to `std` but I preferred to just check all docs in this phase too.

@alexcrichton r?
2014-03-21 02:21:50 -07:00
bors
739f22f611 auto merge of #13037 : alexcrichton/rust/attr-syntax, r=brson
This will require a snapshot to finish, but these commits update the parser to parse attributes of the form `#![...]`

Thanks to @TheHydroImpulse for all the initial work!

cc #2569
2014-03-20 21:11:47 -07:00
Steven Fackler
1d98fe12a8 Clean up marker types and Unsafe initialization 2014-03-20 20:33:23 -07:00
Alex Crichton
e1ca02ec02 std: Implement Clone/TotalEq for ProcessExit
It's useful for structures which use deriving(Clone, TotalEq), even though it's
implicitly copyable.

Closes #13047
2014-03-20 20:30:12 -07:00
Steven Fackler
181875ca50 Remove RefCell::{with, with_mut}
These are superfluous now that we have fixed rvalue lifetimes and Deref.
2014-03-20 19:55:52 -07:00
Alex Crichton
811257eda5 std: Rename {push,read}_bytes to {push,read}_exact
These methods can be mistaken for general "read some bytes" utilities when
they're actually only meant for reading an exact number of bytes. By renaming
them it's much clearer about what they're doing without having to read the
documentation.

Closes #12892
2014-03-20 19:45:56 -07:00
Alex Crichton
84a91b8603 syntax: Tidy up parsing the new attribute syntax 2014-03-20 18:51:52 -07:00
Daniel Fagnan
4e00cf6134 Added new attribute syntax with backward compatibility.
Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
2014-03-20 18:06:53 -07:00
Huon Wilson
7785fe1916 syntax: make OptVec immutable.
This is the first step to replacing OptVec with a new representation:
remove all mutability. Any mutations have to go via `Vec` and then make
to `OptVec`.

Many of the uses of OptVec are unnecessary now that Vec has no-alloc
emptiness (and have been converted to Vec): the only ones that really
need it are the AST and sty's (and so on) where there are a *lot* of
instances of them, and they're (mostly) immutable.
2014-03-21 10:52:48 +11:00
Alex Crichton
9e66f2c6b4 std: Update atomic documentation to remove 'mut'
It's all no longer necessary
2014-03-20 15:06:34 -07:00
bors
6eae7df43c auto merge of #13023 : thestinger/rust/deep_clone, r=alexcrichton 2014-03-20 15:01:47 -07:00
Brian Anderson
61622dd20c std: Remove AtomicU64
Support for this is less universal than for word-size things;
it has no users; i'd rather play it safe.
2014-03-20 13:33:43 -07:00
Brian Anderson
8748322c9b std: Make the generic atomics in sync::atomics private
I'm not comfortable exposing public functions that purport to do
atomic operations on arbitrary T.
2014-03-20 13:33:43 -07:00
Brian Anderson
eb25c42fc8 std: Make the generic atomics take unsafe pointers
These mutate values behind references that are Freeze, which is not
allowed.
2014-03-20 13:33:43 -07:00
bors
7334c11b4b auto merge of #13026 : alexcrichton/rust/snapshots, r=huonw 2014-03-20 11:06:42 -07:00
Alex Crichton
11ac4df4d2 Register new snapshots 2014-03-20 11:02:26 -07:00
bors
b568efc0cf auto merge of #13020 : alexcrichton/rust/vec, r=brson
The commits have the details.
2014-03-20 09:51:44 -07:00
Brian Anderson
f3fef9a649 std: Make atomics immutable. #11583
In Rust, the strongest guarantee that `&mut` provides is that the memory
pointed to is *not aliased*, whereas `&`'s guarantees are much weaker:
that the value can be aliased, and may be mutated under proper precautions
(interior mutability).

Our atomics though use `&mut` for mutation even while creating multiple
aliases, so this changes them to use 'interior mutability', mutating
through immutable references.
2014-03-20 09:44:29 -07:00
Alex Crichton
da3625161d Removing imports of std::vec_ng::Vec
It's now in the prelude.
2014-03-20 09:30:14 -07:00
Alex Crichton
7a5a8c3c07 rustc: Default the ~[] lint to allow for now
Most of the standard distribution is still using ~[] instead of Vec, so this
lint is essentially useless currently. When the standard distribution has been
ported to not use ~[], then we can turn the lint back on.
2014-03-20 09:13:44 -07:00
Alex Crichton
0305ed5d22 std: Add Vec to the prelude
This is an incredibly common type, and it is expected to be used in many many
places. This type should be in the prelude.
2014-03-20 09:13:44 -07:00
bors
c01e2f05a3 auto merge of #13017 : alexcrichton/rust/issue-13010, r=huonw
Previously, any library of the pattern `lib<name>-<hash>-<version>.so` was
>considered a candidate (rightly so) for loading a crate. Sets are generated for
each unique `<hash>`, and then from these sets a candidate is selected. If a set
contained more than one element, then it immediately generated an error saying
that multiple copies of the same dylib were found.

This is incorrect because each candidate needs to be validated to actually
contain a rust library (valid metadata). This commit alters the logic to filter
each set of candidates for a hash to only libraries which are actually rust
libraries. This means that if multiple false positives are found with the right
name pattern, they're all ignored.

Closes #13010
2014-03-20 08:21:46 -07:00
bors
8cfef59cc0 auto merge of #13015 : tbu-/rust/pr_remove_immut, r=alexcrichton
Remove std::cast::transmute_immut_unsafe.
It can be done in safe code using `as *T`.
2014-03-20 07:06:45 -07:00
bors
8e285208d5 auto merge of #12686 : FlaPer87/rust/shared, r=nikomatsakis
`Share` implies that all *reachable* content is *threadsafe*.

Threadsafe is defined as "exposing no operation that permits a data race if multiple threads have access to a &T pointer simultaneously". (NB: the type system should guarantee that if you have access to memory via a &T pointer, the only other way to gain access to that memory is through another &T pointer)...

Fixes #11781
cc #12577 

What this PR will do
================

- [x] Add Share kind and
- [x]  Replace usages of Freeze with Share in bounds.
- [x] Add Unsafe<T> #12577
- [x] Forbid taking the address of a immutable static item with `Unsafe<T>` interior

What's left to do in a separate PR (after the snapshot)?
===========================================

- Remove `Freeze` completely
2014-03-20 05:51:48 -07:00
bors
95ee0a04fd auto merge of #12980 : cmr/rust/overhaul-stdio, r=thestinger
this comes from a discussion on IRC where the split between stdin and stdout
seemed unnatural, and the fact that reading on stdin won't flush stdout, which
is unlike every other language (including C's stdio).
2014-03-20 04:36:50 -07:00
bors
4224147bab auto merge of #13028 : thestinger/rust/vec_ng, r=huonw
Closes #12771
2014-03-20 02:46:49 -07:00
Steven Fackler
cdab8a76f4 A couple of fixes to vec_ng docs 2014-03-20 05:44:25 -04:00
Flavio Percoco
7b19574a2c Mention Share in the tutorial 2014-03-20 10:32:53 +01:00
Flavio Percoco
0aebdaced5 Mention share in guide-unsafe instead of freeze 2014-03-20 10:32:44 +01:00
Flavio Percoco
3c4edff9b5 Let travis check docs for stage1 2014-03-20 10:20:08 +01:00
Flavio Percoco
598fc75c4d Make atomics interior Unsafe<T> 2014-03-20 10:17:29 +01:00
Flavio Percoco
68a3ec08b3 Allow static items that don't fulfill Freeze 2014-03-20 10:17:28 +01:00
Flavio Percoco
ff1c49fa54 Forbid borrow of static items with unsafe interior 2014-03-20 10:17:28 +01:00
Flavio Percoco
69ccd807da Gather loans for static items
We currently gather loans for static items that are defined within
functions. This change enables loan gathering on static items declared
globally.
2014-03-20 10:17:28 +01:00
Flavio Percoco
8767c69339 Let ArcData use Unsafe<T> 2014-03-20 10:17:28 +01:00
Flavio Percoco
3848021fae Make Cell and RefCell use Unsafe<T> 2014-03-20 10:16:56 +01:00