Commit Graph

27907 Commits

Author SHA1 Message Date
Alex Crichton
e6072fa0c4 rustc: Deterministically link upstream C libraries
Previously, upstream C libraries were linked in a nondeterministic fashion
because they were collected through iter_crate_data() which is a nodeterministic
traversal of a hash map. When upstream rlibs had interdependencies among their
native libraries (such as libfoo depending on libc), then the ordering would
occasionally be wrong, causing linkage to fail.

This uses the topologically sorted list of libraries to collect native
libraries, so if a native library depends on libc it just needs to make sure
that the rust crate depends on liblibc.
2014-04-11 12:20:33 -07:00
bors
8b6091e8f1 auto merge of #13236 : liigo/rust/rename-benchharness, r=huonw
Closes #12640

based on PR #13030, rebased, and passed all tests.
2014-04-11 10:01:43 -07:00
bors
65abf96fb6 auto merge of #13424 : eddyb/rust/ty-mut-in-store, r=nikomatsakis
Cleans up some remnants of the old mutability system and only allows vector/trait mutability in `VstoreSlice` (`&mut [T]`) and `RegionTraitStore` (`&mut Trait`).
2014-04-11 05:01:38 -07:00
Liigo Zhuang
408f484b66 libtest: rename BenchHarness to Bencher
Closes #12640
2014-04-11 17:31:13 +08:00
bors
1b37afe8a2 auto merge of #13457 : alexcrichton/rust/issue-13420, r=thestinger
On some OSes (such as freebsd), pthread_attr_init allocates memory, so this is
necessary to deallocate that memory.

Closes #13420
2014-04-11 02:21:36 -07:00
bors
9af93ad54d auto merge of #13453 : brson/rust/snappies, r=alexcrichton
This is the first snap based on mingw-w64.
2014-04-11 00:36:37 -07:00
Eduard Burtescu
ee4c770f8b rustc: fix the fallout from moving mutability into VstoreSlice and RegionTraitStore. 2014-04-11 09:01:31 +03:00
bors
9ff08119e3 auto merge of #13451 : cmr/rust/doc-ffi, r=brson
Closes #8748
2014-04-10 22:51:40 -07:00
Alex Crichton
11c9871bcc std: Be sure to call pthread_attr_destroy
On some OSes (such as freebsd), pthread_attr_init allocates memory, so this is
necessary to deallocate that memory.

Closes #13420
2014-04-10 22:38:05 -07:00
bors
cea8def620 auto merge of #13440 : huonw/rust/strbuf, r=alexcrichton
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and port all code over to use it.

Rebased & tests-fixed version of https://github.com/mozilla/rust/pull/13269
2014-04-10 21:01:41 -07:00
Brian Anderson
7ba8cb530a Register snapshots.
This is the first snap based on mingw-w64.
2014-04-10 19:53:10 -07:00
Huon Wilson
def90f43e2 Fix tests. Add Vec<u8> conversion to StrBuf. 2014-04-11 10:55:30 +10:00
Corey Richardson
eabf78c7b9 Document the nullable pointer optimization in the FFI guide
Closes #8748
2014-04-10 20:29:09 -04:00
bors
0156af156d auto merge of #13443 : alexcrichton/rust/rollup, r=alexcrichton
Closes #13441 (debuginfo: Fixes and improvements for #12840, #12886, and #13213)
Closes #13433 (Remove references to @Trait from a compiler error message)
Closes #13430 (Fix outdated lint warning about inner attribute)
Closes #13425 (Remove a pile of (mainly) internal `~[]` uses)
Closes #13419 (Stop using transmute_mut in RefCell)
Closes #13417 (Remove an unnecessary file `src/libnative/io/p`.)
Closes #13409 (Closing assorted resolve bugs)
Closes #13406 (Generalized the pretty-print entry points to support `-o <file>`.)
Closes #13403 (test: Add a test for #7663)
Closes #13402 (rustdoc: Prune the paths that do not appear in the index.)
Closes #13396 (rustc: Remove absolute rpaths)
Closes #13371 (Rename ast::Purity and ast::Impure Function. Closes #7287)
Closes #13350 (collections: replace all ~[T] with Vec<T>.)
2014-04-10 15:31:55 -07:00
Alex Crichton
1f2c18a0af rustc: Don't allow priv use to shadow pub use
Previously, a private use statement would shadow a public use statement, all of
a sudden publicly exporting the privately used item. The correct behavior here
is to only shadow the use for the module in question, but for now it just
reverts the entire name to private so the pub use doesn't have much effect.

The behavior isn't exactly what we want, but this no longer has backwards
compatibility hazards.
2014-04-10 15:22:01 -07:00
Alex Crichton
df533c6e87 rustc: Don't succeed on shadowed nonexistent import
Previously resolve was checking the "import resolution" for whether an import
had succeeded or not, but this was the same structure filled in by a previous
import if a name is shadowed. Instead, this alters resolve to consult the local
resolve state (as opposed to the shared one) to test whether an import succeeded
or not.

Closes #13404
2014-04-10 15:22:00 -07:00
Alex Crichton
83d2c0b8a6 rustc: Disallow importing through use statements
Resolve is currently erroneously allowing imports through private `use`
statements in some circumstances, even across module boundaries. For example,
this code compiles successfully today:

    use std::c_str;
    mod test {
        use c_str::CString;
    }

This should not be allowed because it was explicitly decided that private `use`
statements are purely bringing local names into scope, they are not
participating further in name resolution.

As a consequence of this patch, this code, while valid today, is now invalid:

    mod test {
        use std::c_str;

        unsafe fn foo() {
            ::test::c_str::CString::new(0 as *u8, false);
        }
    }

While plausibly acceptable, I found it to be more consistent if private imports
were only considered candidates to resolve the first component in a path, and no
others.

Closes #12612
2014-04-10 15:22:00 -07:00
Kasey Carrothers
0bf4e900d4 Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and updated associated variable and function names. 2014-04-10 15:22:00 -07:00
Alex Crichton
3f2c55f7d5 rustc: Use realpath() for sysroot/rpath
When calculating the sysroot, it's more accurate to use realpath() rather than
just one readlink() to account for any intermediate symlinks that the rustc
binary resolves itself to.

For rpath, realpath() is necessary because the rpath must dictate a relative
rpath from the destination back to the originally linked library, which works
more robustly if there are no symlinks involved.

Concretely, any binary generated on OSX into $TMPDIR requires an absolute rpath
because the temporary directory is behind a symlink with one layer of
indirection. This symlink causes all relative rpaths to fail to resolve.

cc #11734
cc #11857
2014-04-10 15:22:00 -07:00
Alex Crichton
25a6b6ef8b rustc: Add a realpath utility function
This is required in rustc to resolve symlinks for utilities such as the sysroot
and the rpath values which are encoded into binaries.
2014-04-10 15:22:00 -07:00
Alex Crichton
f9e17e1d33 rustc: Don't rpath to librustrt.dylib
This library no longer exists, there's no reason for this rpath to exist any
more.
2014-04-10 15:22:00 -07:00
Alex Crichton
ec996737fe rustc: Remove absolute rpaths
Concerns have been raised about using absolute rpaths in #11746, and this is the
first step towards not relying on rpaths at all. The only current use case for
an absolute rpath is when a non-installed rust builds an executable that then
moves from is built location. The relative rpath back to libstd and absolute
rpath to the installation directory still remain (CFG_PREFIX).

Closes #11746
Rebasing of #12754
2014-04-10 15:22:00 -07:00
Kang Seonghoon
85299e360c rustdoc: Prune the paths that do not appear in the index.
For the full library and compiler docs, the size of
`search-index.js` decreases by 13% (18.5% after gzip -9)
which is a substantial gain.
2014-04-10 15:21:59 -07:00
Kang Seonghoon
34ece7ad71 rustdoc: Clean the initSearch routine up. 2014-04-10 15:21:59 -07:00
Kang Seonghoon
dd00bf3791 mk: Add a dummy CFG_COMPILER_HOST_TRIPLE to rustdoc invocation.
Otherwise it will prohibit `make compiler-docs` on Windows.
2014-04-10 15:21:59 -07:00
Alex Crichton
6d6d4c987f test: Add a test for #7663
I think that the test case from this issue has become out of date with resolve
changes in the past 9 months, and it's not entirely clear to me what the
original bug was.

Regardless, it seems like tricky resolve behavior, so tests were added to make
sure things resolved correctly and warnings were correctly reported.

Closes #7663
2014-04-10 15:21:59 -07:00
Felix S. Klock II
da25539c1a Generalized the pretty-print entry points to support -o <file>. 2014-04-10 15:21:59 -07:00
OGINO Masanori
a70f8d9cf3 Remove an unnecessary file.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-04-10 15:21:59 -07:00
Steven Fackler
b99482801f Stop using transmute_mut in RefCell
This is supposedly undefined behavior now that Unsafe exists, so we'll
use Cell instead.
2014-04-10 15:21:59 -07:00
Huon Wilson
6e63b12f5f Remove some internal ~[] from several libraries.
Some straggling instances of `~[]` across a few different libs. Also,
remove some public ones from workcache.
2014-04-10 15:21:58 -07:00
Huon Wilson
32cf4a188c native: remove some internal ~[]. 2014-04-10 15:21:58 -07:00
Huon Wilson
8ec16e1e66 green: de-~[]. 2014-04-10 15:21:58 -07:00
Huon Wilson
1403b35be7 std,syntax: make std::fmt::parse use Vecs. 2014-04-10 15:21:58 -07:00
Huon Wilson
301594917f std,native,green,rustuv: make readdir return Vec.
Replacing `~[]`. This also makes the `walk_dir` iterator use a `Vec`
internally.
2014-04-10 15:21:58 -07:00
Huon Wilson
a65411e4f7 std,serialize: remove some internal uses of ~[].
These are all private uses of ~[], so can easily & non-controversially
be replaced with Vec.
2014-04-10 15:21:58 -07:00
Eduard Bopp
342e8b59be Fix outdated lint warning about inner attribute
It suggested adding a semicolon instead of the new syntax using an exclamation
mark.
2014-04-10 15:21:58 -07:00
Kevin Ballard
8135032779 Remove references to @Trait from a compiler error message 2014-04-10 15:21:57 -07:00
Michael Woerister
5099b8c863 debuginfo: Don't create debuginfo for statics inlined from other crates.
Fixes issue #13213, that is linker errors when the inlined static has been optimized out of the exporting crate.
2014-04-10 15:21:57 -07:00
Michael Woerister
c26d25466d debuginfo: Implement discriminator type metadata re-use.
An optimization for sharing the type metadata of generic enum discriminators between monomorphized instances (fixes issue #12840)
2014-04-10 15:21:57 -07:00
Michael Woerister
43e8ace76b debuginfo: Improve source code position assignment for inlined functions.
This commit makes sure that code inlined from other functions isn't assigned the source position of the call site, since this leads to undesired behavior when setting line breakpoints (issue #12886)
2014-04-10 15:21:57 -07:00
bors
5bcb76181a auto merge of #13350 : huonw/rust/devec-collections, r=alexcrichton
collections: replace all ~[T] with Vec<T>.
2014-04-10 13:11:54 -07:00
Eduard Burtescu
a62eba7abf rustc: move mutability from ty_vec and ty_trait to VstoreSlice and RegionTraitStore. 2014-04-10 20:18:46 +03:00
Eduard Burtescu
2803b383f0 rustc: use VstoreFixed's length in crate-independent type hashes. 2014-04-10 20:18:46 +03:00
Eduard Burtescu
b61764b609 rustc: rename ty::vstore and its variants to UpperCamelCase. 2014-04-10 20:18:46 +03:00
bors
e263ef1df7 auto merge of #13437 : kaseyc/rust/remove_unnecessary_struct, r=sanxiyn
Removes the unused Point struct from assert-eq-macro-fail.rs.
2014-04-10 07:21:56 -07:00
bors
6d1c6124f6 auto merge of #13436 : pongad/rust/lazyemit, r=thestinger
Fixes #11926
2014-04-10 05:56:55 -07:00
Patrick Walton
d8e45ea7c0 libstd: Implement StrBuf, a new string buffer type like Vec, and
port all code over to use it.
2014-04-10 22:10:10 +10:00
Kasey Carrothers
27920afa85 Remove the unused Point struct in the assert-eq-macro-fail.rs test. 2014-04-09 21:56:21 -07:00
bors
7fbcb400f0 auto merge of #13413 : alexcrichton/rust/once-fn-move, r=brson
This fixes the categorization of the upvars of procs (represented internally
as once fns) to consider usage to require a loan. In doing so, upvars are no
longer allowed to be moved out of repeatedly in loops and such.

Closes #10398
Closes #12041
Closes #12127
2014-04-09 18:31:58 -07:00
Michael Darakananda
a00be50e00 Emit intrinsic lazily 2014-04-09 19:56:31 -04:00