Commit Graph

29327 Commits

Author SHA1 Message Date
Alex Crichton
05a453edb3 green: Remove usage of UnsafeArc 2014-05-19 18:12:18 -07:00
Alex Crichton
5e10d373b5 rustuv: Remove usage of UnsafeArc 2014-05-19 18:12:18 -07:00
Alex Crichton
88b322c5fd native: Remove UnsafeArc in favor of just Arc 2014-05-19 18:12:18 -07:00
Alex Crichton
4c8a4d241a std: Remove UnsafeArc
This type has been superseded by Arc<Unsafe<T>>. The UnsafeArc type is a relic
of an era that has long since past, and with the introduction of liballoc the
standard library is able to use the Arc smart pointer. With little need left for
UnsafeArc, it was removed.

All existing code using UnsafeArc should either be reevaluated to whether it can
use only Arc, or it should transition to Arc<Unsafe<T>>

[breaking-change]
2014-05-19 18:12:18 -07:00
Alex Crichton
73729e94c8 std: Move comm primitives away from UnsafeArc
They currently still use `&mut self`, this migration was aimed towards moving
from UnsafeArc<T> to Arc<Unsafe<T>>
2014-05-19 17:50:57 -07:00
TyOverby
3001450f95 core::iter::order functions now take two types of iterators.
Previously the type signatures of the ordering functions in
`core::iter::order` took two iterators, but only if they were
the same type of iterator.  This commit loosens that restriction
and allows different kinds of iterators (but with the same type
of elements) to be compared.
2014-05-19 17:37:39 -07:00
Alex Crichton
d49aef7c02 std: Build Exclusive on Arc<Unsafe<T>>
This removes the usage of UnsafeArc
2014-05-19 17:36:04 -07:00
Alex Crichton
84378b0b5a std: Use Arc instead of UnsafeArc in BlockedTask 2014-05-19 17:33:40 -07:00
Alex Crichton
fe93c3d47e std: Rebuild spsc with Unsafe/&self
This removes the incorrect usage of `&mut self` in a concurrent setting.
2014-05-19 17:32:04 -07:00
Alex Crichton
2966e970ca std: Rebuild mpsc queue with Unsafe/&self
This removes the incorrect `&mut self` taken because it can alias among many
threads.
2014-05-19 17:27:52 -07:00
Kevin Butler
f9695a6256 rustc: Better resolve errors for &T, &mut T, remove failure condition. 2014-05-20 01:08:05 +01:00
bors
e9018f9c75 auto merge of #14295 : aturon/rust/hide-init_to_vec, r=alexcrichton
The `init_to_vec` function in `collections::bitv` was exposed as an
inherent method, but appears to just be a helper function for the
`to_vec` method. This patch inlines the definition, removing
`init_to_vec` from the public API.

[breaking-change]
2014-05-19 17:06:36 -07:00
Alex Crichton
7db02e20f2 std: Rebuild mpmc queues on Unsafe/Arc
This removes usage of UnsafeArc and uses proper self mutability for concurrent
types.
2014-05-19 16:01:48 -07:00
Alex Crichton
efbd3724c0 std: Rebuild sync::deque on Arc
This also removes the `&mut self` requirement, using the correct `&self`
requirement for concurrent types.
2014-05-19 15:51:31 -07:00
bors
1ba7bd10c9 auto merge of #14286 : cmr/rust/shard-benches, r=alexcrichton
This has no tests because it's near impossible to test -- since TestFn uses
`proc`s, they can not be cloned or tested for equality. The only way to really
test this is making sure that for a given number of shards `a`, sharding from
1 to `a` yields the complete set of tests. But `filter_tests` takes its vector
by value and `proc`s cannot be compared.

[breaking-change]

Closes #10898
2014-05-19 15:31:34 -07:00
Corey Richardson
2eeb4992df test: index shards at 1, not 0
This has no tests because it's near impossible to test -- since TestFn uses
`proc`s, they can not be cloned or tested for equality. The only way to really
test this is making sure that for a given number of shards `a`, sharding from
1 to `a` yields the complete set of tests. But `filter_tests` takes its vector
by value and `proc`s cannot be compared.

[breaking-change]

Closes #10898
2014-05-19 14:27:29 -07:00
Aaron Turon
a211907f88 libcollections: remove init_to_vec
The `init_to_vec` function in `collections::bitv` was exposed as an
inherent method, but appears to just be a helper function for the
`to_vec` method. This patch inlines the definition, removing
`init_to_vec` from the public API.

[breaking-change]
2014-05-19 13:50:03 -07:00
bors
1c4a9b98b9 auto merge of #14294 : kballard/rust/result_unwrap_or_else, r=alexcrichton
Result.unwrap_or_handle() is the equivalent of Option.unwrap_or_else().
In the interests of naming consistency, call it the same thing.

[breaking-change]
2014-05-19 13:36:22 -07:00
Kevin Ballard
24468278fd Rename Result.unwrap_or_handle() to .unwrap_or_else()
Result.unwrap_or_handle() is the equivalent of Option.unwrap_or_else().
In the interests of naming consistency, call it the same thing.

[breaking-change]
2014-05-19 13:11:49 -07:00
bors
44fcf46b00 auto merge of #14292 : limeburst/rust/master, r=alexcrichton 2014-05-19 11:56:32 -07:00
Alex Crichton
6efd16629c rustc: Add official support for weak failure
This commit is part of the ongoing libstd facade efforts (cc #13851). The
compiler now recognizes some language items as "extern { fn foo(...); }" and
will automatically perform the following actions:

1. The foreign function has a pre-defined name.
2. The crate and downstream crates can only be built as rlibs until a crate
   defines the lang item itself.
3. The actual lang item has a pre-defined name.

This is essentially nicer compiler support for the hokey
core-depends-on-std-failure scheme today, but it is implemented the same way.
The details are a little more hidden under the covers.

In addition to failure, this commit promotes the eh_personality and
rust_stack_exhausted functions to official lang items. The compiler can generate
calls to these functions, causing linkage errors if they are left undefined. The
checking for these items is not as precise as it could be. Crates compiling with
`-Z no-landing-pads` will not need the eh_personality lang item, and crates
compiling with no split stacks won't need the stack exhausted lang item. For
ease, however, these items are checked for presence in all final outputs of the
compiler.

It is quite easy to define dummy versions of the functions necessary:

    #[lang = "stack_exhausted"]
    extern fn stack_exhausted() { /* ... */ }

    #[lang = "eh_personality"]
    extern fn eh_personality() { /* ... */ }

cc #11922, rust_stack_exhausted is now a lang item
cc #13851, libcollections is blocked on eh_personality becoming weak
2014-05-19 11:04:44 -07:00
bors
e8c579e01d auto merge of #14291 : Sawyer47/rust/doc-fixes, r=alexcrichton 2014-05-19 10:16:31 -07:00
Jihyeok Seo
564b925036 Fix typo in libcore 2014-05-20 00:51:16 +09:00
bors
42be687fa1 auto merge of #14279 : aochagavia/rust/pr2, r=huonw
The breaking changes are:

* Changed `DList::insert_ordered` to use `TotalOrd`, not `Ord`
* Changed `PriorityQueue` to use `TotalOrd`, not `Ord`
* Deprecated `PriorityQueue::maybe_top()` (renamed to replace `PriorityQueue::top()`)
* Deprecated `PriorityQueue::maybe_pop()` (renamed to replace `PriorityQueue::pop()`)
* Deprecated `PriorityQueue::to_vec()` (renamed to `PriorityQueue::into_vec()`)
* Deprecated `PriorityQueue::to_sorted_vec()` (renamed to `PriorityQueue::into_sorted_vec()`)
* Changed `PriorityQueue::replace(...)` to return an `Option<T>` instead of failing when the queue is empty.


[breaking-change]
2014-05-19 07:51:31 -07:00
Piotr Jawniak
cea63ecfb1 Minor doc fixes in various places 2014-05-19 15:41:06 +02:00
bors
ed156772bd auto merge of #14251 : alexcrichton/rust/hierarchy, r=huonw
This is an implementation of RFC 16. A module can now only be loaded if the
module declaring `mod name;` "owns" the current directory. A module is
considered as owning its directory if it meets one of the following criteria:

* It is the top-level crate file
* It is a `mod.rs` file
* It was loaded via `#[path]`
* It was loaded via `include!`
* The module was declared via an inline `mod foo { ... }` statement

For example, this directory structure is now invalid

    // lib.rs
    mod foo;

    // foo.rs
    mod bar;

    // bar.rs;
    fn bar() {}

With this change `foo.rs` must be renamed to `foo/mod.rs`, and `bar.rs` must be
renamed to `foo/bar.rs`. This makes it clear that `bar` is a submodule of `foo`,
and can only be accessed through `foo`.

RFC: 0016-module-file-system-hierarchy
Closes #14180

[breaking-change]
2014-05-19 06:11:33 -07:00
bors
5d2edddc30 auto merge of #14288 : zwarich/rust/euv-underscore, r=alexcrichton 2014-05-18 23:01:27 -07:00
Cameron Zwarich
33335cbd03 Remove leading underscores in function signatures in a trait definition. 2014-05-18 22:53:01 -07:00
bors
4b81b6d5f4 auto merge of #14276 : aochagavia/rust/pr, r=alexcrichton 2014-05-18 19:51:26 -07:00
bors
50b26df59e auto merge of #14122 : dagitses/rust/master, r=alexcrichton
This is my first patch and hopefully nothing controversial: just a straightforward forwarding of TreeMap::move_iter() as TreeSet::move_iter().
2014-05-18 18:11:27 -07:00
Adolfo Ochagavía
3a1b7d47f3 Fix insert_ordered in DList 2014-05-18 16:34:01 -07:00
Adolfo Ochagavía
75d3690df9 Fix dead code warnings 2014-05-18 16:33:30 -07:00
bors
86b34bca0f auto merge of #14263 : cmr/rust/termex, r=kballard 2014-05-18 16:31:31 -07:00
Adolfo Ochagavía
29806052ce Refactored and renamed functions to avoid failure 2014-05-18 15:54:19 -07:00
Adolfo Ochagavía
2b06105c2a Rename to_vec and to_sorted_vec 2014-05-18 15:28:29 -07:00
bors
e1403e1d83 auto merge of #14000 : pnkfelix/rust/fsk-fix-issue13732, r=alexcrichton
Fix #13732.

This is a revised, much less hacky form of PR #13753

The changes here:

 * add instrumentation to aid debugging of linkage errors,
 * fine tune some things in the Makefile where we are telling binaries to use a host-oriented path for finding dynamic libraries, when it should be feeding the binaries a target-oriented path for dynamic libraries.
 * pass along the current stage number to run-make tests, and
 * skip certain tests when running atop stage1.

Fix #13746 as well.
2014-05-18 14:41:35 -07:00
Adolfo Ochagavía
8e9567dad8 Replaced Ord by TotalOrd in priority queue 2014-05-18 14:37:15 -07:00
Felix S. Klock II
8cbda5da93 Refactoring: Introduce distinct host and target rpath var setters.
Two line summary: Distinguish HOST_RPATH and TARGET_RPATH; added
RPATH_LINK_SEARCH; skip tests broken in stage1; general cleanup.

`HOST_RPATH_VAR$(1)_T_$(2)_H_$(3)` and `TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3)`
both match the format of the old `RPATH_VAR$(1)_T_$(2)_H_$(3)` (which
is still being set the same way that it was before, to one of either
HOST/TARGET depending on what stage we are building).  Namely, the format
is <XXX>_RPATH_VAR = "<LD_LIB_PATH_ENVVAR>=<COLON_SEP_PATH_ENTRIES>"

What this commit does:

* Pass both of the (newly introduced) HOST and TARGET rpath setup vars
  to `maketest.py`

* Update `maketest.py` to no longer update the LD_LIBRARY_PATH itself
  Instead, it passes along the HOST and TARGET rpath setup vars in
  environment variables `HOST_RPATH_ENV` and `TARGET_RPATH_ENV`

* Also, pass the current stage number to maketest.py; it in turn
  passes it (via an env var) to run-make tests.

  This allows the run-make tests to selectively change behavior
  (e.g. turn themselves off) to deal with incompatibilities with
  e.g. stage1.

* Cleanup: Distinguish in tools.mk between the command to run (`RUN`)
  and the file to generate to drive that command (`RUN_BINFILE`).  The
  main thing this enables is that `RUN` can now setup the
  `TARGET_RPATH_ENV` without having to dirty up the runner code in
  each of the `run-make` Makefiles.

* Cleanup: Factored out commands to delete dylib/rlib into
  REMOVE_DYLIBS/REMOVE_RLIBS.

  There were places where we were only calling `rm $(call DYLIB,foo)`
  even though we really needed to get rid of the whole glob (at least
  based on alex's findings on #13753 that removing the symlink does not
  suffice).

  Therefore rather than peppering the code with the awkward
  `rm $(TMPDIR)/$(call DYLIB_GLOB,foo)`, I instead introduced a common
  `REMOVE_DYLIBS` user function that expands into that when called.
  After I adding an analogous `REMOVE_RLIBS`, I changed all of the
  existing calls that rm dylibs or rlibs to use these routines
  instead.

  Note that the latter is not a true refactoring since I may have
  changed cases where it was our intent to only remove the sym-link.
  (But if that is the case, then we need to more deeply investigate
  alex's findings on #13753 where the system was still dynamically
  loading up the non-symlinked libraries that it finds on the load
  path.)

* Added RPATH_LINK_SEARCH command and use it on Linux.

  On some platforms, namely Linux, when you have libboot.so that has
  its internal rpath set (to e.g. $(ORIGIN)/path/to/HOSTDIR), the
  linker still complains when you do the link step and it does not
  know where to find libraries that libboot.so depends upon that live
  in HOSTDIR (think e.g. librustuv.so).

  As far as I can tell, the GNU linker will consult the
  LD_LIBRARY_PATH as part of the linking process to find such
  libraries.  But if you want to be more careful and not override
  LD_LIBRARY_PATH for the `gcc` invocation, then you need some other
  way to tell the linker where it can find the libraries that
  libboot.so needs.  The solution to this on Linux is the
  `-Wl,-rpath-link` command line option.

  However, this command line option does not exist on Mac OS X, (which
  appears to be figuring out how to resolve the libboot.dylib
  dependency by some other means, perhaps by consulting the rpath
  setting within libboot.dylib).

  So, in order to abstract over this distinction, I added the
  RPATH_LINK_SEARCH macro to the run-make infrastructure and added
  calls to it where necessary to get Linux working.  On architectures
  other than Linux, the macro expands to nothing.

* Disable miscellaneous tests atop stage1.

* An especially interesting instance of the previous bullet point:
  Excuse regex from doing rustdoc tests atop stage1.

  This was a (nearly-) final step to get `make check-stage1` working
  again.

  The use of a special-case check for regex here is ugly but is
  analogous other similar checks for regex such as the one that landed
  in PR #13844.

  The way this is written, the user will get a reminder that
  doc-crate-regex is being skipped whenever their rules attempt to do
  the crate documentation tests.  This is deliberate: I want people
  running `make check-stage1` to be reminded about which cases are
  being skipped.  (But if such echo noise is considered offensive, it
  can obviously be removed.)

* Got windows working with the above changes.

  This portion of the commit is a cleanup revision of the (previously
  mentioned on try builds) re-architecting of how the LD_LIBRARY_PATH
  setup and extension is handled in order to accommodate Windows' (1.)
  use of `$PATH` for that purpose and (2.) use of spaces in `$PATH`
  entries (problematic for make and for interoperation with tools at
  the shell).

* In addition, since the code has been rearchitected to pass the
  HOST_RPATH_DIR/TARGET_RPATH_DIR rather than a whole sh
  environment-variable setting command, there is no need to for the
  convert_path_spec calls in maketest.py, which in fact were put in
  place to placate Windows but were now causing the Windows builds to
  fail.  Instead we just convert the paths to absolute paths just like
  all of the other path arguments.

Also, note for makefile hackers: apparently you cannot quote operands
to `ifeq` in Makefile (or at least, you need to be careful about
adding them, e.g. to only one side).
2014-05-18 22:56:26 +02:00
Felix S. Klock II
a8646be1a8 Output debug info on how #[phase] extern crate foo; gets resolved. 2014-05-18 22:56:26 +02:00
Felix S. Klock II
acfc99dddd Include file paths when dumping the list of resolved crates via debug!. 2014-05-18 22:56:26 +02:00
Felix S. Klock II
eb6856c307 Fixing rustdoc stage1.
See #13983 and #14000.

Fix was originally authored by alexcrichton and then rebased a couple
times by pnkfelix, most recently atop PR 13954.

----

Regarding the change to librustdoc/lib.rs, to do `map_err` before
unwrapping a `TqskResult`: I do not understand how master is passing
without this change or something like it, since `Box<Any:Send>` does
not implement `Show`.  (Is this something that is only a problem for
the snapshot stage0 compiler?)  Still, the change I have put in here
(which was added as part of a rebase after alex's review) seems
harmless to me to apply to rustdoc at all stages, since a call to
`unwrap` is just going to `fail!` on the err case anyway.
2014-05-18 22:56:19 +02:00
bors
ea87f126bd auto merge of #14275 : kballard/rust/bytes-return-static, r=huonw
Change `bytes!()` to return

    {
        static BYTES: &'static [u8] = &[...];
        BYTES
    }

This gives it the `'static` lifetime, whereas before it had an rvalue
lifetime. Until recently this would have prevented assigning `bytes!()`
to a static, as in

    static FOO: &'static [u8] = bytes!(1,2,3);

but #14183 fixed it so blocks are now allowed in constant expressions
(with restrictions).

Fixes #11641.
2014-05-18 13:06:30 -07:00
Kevin Ballard
bcabcf53cf Make bytes!() return 'static
Change `bytes!()` to return

    {
        static BYTES: &'static [u8] = &[...];
        BYTES
    }

This gives it the `'static` lifetime, whereas before it had an rvalue
lifetime. Until recently this would have prevented assigning `bytes!()`
to a static, as in

    static FOO: &'static [u8] = bytes!(1,2,3);

but #14183 fixed it so blocks are now allowed in constant expressions
(with restrictions).

Fixes #11641.
2014-05-18 13:03:38 -07:00
Adolfo Ochagavía
9a8ef9197b Removed unnecessary transmute 2014-05-18 11:48:46 -07:00
bors
63287eef27 auto merge of #14274 : youknowone/rust/advice-tilt-to-box, r=thestinger 2014-05-18 05:36:27 -07:00
bors
2b4cdea7f1 auto merge of #14258 : alexcrichton/rust/dox-format-writer, r=cmr
This commit fills in the documentation holes for the FormatWriter trait which
were previously accidentally left blank. Additionally, this adds the `write_fmt`
method to the trait to allow usage of the `write!` macro with implementors of
the `FormatWriter` trait. This is not useful for consumers of the standard
library who should generally avoid the `FormatWriter` trait, but it is useful
for consumers of the core library who are not using the standard library.
2014-05-18 02:51:30 -07:00
bors
bf8648dbda auto merge of #14121 : luqmana/rust/option-ffi, r=alexcrichton
This slightly adjusts the NullablePointer representation for some enums in the case where the non-nullable variant has a single field (the ptr field) to be just that, the pointer. This is in contrast to the current behaviour where we'd wrap that single pointer in a LLVM struct.

Fixes #11040 & #11303.
2014-05-18 01:16:27 -07:00
Luqman Aden
be79edba71 Update debuginfo tests. 2014-05-18 03:04:50 -04:00
bors
a62395f01c auto merge of #14249 : alexcrichton/rust/issue-14246, r=huonw
Closes #14246
2014-05-17 23:41:28 -07:00
Jeong YunWon
2ee0ca5132 Advice to use Box<T> not ~T 2014-05-18 15:30:41 +09:00