Commit Graph

3390 Commits

Author SHA1 Message Date
Patrick Walton
82f5a380a4 librustc: De-@mut llargs and lllocals in the function context 2013-12-26 15:54:28 -08:00
Patrick Walton
a5f4a40f24 librustc: De-@mut the inference context 2013-12-26 13:01:30 -08:00
Patrick Walton
ff2d16e119 librustc: De-@mut RegionVarBindings 2013-12-26 13:01:30 -08:00
Patrick Walton
a39ab7445c librustc: De-@mut RegionVarBindings::var_origins 2013-12-26 13:01:29 -08:00
Patrick Walton
1095e63534 librustc: De-@mut RegionVarBindings::values 2013-12-26 13:01:29 -08:00
Patrick Walton
38d5072018 librustc: De-@mut the undo log in RegionVarBindings 2013-12-26 13:01:29 -08:00
Patrick Walton
b84f294c46 librustc: De-@mut glbs and lubs in RegionVarBindings 2013-12-26 13:01:29 -08:00
Patrick Walton
bdfd0b5ae0 librustc: De-@mut RegionVarBindings::bound_count 2013-12-26 13:01:29 -08:00
Patrick Walton
0a0ce8d227 librustc: De-@mut RegionVarBindings::skolemization_count 2013-12-26 13:01:29 -08:00
Patrick Walton
9f4cfe2e78 librustc: De-@mut RegionVarBindings::constraints 2013-12-26 13:01:29 -08:00
Patrick Walton
3840d50516 librustc: De-@mut the variable bindings in the inference context 2013-12-26 13:01:29 -08:00
Patrick Walton
984b567f9e librustc: De-@mut the variable counters in the inference context 2013-12-26 13:01:29 -08:00
Patrick Walton
7ffba5c3e1 librustc: De-@mut llupvars in the translation crate context 2013-12-26 13:01:29 -08:00
Patrick Walton
de3d581198 librustc: De-@mut the typechecking crate context 2013-12-26 13:01:29 -08:00
Patrick Walton
4fe1cb1aff librustc: De-@mut the vtable map 2013-12-26 13:01:28 -08:00
Patrick Walton
dd745b388d librustc: De-@mut the capture map 2013-12-26 13:01:28 -08:00
Patrick Walton
72f9cbe8ac librustc: De-@mut the borrow check's root map 2013-12-26 13:01:28 -08:00
Patrick Walton
c4661fd258 librustc: De-@mut node_types in the type context 2013-12-26 13:01:28 -08:00
Patrick Walton
727fa3aa01 librustc: De-@mut impl_vtables in the type context 2013-12-26 13:01:28 -08:00
Patrick Walton
ea5368ce6e librustc: De-@mut ty::ctxt_::rcache 2013-12-26 13:01:28 -08:00
Patrick Walton
2c3f92699e librustc: De-@mut the type cache in the type context 2013-12-26 13:01:28 -08:00
Patrick Walton
b976226d52 librustc: De-@mut extern_const_variants in the type context 2013-12-26 13:01:28 -08:00
Patrick Walton
a5db84ce12 librustc: De-@mut the extern_const_statics table in the type context 2013-12-26 13:01:28 -08:00
Patrick Walton
55a7b2fedd librustc: De-@mut the impls table in the type context 2013-12-26 13:01:28 -08:00
Patrick Walton
42f7f7f437 librustc: De-@mut inherent_impls in the type context 2013-12-26 13:01:28 -08:00
Patrick Walton
c554d23a9a librustc: De-@mut trait_impls in the type context 2013-12-26 13:01:27 -08:00
Patrick Walton
a66fcca9c9 librustc: De-@mut destructors in the type context 2013-12-26 13:01:27 -08:00
Patrick Walton
daf31d2b4f librustc: De-@mut resolve::Module 2013-12-26 13:01:27 -08:00
Patrick Walton
ec02f9457c librustc: De-@mut resolve::Module::resolved_import_count 2013-12-26 13:01:27 -08:00
Patrick Walton
01d8380b19 librustc: De-@mut resolve::Module::glob_count 2013-12-26 13:01:27 -08:00
Patrick Walton
6db9a8c55c librustc: De-@mut resolve::Module::def_id 2013-12-26 13:01:27 -08:00
Patrick Walton
d503fff28e librustc: De-@mut resolve::Module::populated 2013-12-26 13:01:27 -08:00
Patrick Walton
a1ee3810b8 librustc: De-@mut resolve::Module::kind 2013-12-26 13:01:27 -08:00
Patrick Walton
752283889c librustc: De-@mut destructor_for_type in the type context 2013-12-26 13:01:27 -08:00
Patrick Walton
4dc923fbda librustc: De-@mut the normalized_cache in the type context 2013-12-26 13:01:27 -08:00
Patrick Walton
5b98c66593 librustc: De-@mut the item variance map in the type context 2013-12-26 13:01:27 -08:00
Patrick Walton
7f5e57a5a9 librustc: De-@mut supertraits in the type context 2013-12-26 13:01:26 -08:00
Patrick Walton
84e450347b librustc: De-@mut provided_method_sources in the type context 2013-12-26 13:01:26 -08:00
Patrick Walton
7cf6abc84a librustc: De-@mut the adjustments table in the type context 2013-12-26 13:01:26 -08:00
Patrick Walton
3e9bcea018 librustc: Remove ty_param_defs from the type context 2013-12-26 13:01:26 -08:00
Patrick Walton
d803a0f733 librustc: De-@mut the enum_var_cache 2013-12-26 13:01:26 -08:00
Patrick Walton
ab0d7b2312 librustc: De-@mut the ast_ty_to_ty_cache. 2013-12-26 13:01:26 -08:00
Patrick Walton
b941677ea3 librustc: De-@mut the crate context 2013-12-26 13:01:26 -08:00
Patrick Walton
2418cc0212 librustc: De-@mut the crate context's do_not_commit_warning_issued 2013-12-26 13:01:26 -08:00
Patrick Walton
61768de5e9 librustc: De-&mut TypeNames 2013-12-26 13:01:26 -08:00
Patrick Walton
d2bcd1462f librustc: Remove unused TypeNames::type_names table 2013-12-26 13:01:26 -08:00
Patrick Walton
ddf3c6de74 librustc: Remove unused TypeNames::find_name function 2013-12-26 13:01:26 -08:00
Patrick Walton
303a39477b librustc: De-@mut CrateContext::symbol_hasher. 2013-12-26 13:01:25 -08:00
Patrick Walton
d40974a5fe librustc: De-mut CrateDebugContext 2013-12-26 13:01:25 -08:00
Patrick Walton
e66bcf44b9 librustc: De-@mut CrateDebugContext::current_debug_location 2013-12-26 13:01:25 -08:00
Patrick Walton
f38561dfd6 librustc: De-@mut CrateDebugContext::composite_types_completed 2013-12-26 13:01:25 -08:00
Patrick Walton
3ed45bb595 librustc: De-@mut CrateDebugContext::namespace_map. 2013-12-26 13:01:25 -08:00
Patrick Walton
38be67a1b9 librustc: De-@mut CrateDebugContext::created_types. 2013-12-26 13:01:25 -08:00
Patrick Walton
6ac286b518 librustc: De-@mut CrateDebugContext::created_files 2013-12-26 13:01:25 -08:00
Patrick Walton
fc92f92572 librustc: De-@mut CrateContext::finished_tydescs. 2013-12-26 13:01:25 -08:00
Patrick Walton
462a791c34 librustc: De-@mut the external and external_srcs fields of
`CrateContext`
2013-12-26 13:01:25 -08:00
Patrick Walton
1e654f5ff7 librustc: De-@mut CrateContext::externs 2013-12-26 13:01:25 -08:00
Patrick Walton
519db34722 librustc: De-@mut CrateContext::tydescs 2013-12-26 13:01:24 -08:00
Patrick Walton
b5aa6eb69f librustc: De-@mut CrateContext::non_inlineable_statics 2013-12-26 13:01:24 -08:00
Patrick Walton
02bdda2776 librustc: De-@mut CrateContext::all_llvm_symbols 2013-12-26 13:01:24 -08:00
Patrick Walton
b895ba52bc librustc: Remove unused CrateContext::type_short_names 2013-12-26 13:01:24 -08:00
Patrick Walton
25337a7f9f librustc: De-@mut CrateContext::type_hashcodes 2013-12-26 13:01:24 -08:00
Patrick Walton
a1747a6091 librustc: De-@mut CrateContext::adt_reprs 2013-12-26 13:01:24 -08:00
Patrick Walton
db83a957b6 librustc: De-@mut CrateContext::llsizingtypes 2013-12-26 13:01:24 -08:00
Patrick Walton
06805209e4 librustc: De-@mut lltypes. 2013-12-26 13:01:24 -08:00
Patrick Walton
8c194a0136 librustc: De-@mut CrateContext::module_data 2013-12-26 13:01:24 -08:00
Patrick Walton
1185fcc437 librustc: De-@mut the impl_method_cache 2013-12-26 13:01:24 -08:00
Patrick Walton
37e3f2fe63 librustc: De-@mut CrateContext::extern_const_values 2013-12-26 13:01:24 -08:00
Patrick Walton
d16cca1f50 librustc: De-@mut const_values. 2013-12-26 13:01:23 -08:00
Patrick Walton
28943e96cb librustc: De-@mut RefCell::const_globals. 2013-12-26 13:01:23 -08:00
Patrick Walton
0e2041c54b librustc: De-@mut CrateContext::const_cstr_cache. 2013-12-26 13:01:23 -08:00
Patrick Walton
13f85cb097 librustc: De-@mut CrateContext::vtables. 2013-12-26 13:01:23 -08:00
Patrick Walton
5dcc5165a6 librustc: Remove unused discrim_symbols field from the crate context 2013-12-26 13:01:23 -08:00
Patrick Walton
0f3e4fea4f librustc: Remove unused field enum_sizes from the crate context 2013-12-26 13:01:23 -08:00
Patrick Walton
df7f1374d7 librustc: De-@mut item_symbols 2013-12-26 13:01:23 -08:00
Patrick Walton
610096d8c8 librustc: De-@mut CrateContext::item_vals 2013-12-26 13:01:23 -08:00
Patrick Walton
d3f58c59e4 librustc: De-@mut the monomorphizing field in CrateContext 2013-12-26 13:01:23 -08:00
Patrick Walton
b5218ba6ad librustc: De-@mut monomorphized in the crate context 2013-12-26 13:01:23 -08:00
Patrick Walton
6a0450c67d librustc: De-@mut the tc_cache 2013-12-26 13:01:23 -08:00
Patrick Walton
ba2e6c1e95 librustc: De-@mut the needs_unwind_cleanup_cache 2013-12-26 13:01:23 -08:00
Patrick Walton
2e46ac6449 librustc: De-@mut the short names cache 2013-12-26 13:01:22 -08:00
Patrick Walton
2612d76d22 librustc: De-@mut intrinsic_defs 2013-12-26 13:01:22 -08:00
Patrick Walton
2ead970b21 librustc: De-@mut trait_defs 2013-12-26 13:01:22 -08:00
Patrick Walton
3f444dca5b librustc: De-@mut trait_refs 2013-12-26 13:01:22 -08:00
Patrick Walton
efdbd60a87 librustc: De-@mut the impl_trait_cache 2013-12-26 13:01:22 -08:00
Patrick Walton
02f13adaa3 librustc: De-@mut the trait_methods_cache 2013-12-26 13:01:22 -08:00
Patrick Walton
214d6bc34a librustc: De-@mut the trait_method_def_ids table. 2013-12-26 13:01:22 -08:00
Patrick Walton
f15f9388dc librustc: De-@mut the type context's methods table 2013-12-26 13:01:22 -08:00
Patrick Walton
386300d4b0 librustc: De-@mut the node_type_substs table 2013-12-26 13:01:22 -08:00
Patrick Walton
fffbe7a8cd librustc: De-@mut the type interner 2013-12-26 13:01:22 -08:00
Patrick Walton
09589aae4f librustc: De-@mut FnCtxt. 2013-12-26 13:01:21 -08:00
Patrick Walton
c9432327c4 librustc: Change @mut Block to @Block. 2013-12-26 13:01:21 -08:00
Alex Crichton
ab431a20c0 Register new snapshots 2013-12-26 11:30:23 -08:00
bors
9477c49a7b auto merge of #10965 : alexcrichton/rust/libgreen, r=brson
This pull request extracts all scheduling functionality from libstd, moving it into its own separate crates. The new libnative and libgreen will be the new way in which 1:1 and M:N scheduling is implemented. The standard library still requires an interface to the runtime, however, (think of things like `std::comm` and `io::println`). The interface is now defined by the `Runtime` trait inside of `std::rt`.

The booting process is now that libgreen defines the start lang-item and that's it. I want to extend this soon to have libnative also have a "start lang item" but also allow libgreen and libnative to be linked together in the same process. For now though, only libgreen can be used to start a program (unless you define the start lang item yourself). Again though, I want to change this soon, I just figured that this pull request is large enough as-is.

This certainly wasn't a smooth transition, certain functionality has no equivalent in this new separation, and some functionality is now better enabled through this new system. I did my best to separate all of the commits by topic and keep things fairly bite-sized, although are indeed larger than others.

As a note, this is currently rebased on top of my `std::comm` rewrite (or at least an old copy of it), but none of those commits need reviewing (that will all happen in another pull request).
2013-12-26 01:01:54 -08:00
Alex Crichton
6cad8f4f14 Test fixes and rebase conflicts
* vec::raw::to_ptr is gone
* Pausible => Pausable
* Removing @
* Calling the main task "<main>"
* Removing unused imports
* Removing unused mut
* Bringing some libextra tests up to date
* Allowing compiletest to work at stage0
* Fixing the bootstrap-from-c rmake tests
* assert => rtassert in a few cases
* printing to stderr instead of stdout in fail!()
2013-12-25 23:10:46 -08:00
Steven Fackler
c7cf5dc270 Method-ify CStore 2013-12-25 21:50:36 -07:00
Alex Crichton
1c648fcea4 rustc: Strip struct fields and enum variants
Closes #11085
2013-12-24 23:26:40 -08:00
Alex Crichton
39dbcd7b01 rustc: Temporarily inject libgreen with librustuv
This measure is simply to allow programs to continue compiling as they once did.
In the future, this needs a more robust solution to choose how to start with
libgreen or libnative.
2013-12-24 19:59:53 -08:00
Alex Crichton
a55c57284d std: Introduce std::sync
For now, this moves the following modules to std::sync

* UnsafeArc (also removed unwrap method)
* mpsc_queue
* spsc_queue
* atomics
* mpmc_bounded_queue
* deque

We may want to remove some of the queues, but for now this moves things out of
std::rt into std::sync
2013-12-24 14:42:00 -08:00
bors
32e730f122 auto merge of #11121 : vadimcn/rust/no-c++2, r=alexcrichton
This PR removes Rust's dependency on C++ for exception handling. Instead, it will use the unwind library API directly.

closes #10469
2013-12-24 12:46:32 -08:00
Vadim Chugunov
e3b37154b0 Stop using C++ exceptions for stack unwinding. 2013-12-24 12:13:42 -08:00
Brian Anderson
26f1b4db11 rustc: Add a lint for the obsolete crate-level link attribute 2013-12-23 21:04:01 -08:00
Andreas Neuhaus
66e3fbebd9 Allow optional filename argument for --dep-info 2013-12-22 21:38:55 +01:00
bors
55cbef611a auto merge of #11064 : huonw/rust/vec-sort, r=alexcrichton
This uses quite a bit of unsafe code for speed and failure safety, and allocates `2*n` temporary storage.

[Performance](https://gist.github.com/huonw/5547f2478380288a28c2):

|      n |      new | priority_queue |   quick3 |
|-------:|---------:|---------------:|---------:|
|      5 |      200 |            155 |      106 |
|    100 |     6490 |           8750 |     5810 |
|  10000 |  1300000 |        1790000 |  1060000 |
| 100000 | 16700000 |       23600000 | 12700000 |
| sorted |   520000 |        1380000 | 53900000 |
|  trend |  1310000 |        1690000 |  1100000 |

(The times are in nanoseconds, having subtracted the set-up time (i.e. the `just_generate` bench target).)

I imagine that there is still significant room for improvement, particularly because both priority_queue and quick3 are doing a static call via `Ord` or `TotalOrd` for the comparisons, while this is using a (boxed) closure.

Also, this code does not `clone`, unlike `quick_sort3`; and is stable, unlike both of the others.
2013-12-22 00:41:39 -08:00
Huon Wilson
2e8c522c62 std::vec: make the sorting closure use Ordering rather than just being
(implicitly) less_eq.
2013-12-22 18:16:50 +11:00
bors
cd13f4d599 auto merge of #10997 : cadencemarseille/rust/issue-10755-ICE-for-missing-linker, r=alexcrichton
Trap the io_error condition so that a more informative error message is
displayed when the linker program cannot be started, such as when the
name of the linker binary is accidentally mistyped.

closes #10755
2013-12-21 22:16:37 -08:00
bors
9d1de0b699 auto merge of #11077 : alexcrichton/rust/crate-id, r=cmr
Right now the --crate-id and related flags are all process *after* the entire
crate is parsed. This is less than desirable when used with makefiles because it
means that just to learn the output name of the crate you have to parse the
entire crate (unnecessary).

This commit changes the behavior to lift the handling of these flags much sooner
in the compilation process. This allows us to not have to parse the entire crate
and only have to worry about parsing the crate attributes themselves. The
related methods have all been updated to take an array of attributes rather than
a crate.

Additionally, this ceases duplication of the "what output are we producing"
logic in order to correctly handle things in the case of --test.

Finally, this adds tests for all of this functionality to ensure that it does
not regress.
2013-12-20 15:21:33 -08:00
Huon Wilson
1b1e4caa79 std::vec: add a sugary .sort() method for plain Ord sorting.
This moves the custom sorting to `.sort_by`.
2013-12-21 09:35:18 +11:00
Alex Crichton
87add53327 rustc: Improve crate id extraction
Right now the --crate-id and related flags are all process *after* the entire
crate is parsed. This is less than desirable when used with makefiles because it
means that just to learn the output name of the crate you have to parse the
entire crate (unnecessary).

This commit changes the behavior to lift the handling of these flags much sooner
in the compilation process. This allows us to not have to parse the entire crate
and only have to worry about parsing the crate attributes themselves. The
related methods have all been updated to take an array of attributes rather than
a crate.

Additionally, this ceases duplication of the "what output are we producing"
logic in order to correctly handle things in the case of --test.

Finally, this adds tests for all of this functionality to ensure that it does
not regress.
2013-12-20 09:10:11 -08:00
bors
6023350082 auto merge of #11017 : alexcrichton/rust/faster-read, r=thestinger
We were previously reading metadata via `ar p`, but as learned from rustdoc
awhile back, spawning a process to do something is pretty slow. Turns out LLVM
has an Archive class to read archives, but it cannot write archives.

This commits adds bindings to the read-only version of the LLVM archive class
(with a new type that only has a read() method), and then it uses this class
when reading the metadata out of rlibs. When you put this in tandem of not
compressing the metadata, reading the metadata is 4x faster than it used to be
The timings I got for reading metadata from the respective libraries was:

    libstd-04ff901e-0.9-pre.dylib    => 100ms
    libstd-04ff901e-0.9-pre.rlib     => 23ms
    librustuv-7945354c-0.9-pre.dylib => 4ms
    librustuv-7945354c-0.9-pre.rlib  => 1ms
    librustc-5b94a16f-0.9-pre.dylib  => 87ms
    librustc-5b94a16f-0.9-pre.rlib   => 35ms
    libextra-a6ebb16f-0.9-pre.dylib  => 63ms
    libextra-a6ebb16f-0.9-pre.rlib   => 15ms
    libsyntax-2e4c0458-0.9-pre.dylib => 86ms
    libsyntax-2e4c0458-0.9-pre.rlib  => 22ms

In order to always take advantage of these faster metadata read-times, I sort
the files in filesearch based on whether they have an rlib extension or not
(prefer all rlib files first).

Overall, this halved the compile time for a `fn main() {}` crate from 0.185s to
0.095s on my system (when preferring dynamic linking). Reading metadata is still
the slowest pass of the compiler at 0.035s, but it's getting pretty close to
linking at 0.021s! The next best optimization is to just not copy the metadata
from LLVM because that's the most expensive part of reading metadata right now.
2013-12-20 02:06:34 -08:00
Alex Crichton
64faafba19 rustc: Optimize reading metadata by 4x
We were previously reading metadata via `ar p`, but as learned from rustdoc
awhile back, spawning a process to do something is pretty slow. Turns out LLVM
has an Archive class to read archives, but it cannot write archives.

This commits adds bindings to the read-only version of the LLVM archive class
(with a new type that only has a read() method), and then it uses this class
when reading the metadata out of rlibs. When you put this in tandem of not
compressing the metadata, reading the metadata is 4x faster than it used to be
The timings I got for reading metadata from the respective libraries was:

    libstd-04ff901e-0.9-pre.dylib    => 100ms
    libstd-04ff901e-0.9-pre.rlib     => 23ms
    librustuv-7945354c-0.9-pre.dylib => 4ms
    librustuv-7945354c-0.9-pre.rlib  => 1ms
    librustc-5b94a16f-0.9-pre.dylib  => 87ms
    librustc-5b94a16f-0.9-pre.rlib   => 35ms
    libextra-a6ebb16f-0.9-pre.dylib  => 63ms
    libextra-a6ebb16f-0.9-pre.rlib   => 15ms
    libsyntax-2e4c0458-0.9-pre.dylib => 86ms
    libsyntax-2e4c0458-0.9-pre.rlib  => 22ms

In order to always take advantage of these faster metadata read-times, I sort
the files in filesearch based on whether they have an rlib extension or not
(prefer all rlib files first).

Overall, this halved the compile time for a `fn main() {}` crate from 0.185s to
0.095s on my system (when preferring dynamic linking). Reading metadata is still
the slowest pass of the compiler at 0.035s, but it's getting pretty close to
linking at 0.021s! The next best optimization is to just not copy the metadata
from LLVM because that's the most expensive part of reading metadata right now.
2013-12-19 23:34:32 -08:00
bors
bb02d147fe auto merge of #11073 : klutzy/rust/issue-10978, r=alexcrichton
This patchset fixes small glitches which caused #10978.
2013-12-19 20:06:36 -08:00
Huon Wilson
48fedcb36f extra: remove sort in favour of the std method.
Fixes #9676.
2013-12-20 12:38:46 +11:00
bors
5c24bfa8c3 auto merge of #11057 : alexcrichton/rust/no-at-in-ebml, r=pcwalton
Now that the metadata is an owned value with a lifetime of a borrowed byte
slice, it's possible to have future optimizations where the metadata doesn't
need to be copied around (very expensive operation).
2013-12-19 17:11:40 -08:00
Alex Crichton
73fceca7d6 Purge @-boxes from the reading half of EBML
Now that the metadata is an owned value with a lifetime of a borrowed byte
slice, it's possible to have future optimizations where the metadata doesn't
need to be copied around (very expensive operation).
2013-12-19 17:08:05 -08:00
Patrick Walton
b982f08a66 librustc: Add missing case for the Pod bound in tydecode. 2013-12-19 14:13:19 -08:00
bors
bc17e4fda7 auto merge of #11070 : ezyang/rust/better-errors, r=alexcrichton
On the advice of @huonw, I've just replaced item_span outright.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-19 09:51:40 -08:00
klutzy
2afa97a346 rustc: Handle #[link(name = "")] error 2013-12-20 01:53:41 +09:00
bors
d760f994de auto merge of #11041 : cmr/rust/pkgid_changes, r=cmr,metajack 2013-12-19 07:51:36 -08:00
Corey Richardson
b25a0524dc Add some things to inspect crate-id's 2013-12-19 10:18:37 -05:00
Corey Richardson
dee1107571 Rename pkgid to crate_id
Closes #11035
2013-12-19 10:10:23 -05:00
Edward Z. Yang
6ad1c8e044 Generalize item_span into node_span, which works on more types.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-19 19:58:08 +08:00
bors
3c2c13bae4 auto merge of #11029 : huonw/rust/rm-vec-as-buf, r=cmr
For `str.as_mut_buf`, un-closure-ification is achieved by outright removal (see commit message). The others are replaced by `.as_ptr`, `.as_mut_ptr` and `.len`
2013-12-18 17:11:42 -08:00
Cadence Marseille
f24787dbfb Fix #10755 - ICE: --linker=
Trap the io_error condition so that a more informative error message is
displayed when the linker program cannot be started, such as when the
name of the linker binary is accidentally mistyped.

closes #10755
2013-12-18 18:33:33 -05:00
Huon Wilson
17ac2aa523 std::str: replace .as_imm_buf with .as_ptr. 2013-12-19 10:18:02 +11:00
Huon Wilson
4c79b22ef2 std::vec: remove .as_imm_buf, replaced by .as_ptr & .len.
There's no need for the restrictions of a closure with the above methods.
2013-12-19 09:26:13 +11:00
bors
5ece092773 auto merge of #11033 : michaelwoerister/rust/byvalself, r=pcwalton
As the title says. The trans changes will lead to an auxiliary alloca being created that allows debug info to track the `self` argument. This alloca is only created in debug builds however. Otherwise very little had to be done after I managed to navigate to some degree the jungle that is self-argument handling `:P` 

Closes #10549
2013-12-18 08:36:36 -08:00
bors
c33573440b auto merge of #11024 : huonw/rust/return-from-closures, r=alexcrichton
With the old `for` gone, this behaviour is no longer conflicting with
that use of `return` in closures, and this allows shortcircuiting in a
closure.
2013-12-18 06:26:33 -08:00
bors
5cea7db2a5 auto merge of #10915 : alexcrichton/rust/fixes, r=ILyoan
Just a little cleanup.
2013-12-18 05:01:47 -08:00
Huon Wilson
6876916a45 rustc: Allow return to return from a closure.
With the old `for` gone, this behaviour is no longer conflicting with
that use of `return` in closures, and this allows shortcircuiting in a
closure.
2013-12-18 22:53:45 +11:00
bors
f43402fd66 auto merge of #11025 : ezyang/rust/reword-second-borrow, r=cmr
When a borrow occurs twice illegally, Rust will label the other borrow
as the "second borrow".  This is quite confusing, as the "second borrow"
usually happened before the flagged barrow (e.g. as far as dataflow
is concerned, the first borrow is OK, the second borrow is illegal.)
This patch renames "second borrow" to "previous borrow", to make the
spatial relationship between the two borrows clearer.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-18 03:36:33 -08:00
bors
09b8406638 auto merge of #11019 : alexcrichton/rust/issue-10545, r=pcwalton
This code in resolve accidentally forced all types with an impl to become
public. This fixes it by default inheriting the privacy of what was previously
there and then becoming `true` if nothing else exits.

Closes #10545
2013-12-17 21:31:47 -08:00
bors
ac137f6dbe auto merge of #11009 : ktt3ja/rust/issue-11006, r=alexcrichton
Fix #11006.
2013-12-17 15:51:35 -08:00
bors
3272b002b3 auto merge of #10979 : alexcrichton/rust/less-bc, r=cmr
By performing this logic very late in the build process, it ended up leading to
bugs like those found in #10973 where certain stages of the build process
expected a particular output format which didn't end up being the case. In order
to fix this, the build output generation is moved very early in the build
process to the absolute first thing in phase 2.

Closes #10973
2013-12-17 11:36:42 -08:00
Alex Crichton
eabf11b9cb Don't allow impls to force public types
This code in resolve accidentally forced all types with an impl to become
public. This fixes it by default inheriting the privacy of what was previously
there and then becoming `true` if nothing else exits.

Closes #10545
2013-12-17 09:38:57 -08:00
Michael Woerister
0f98cb4198 debuginfo: Properly support by-value self arguments 2013-12-17 18:08:42 +01:00
bors
1a26bd166a auto merge of #11005 : sanxiyn/rust/mut, r=alexcrichton
There is no `~mut T` and `[mut T]` any more.
2013-12-17 06:26:40 -08:00
Edward Z. Yang
4584acdf4c s/Second borrow/Previous borrow/ in error messages.
When a borrow occurs twice illegally, Rust will label the other borrow
as the "second borrow".  This is quite confusing, as the "second borrow"
usually happened before the flagged borrow (e.g. as far as dataflow
is concerned, the first borrow is OK, the second borrow is illegal.)
This patch renames "second borrow" to "previous borrow", to make the
spatial relationship between the two borrows clearer.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2013-12-17 21:10:57 +08:00
bors
dc65762d79 auto merge of #10990 : ktt3ja/rust/method-stability, r=huonw
If it's a trait method, this checks the stability attribute of the
method inside the trait definition. Otherwise, it checks the method
implementation itself.

Close #8961.
2013-12-17 02:31:55 -08:00
bors
47c9a35747 auto merge of #10830 : alexcrichton/rust/spsc-queue, r=brson
This pull request completely rewrites std::comm and all associated users. Some major bullet points

* Everything now works natively
* oneshots have been removed
* shared ports have been removed
* try_recv no longer blocks (recv_opt blocks)
* constructors are now Chan::new and SharedChan::new
* failure is propagated on send
* stream channels are 3x faster

I have acquired the following measurements on this patch. I compared against Go, but remember that Go's channels are fundamentally different than ours in that sends are by-default blocking. This means that it's not really a totally fair comparison, but it's good to see ballpark numbers for anyway

```
          oneshot         stream          shared1
std         2.111           3.073          1.730 
my          6.639           1.037          1.238 
native      5.748           1.017          1.250 
go8         1.774           3.575          2.948 
go8-inf     slow            0.837          1.376 
go8-128     4.832           1.430          1.504 
go1         1.528           1.439          1.251 
go2         1.753           3.845          3.166 
```

I had three benchmarks:

* oneshot - N times, create a "oneshot channel", send on it, then receive on it (no task spawning)
* stream - N times, send from one task to another task, wait for both to complete
* shared1 - create N threads, each of which sends M times, and a port receives N*M times.

The rows are as follows:

* `std` - the current libstd implementation (before this pull request)
* `my` - this pull request's implementation (in M:N mode)
* `native` - this pull request's implementation (in 1:1 mode)
* `goN` - go's implementation with GOMAXPROCS=N. The only relevant value is 8 (I had 8 cores on this machine)
* `goN-X` - go's implementation where the channels in question were created with buffers of size `X` to behave more similarly to rust's channels.
2013-12-17 01:16:43 -08:00
Patrick Walton
caf34b41c3 librustc: Implement a Pod kind for types that can be memcpy'd.
This will be used for the new `Cell`.
2013-12-16 22:38:02 -08:00
Alex Crichton
529e268ab9 Fallout of rewriting std::comm 2013-12-16 17:47:11 -08:00
Kiet Tran
05a41dc75f Check even more live Path nodes in dead-code pass 2013-12-16 18:01:36 -05:00
Kiet Tran
4f95dceb59 Detect stability attributes on methods.
If it's a trait method, this checks the stability attribute of the
method inside the trait definition. Otherwise, it checks the method
implementation itself.
2013-12-16 16:25:45 -05:00
Seo Sanghyeon
4a13364010 Remove obsolete mutability from ast::Ty 2013-12-17 03:01:40 +09:00
bors
4e77c1148f auto merge of #10966 : michaelwoerister/rust/prelude2, r=cmr
This PR improves the stepping experience in GDB. It contains some fine tuning of line information and makes *rustc* produce nearly the same IR/DWARF as Clang. The focus of the changes is function prologue handling which has caused some problems in the past (https://github.com/mozilla/rust/issues/9641).

It seems that GDB does not properly handle function prologues when the function uses segmented stacks, i.e. it does not recognize that the `__morestack` check is part of the prologue. When setting a breakpoint like `break foo` it will set the break point before the arguments of `foo()` have been loaded and still contain bogus values. For function with the #[no_split_stack] attribute this problem has never occurred for me so I'm pretty sure that segmented stacks are the cause of the problem. @jdm mentioned that segmented stack won't be completely abandoned after all. I'd be grateful if you could tell me about what the future might bring in this regard (@brson, @cmr).

Anyway, this PR should alleviate this problem at least in the case when setting breakpoints using line numbers and also make it less confusing when setting them via function names because then GDB will break *before* the first statement where one could conceivably argue that arguments need not be initialized yet.

Also, a koala: 🐨

Cheers,
Michael
2013-12-16 05:51:32 -08:00
Michael Woerister
9384de77bb debuginfo: Add comment on is_local_to_unit parameter. 2013-12-16 10:23:28 +01:00
Michael Woerister
d35fff8994 debuginfo: Added some documentation of source location management. 2013-12-16 10:23:28 +01:00
Michael Woerister
89b47d5557 debuginfo: Add test cases for function prologue handling. 2013-12-16 10:23:28 +01:00
Michael Woerister
91efb2a67f debuginfo: Set correct source position for function calls. 2013-12-16 10:23:28 +01:00
Michael Woerister
b0100c5a0f debuginfo: Set the is_local_to_unit attribute of functions correctly 2013-12-16 10:23:28 +01:00
Michael Woerister
69f4bf79b2 debuginfo: Use same behavior as Clang for calculating scope_line parameter when creating function DIEs. 2013-12-16 10:23:28 +01:00
Michael Woerister
45e472aa4b debuginfo: Get rid of redundant argument copying with debuginfo activated 2013-12-16 10:23:28 +01:00
Michael Woerister
7eae649a01 debuginfo: Create separate lexical block for function bodies. 2013-12-16 10:23:28 +01:00
Michael Woerister
184d39414d debuginfo: Clear source positions where they'd confuse LLVM otherwise. 2013-12-16 10:23:28 +01:00
Michael Woerister
08bc072141 debuginfo: Clear debug source locations at beginning of functions. 2013-12-16 10:23:28 +01:00
Michael Woerister
ae66285732 debuginfo: Always set column information to zero for source locations. 2013-12-16 10:23:27 +01:00
bors
e7b0e0adbb auto merge of #10994 : ktt3ja/rust/issue-10956, r=alexcrichton
Types used inside live struct or enum are now marked live.

Fix #10956 and #10993.
2013-12-16 01:16:29 -08:00
Alex Crichton
c11f290199 Remove workarounds from issue #4404
Closes #10875
2013-12-16 00:28:19 -08:00
Kiet Tran
fb4a1d88f5 Mark live codes in struct/enum for dead-code pass 2013-12-16 02:15:00 -05:00
Alex Crichton
6ebacf2fd7 Move logic for test output generation forward
By performing this logic very late in the build process, it ended up leading to
bugs like those found in #10973 where certain stages of the build process
expected a particular output format which didn't end up being the case. In order
to fix this, the build output generation is moved very early in the build
process to the absolute first thing in phase 2.

Closes #10973
2013-12-15 22:36:44 -08:00
Alex Crichton
d9ea475feb Register new snapshots
Understand 'pkgid' in stage0. As a bonus, the snapshot now contains now metadata
(now that those changes have landed), and the snapshot download is half as large
as it used to be!
2013-12-15 22:17:59 -08:00
Patrick Walton
a87786e3e9 librustc: Remove identifiers named box, since it's about to become a keyword. 2013-12-15 10:41:15 -08:00
bors
8d52dfbace auto merge of #10984 : huonw/rust/clean-raw, r=cmr
See commits for details.
2013-12-15 06:56:27 -08:00
Huon Wilson
164f7a290e std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut []. 2013-12-15 23:37:41 +11:00
Huon Wilson
f97040a93b std::vec: remove unnecessary count parameter on {bytes,
raw}::copy_memory.

Slices carry their length with them, so we can just use that
information.
2013-12-15 22:23:11 +11:00
bors
7f5787ac26 auto merge of #10932 : alexcrichton/rust/feature-update, r=cmr 2013-12-14 23:02:15 -08:00
Alex Crichton
6747d0738a Handle more cases in the heap lints 2013-12-14 22:56:33 -08:00
bors
aafed3ece5 auto merge of #10936 : cadencemarseille/rust/issue-10754-std-run-unwrap-on-None, r=alexcrichton
The problem was that std::run::Process::new() was unwrap()ing the result
of std::io::process::Process::new(), which returns None in the case
where the io_error condition is raised to signal failure to start the
process.

Have std::run::Process::new() similarly return an Option\<run::Process\>
to reflect the fact that a subprocess might have failed to start. Update
utility functions run::process_status() and run::process_output() to
return Option\<ProcessExit\> and Option\<ProcessOutput\>, respectively.

Various parts of librustc and librustpkg needed to be updated to reflect
these API changes.

closes #10754
2013-12-14 12:56:22 -08:00
bors
3d3a663d25 auto merge of #10870 : ktt3ja/rust/issue-10865, r=alexcrichton
Fix #10865 and #10939.
2013-12-14 10:41:24 -08:00
Cadence Marseille
5de42701a8 Fix #10754 - std::run functions fail after io_error
The problem was that std::run::Process::new() was unwrap()ing the result
of std::io::process::Process::new(), which returns None in the case
where the io_error condition is raised to signal failure to start the
process.

Have std::run::Process::new() similarly return an Option<run::Process>
to reflect the fact that a subprocess might have failed to start. Update
utility functions run::process_status() and run::process_output() to
return Option<ProcessExit> and Option<ProcessOutput>, respectively.

Various parts of librustc and librustpkg needed to be updated to reflect
these API changes.

closes #10754
2013-12-14 12:50:04 -05:00
bors
00b1adf93c auto merge of #10935 : sanxiyn/rust/fk-anon, r=pcwalton 2013-12-14 03:31:41 -08:00
Kiet Tran
71ce559f7d Dead-code pass now marks and warns foreign items 2013-12-14 00:35:41 -05:00
Kiet Tran
d5ad32f388 Check more live Path nodes in dead-code pass 2013-12-14 00:26:15 -05:00
bors
378897a09c auto merge of #10916 : alexcrichton/rust/nounwind, r=pcwalton
When performing LTO, the rust compiler has an opportunity to completely strip
all landing pads in all dependent libraries. I've modified the LTO pass to
recognize the -Z no-landing-pads option when also running an LTO pass to flag
everything in LLVM as nothrow. I've verified that this prevents any and all
invoke instructions from being emitted.

I believe that this is one of our best options for moving forward with
accomodating use-cases where unwinding doesn't really make sense. This will
allow libraries to be built with landing pads by default but allow usage of them
in contexts where landing pads aren't necessary.
2013-12-13 12:56:36 -08:00
bors
6e0b82e07c auto merge of #10909 : sanxiyn/rust/coherence, r=alexcrichton
Now coherence checking is always done.
2013-12-13 06:26:42 -08:00
bors
d52e1bffe5 auto merge of #10908 : alexcrichton/rust/issue-10907, r=cmr
Turns out that one some platforms the ar/ranlib tool will die with an assertion
if the file being added doesn't actually have any symbols (or if it's just not
an object file presumably).

This functionality is already all exercised on the bots, it just turns out that
the bots don't have an ar tool which dies in this situation, so it's difficult
for me to add a test.

Closes #10907
2013-12-13 05:01:58 -08:00
bors
9bbef13702 auto merge of #10698 : metajack/rust/dep-info, r=alexcrichton
This isn't super useful for libraries yet without #10593.

Fixes #7633.
2013-12-13 00:32:47 -08:00
Jack Moffitt
9365375c7f Add --dep-info to write Makefile-compatible dependency info.
When --dep-info is given, rustc will write out a `$input_base.d` file in the
output directory that contains Makefile compatible dependency information for
use with tools like make and ninja.
2013-12-12 13:57:47 -07:00
Seo Sanghyeon
5499b45323 Remove fk_anon 2013-12-12 23:01:47 +09:00
Alex Crichton
0f6537fed4 Gate literal box expressions in addition to types
Closes #10920
2013-12-12 00:49:57 -08:00
Vadim Chugunov
d4d1310c5c Fixed "unused variable" errors and trailing whitespace. 2013-12-11 23:44:25 -08:00
Alex Crichton
ee618e1e75 Don't always modify the symbol table in rlibs
Turns out that one some platforms the ar/ranlib tool will die with an assertion
if the file being added doesn't actually have any symbols (or if it's just not
an object file presumably).

This functionality is already all exercised on the bots, it just turns out that
the bots don't have an ar tool which dies in this situation, so it's difficult
for me to add a test.

Closes #10907
2013-12-11 19:37:26 -08:00
Vadim Chugunov
544ed0328c Embed Windows application manifest. 2013-12-11 18:12:22 -08:00
Erik Price
5731ca3078 Make 'self lifetime illegal.
Also remove all instances of 'self within the codebase.

This fixes #10889.
2013-12-11 10:54:06 -08:00
Alex Crichton
667d114f47 Disable all unwinding on -Z no-landing-pads LTO
When performing LTO, the rust compiler has an opportunity to completely strip
all landing pads in all dependent libraries. I've modified the LTO pass to
recognize the -Z no-landing-pads option when also running an LTO pass to flag
everything in LLVM as nothrow. I've verified that this prevents any and all
invoke instructions from being emitted.

I believe that this is one of our best options for moving forward with
accomodating use-cases where unwinding doesn't really make sense. This will
allow libraries to be built with landing pads by default but allow usage of them
in contexts where landing pads aren't necessary.

cc #10780
2013-12-11 09:18:20 -08:00
bors
d441c54688 auto merge of #10787 : nikomatsakis/rust/issue-9629-freeze-andmut, r=pnkfelix
See #9629 for details.

r? @pnkfelix
2013-12-11 05:41:18 -08:00
Niko Matsakis
fc74d64f7d More small test case fixes. grr. cc #9629. 2013-12-11 06:40:37 -05:00
bors
ac4dd9efee auto merge of #10593 : metajack/rust/pkgid-hash, r=brson
This replaces the link meta attributes with a pkgid attribute and uses a hash
of this as the crate hash. This makes the crate hash computable by things
other than the Rust compiler. It also switches the hash function ot SHA1 since
that is much more likely to be available in shell, Python, etc than SipHash.

Fixes #10188, #8523.
2013-12-10 16:51:20 -08:00
Jack Moffitt
b349036e5f Make crate hash stable and externally computable.
This replaces the link meta attributes with a pkgid attribute and uses a hash
of this as the crate hash. This makes the crate hash computable by things
other than the Rust compiler. It also switches the hash function ot SHA1 since
that is much more likely to be available in shell, Python, etc than SipHash.

Fixes #10188, #8523.
2013-12-10 17:04:24 -07:00
Niko Matsakis
76d9a9671b Fix test case harder (cc #9629) 2013-12-10 13:14:45 -05:00
Seo Sanghyeon
55d2d8eec9 Remove -Z coherence 2013-12-11 02:56:06 +09:00
Alex Crichton
9522a08cf0 Check the privacy of implemented traits
This bug showed up because the visitor only visited the path of the implemented
trait via walk_path (with no corresponding visit_path function). I have modified
the visitor to use visit_path (which is now overridable), and the privacy
visitor overrides this function and now properly checks for the privacy of all
paths.

Closes #10857
2013-12-09 22:53:58 -08:00
bors
29ca4350c8 auto merge of #10812 : alexcrichton/rust/lto, r=pcwalton
The first commit was approved from another pull request, but I wanted to rebase LTO on top of it.

LTO is not turned on by default at all, and it's hidden behind a `-Z` flag. I have added a few small tests for it, however.
2013-12-09 16:11:28 -08:00
Alex Crichton
fce4a174b9 Implement LTO
This commit implements LTO for rust leveraging LLVM's passes. What this means
is:

* When compiling an rlib, in addition to insdering foo.o into the archive, also
  insert foo.bc (the LLVM bytecode) of the optimized module.

* When the compiler detects the -Z lto option, it will attempt to perform LTO on
  a staticlib or binary output. The compiler will emit an error if a dylib or
  rlib output is being generated.

* The actual act of performing LTO is as follows:

    1. Force all upstream libraries to have an rlib version available.
    2. Load the bytecode of each upstream library from the rlib.
    3. Link all this bytecode into the current LLVM module (just using llvm
       apis)
    4. Run an internalization pass which internalizes all symbols except those
       found reachable for the local crate of compilation.
    5. Run the LLVM LTO pass manager over this entire module

    6a. If assembling an archive, then add all upstream rlibs into the output
        archive. This ignores all of the object/bitcode/metadata files rust
        generated and placed inside the rlibs.
    6b. If linking a binary, create copies of all upstream rlibs, remove the
        rust-generated object-file, and then link everything as usual.

As I have explained in #10741, this process is excruciatingly slow, so this is
*not* turned on by default, and it is also why I have decided to hide it behind
a -Z flag for now. The good news is that the binary sizes are about as small as
they can be as a result of LTO, so it's definitely working.

Closes #10741
Closes #10740
2013-12-09 14:41:49 -08:00
Niko Matsakis
9f7baedc62 Address nits for PR for #9629 2013-12-09 12:45:13 -05:00
Alex Crichton
52b835c5e7 Store metadata separately in rlib files
Right now whenever an rlib file is linked against, all of the metadata from the
rlib is pulled in to the final staticlib or binary. The reason for this is that
the metadata is currently stored in a section of the object file. Note that this
is intentional for dynamic libraries in order to distribute metadata bundled
with static libraries.

This commit alters the situation for rlib libraries to instead store the
metadata in a separate file in the archive. In doing so, when the archive is
passed to the linker, none of the metadata will get pulled into the result
executable. Furthermore, the metadata file is skipped when assembling rlibs into
an archive.

The snag in this implementation comes with multiple output formats. When
generating a dylib, the metadata needs to be in the object file, but when
generating an rlib this needs to be separate. In order to accomplish this, the
metadata variable is inserted into an entirely separate LLVM Module which is
then codegen'd into a different location (foo.metadata.o). This is then linked
into dynamic libraries and silently ignored for rlib files.

While changing how metadata is inserted into archives, I have also stopped
compressing metadata when inserted into rlib files. We have wanted to stop
compressing metadata, but the sections it creates in object file sections are
apparently too large. Thankfully if it's just an arbitrary file it doesn't
matter how large it is.

I have seen massive reductions in executable sizes, as well as staticlib output
sizes (to confirm that this is all working).
2013-12-09 08:25:58 -08:00
Seo Sanghyeon
3b14f25868 Extend allocation lint for boxing expressions 2013-12-10 01:17:32 +09:00
bors
e5f2021202 auto merge of #10874 : vadimcn/rust/integrated-as, r=alexcrichton
Last LLVM update seems to have fixed whatever prevented LLVM integrated assembler from generating correct unwind tables on Windows.   This PR switches Windows builds to use internal assembler by default.
Compilation via external assembler can still be requested via the newly added `-Z no-integrated-as` option.

Closes #8809
2013-12-09 01:01:43 -08:00
bors
09db61fb4f auto merge of #10867 : sfackler/rust/unsugared-doc, r=huonw
Closes #10853
2013-12-08 22:06:25 -08:00
Vadim Chugunov
554c3c316e Use LLVM integrated assembler on Windows too. 2013-12-08 20:14:36 -08:00
Steven Fackler
4d688e8214 Accept unsugared docs in missing-doc lint
Closes #10853
2013-12-08 20:08:49 -08:00
David Renshaw
d99efe84df encode trait lifetime params in metadata to allow cross-crate usage 2013-12-08 18:09:31 -05:00
Kiet Tran
1755408d1a Remove dead codes 2013-12-08 02:55:28 -05:00
Kiet Tran
c06dd0e0af Add dead-code warning pass 2013-12-08 02:55:27 -05:00
bors
67aca9c9af auto merge of #10844 : huonw/rust/deriving-expn-info, r=alexcrichton
Previously something like

    struct NotEq;

    #[deriving(Eq)]
    struct Error {
        foo: NotEq
    }

would just point to the `foo` field, with no mention of the
`deriving(Eq)`. With this patch, the compiler creates a note saying "in
expansion of #[deriving(Eq)]" pointing to the Eq.

(includes some cleanup/preparation; the commit view might be nicer, to filter out the noise of the first one.)
2013-12-07 05:11:10 -08:00
bors
7c719ec1bc auto merge of #10831 : luqmana/rust/9382, r=nikomatsakis
Fixes #9382.

r? @nikomatsakis
2013-12-07 03:41:12 -08:00
Alex Crichton
e91ffb0710 Link rustllvm statically, and distribute a static snapshot
In order to keep up to date with changes to the libraries that `llvm-config`
spits out, the dependencies to the LLVM are a dynamically generated rust file.
This file is now automatically updated whenever LLVM is updated to get kept
up-to-date.

At the same time, this cleans out some old cruft which isn't necessary in the
makefiles in terms of dependencies.

Closes #10745
Closes #10744
2013-12-06 20:51:17 -08:00
Huon Wilson
3ef933647a syntax: print expansion info from #[attribute] macros in the correct
format.

Previously, any attempt to use this information from inside something
like #[deriving(Foo)] would result in it printing like `deriving(Foo)!`.
2013-12-07 13:41:11 +11:00
Luqman Aden
920ca61871 librustc: Pass the correct type when adding cleanups. 2013-12-06 15:47:14 -05:00
bors
aa4455e4c7 auto merge of #10832 : chris-morgan/rust/let's-lop-lang-item-line-count, r=alexcrichton
This should make maintenance of lang items simpler and also reduces the
line count by about 201 lines.
2013-12-06 01:11:18 -08:00
bors
2eb22ae2b4 auto merge of #10665 : cmr/rust/doc_lint, r=alexcrichton
Because the root module isn't actually an item, we need to do some hackish
handling of it.

Closes #10656.
2013-12-05 23:41:19 -08:00
Corey Richardson
30a5612830 Check crate root for docs in missing_doc lint.
Because the root module isn't actually an item, we need to do some hackish
handling of it.

Closes #10656.
2013-12-06 01:39:32 -05:00
bors
f9aecdb22a auto merge of #10758 : alexcrichton/rust/upgrade-llvm, r=alexcrichton
This upgrades LLVM in order to make progress on #10708, and it's also been awhile since we last upgraded!

The contentious point of this upgrade is that all JIT support has been removed because LLVM is changing it and we're not keeping up with it.
2013-12-05 21:26:19 -08:00
Chris Morgan
0b1bbc5fd6 Use a macro in lang_items to remove duplication.
This should make maintenance of lang items simpler and also reduces the
line count by about 201 lines.
2013-12-06 15:24:25 +11:00
Alex Crichton
17a951c7bf Remove unused upcalls
The main one removed is rust_upcall_reset_stack_limit (continuation of #10156),
and this also removes the upcall_trace function. The was hidden behind a
`-Z trace` flag, but if you attempt to use this now you'll get a linker error
because there is no implementation of the 'upcall_trace' function. Due to this
no longer working, I decided to remove it entirely from the compiler (I'm also a
little unsure on what it did in the first place).
2013-12-05 16:29:16 -08:00
bors
6708c297a8 auto merge of #10506 : nikomatsakis/rust/issue-10391-ICE-with-lifetimes, r=pnkfelix
Make trait lifetime parameters early bound in static fn type. Reasoning for this change is (hopefully) explained well enough in the comment, so I'll not duplicate it here. Fixes #10391.

r? @pnkfelix
2013-12-05 16:26:20 -08:00
Alex Crichton
6b34ba242d Update LLVM and jettison jit support
LLVM's JIT has been updated numerous times, and we haven't been tracking it at
all. The existing LLVM glue code no longer compiles, and the JIT isn't used for
anything currently.

This also rebases out the FixedStackSegment support which we have added to LLVM.
None of this is still in use by the compiler, and there's no need to keep this
functionality around inside of LLVM.

This is needed to unblock #10708 (where we're tripping an LLVM assertion).
2013-12-05 09:15:54 -08:00
Kevin Ballard
408dc5ad1b Revert "libstd: Change Path::new to Path::init."
This reverts commit c54427ddfb.

Leave the #[ignores] in that were added to rustpkg tests.

Conflicts:
	src/librustc/driver/driver.rs
	src/librustc/metadata/creader.rs
2013-12-04 22:33:53 -08:00
bors
9b9cf9892b auto merge of #10701 : huonw/rust/rm-from_utf8, r=brson
This function had type &[u8] -> ~str, i.e. it allocates a string
internally, even though the non-allocating version that take &[u8] ->
&str and ~[u8] -> ~str are all that is necessary in most circumstances.
2013-12-04 11:32:23 -08:00
bors
5fa6bd526e auto merge of #10788 : alexcrichton/rust/fixes, r=pcwalton
I used the wrong condition where I was looking for "is this method public or is
this implementation a trait" rather than what was being checked.
2013-12-04 08:12:11 -08:00
Huon Wilson
b0426edc0a std::str: s/from_utf8_slice/from_utf8/, to make the basic case shorter. 2013-12-04 22:35:53 +11:00
Huon Wilson
9d64e46013 std::str: remove from_utf8.
This function had type &[u8] -> ~str, i.e. it allocates a string
internally, even though the non-allocating version that take &[u8] ->
&str and ~[u8] -> ~str are all that is necessary in most circumstances.
2013-12-04 22:35:53 +11:00
bors
63c9522c27 auto merge of #10776 : alexcrichton/rust/issue-9725, r=pcwalton
Closes #9725
2013-12-03 23:56:25 -08:00
bors
c22f6d8d44 auto merge of #10785 : alexcrichton/rust/omg-i-hate-windows, r=pcwalton
Turns out LLVM only builds libfoo.a libraries, so we're going to need this logic
to statically link librustc
2013-12-03 21:11:26 -08:00
Niko Matsakis
23d95f6dc6 Make trait lifetime parameters early bound in static fn type. This is related
to #5121.

Fixes #10391.
2013-12-03 18:17:37 -05:00
Alex Crichton
7a2415f0e4 Fix a bug in exporting trait implementations
I used the wrong condition where I was looking for "is this method public or is
this implementation a trait" rather than what was being checked.
2013-12-03 15:15:17 -08:00
bors
693ec73b9b auto merge of #10747 : alexcrichton/rust/snapshots, r=cmr
This registers new snapshots after the landing of #10528, and then goes on to tweak the build process to build a monolithic `rustc` binary for use in future snapshots. This mainly involved dropping the dynamic dependency on `librustllvm`, so that's now built as a static library (with a dynamically generated rust file listing LLVM dependencies).

This currently doesn't actually make the snapshot any smaller (24MB => 23MB), but I noticed that the executable has 11MB of metadata so once progress is made on #10740 we should have a much smaller snapshot.

There's not really a super-compelling reason to distribute just a binary because we have all the infrastructure for dealing with a directory structure, but to me it seems "more correct" that a snapshot compiler is just a `rustc` binary.
2013-12-03 14:36:59 -08:00
Alex Crichton
acc5e32e53 Register new snapshots 2013-12-03 14:31:54 -08:00
Niko Matsakis
22f14fb27f Issue #9629 -- permit freezing &mut found within an & pointer 2013-12-03 17:26:51 -05:00
bors
899217c11b auto merge of #10757 : TeXitoi/rust/mut-split-iter, r=alexcrichton
I've renamed `MutableVector::mut_split(at)` to `MutableVector::mut_split_at(at)` to be coherent with ImmutableVector.  As specified in the commit log, The `size_hint` method is not optimal because of #9629.
2013-12-03 10:11:25 -08:00
Alex Crichton
cb823b09df Search for libfoo.a on windows as well as foo.lib
Turns out LLVM only builds libfoo.a libraries, so we're going to need this logic
to statically link librustc
2013-12-03 08:59:09 -08:00
Alex Crichton
0dc9f62779 Resume propagation of linking to native dylibs
The reasons for this are outlined in issue #10743 as well as the comment I have
now placed in the code.

Closes #10743
2013-12-03 08:19:33 -08:00
Alex Crichton
2bd80758a2 Continue tightening holes in reachability
* Don't flag any address_insignificant statics as reachable because the whole
  point of the address_insignificant optimization is that the static is not
  reachable. Additionally, there's no need for it to be reachable because LLVM
  optimizes it away.

* Be sure to not leak external node ids into our reachable set, this can
  spuriously cause local items to be considered reachable if the node ids just
  happen to line up
2013-12-03 08:13:00 -08:00
Alex Crichton
80055dee3a Disallow duplicate bindings of struct fields
Closes #9725
2013-12-02 14:20:27 -08:00
bors
c8b60a2d9e auto merge of #10742 : alexcrichton/rust/frameworks, r=cmr
Commits have the fun details, and scrutiny on the new documentation would be appreciated!
2013-12-02 13:36:41 -08:00
bors
fc4540d23e auto merge of #10728 : sanxiyn/rust/proc, r=cmr
Fix #10718.
2013-12-02 12:21:32 -08:00
Seo Sanghyeon
e41c331b2e Fix type inference for proc expressions 2013-12-02 21:39:53 +09:00
Guillaume Pinot
25bb1a406c rename MutableVector::mut_split(at) to MutableVector::mut_split_at(at) 2013-12-02 08:58:07 +01:00
Philipp Brüschweiler
32688f8f74 rustc: filter out empty linker args
This is inspired by a mystifying linker failure when using `pkg-config` to
generate the linker args: `pkg-config` produces output that ends in a
space, thus resulting in an empty linker argument.

Also added some updates to the concerning error messages that helped
spotting this bug.
2013-12-01 19:29:01 +01:00
bors
df41115213 auto merge of #10750 : Blei/rust/no-at-struct-field, r=alexcrichton 2013-12-01 05:42:06 -08:00
bors
b2aa00ba8b auto merge of #10676 : eddyb/rust/ast-box-in-enums, r=cmr
**Note**: I only tested on top of my #10670 PR, size reductions come from both change sets.

With this, [more enums are shrinked](https://gist.github.com/eddyb/08fef0dfc6ff54e890bc), the most significant one being `ast_node`, from 104 bytes (master) to 96 (#10670) and now to 32 bytes.

My own testcase requires **200MB** less when compiling (not including the other **200MB** gained in #10670), and rustc-stage2 is down by about **130MB**.

I believe there is more to gain by fiddling with the enums' layouts.
2013-12-01 03:11:58 -08:00
Philipp Brüschweiler
47ce981903 ast: Remove one @ and fix the fallout 2013-12-01 11:24:58 +01:00
Alex Crichton
f9d6fd20a5 Support OSX frameworks
This adds support to link to OSX frameworks via the new link attribute when
using `kind = "framework"`. It is a compiler error to request linkage to a
framework when the target is not macos because other platforms don't support
frameworks.

Closes #2023
2013-11-30 15:47:43 -08:00
bors
4252a24ae1 auto merge of #10528 : alexcrichton/rust/static-linking-v2, r=pcwalton
In this series of commits, I've implemented static linking for rust. The scheme I implemented was the same as my [mailing list post](https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html).

The commits have more details to the nitty gritty of what went on. I've rebased this on top of my native mutex pull request (#10479), but I imagine that it will land before this lands, I just wanted to pre-emptively get all the rebase conflicts out of the way (becuase this is reorganizing building librustrt as well).

Some contentious points I want to make sure are all good:

* I've added more "compiler chooses a default" behavior than I would like, I want to make sure that this is all very clearly outlined in the code, and if not I would like to remove behavior or make it clearer.
* I want to make sure that the new "fancy suite" tests are ok (using make/python instead of another rust crate)

If we do indeed pursue this, I would be more than willing to write up a document describing how linking in rust works. I believe that this behavior should be very understandable, and the compiler should never hinder someone just because linking is a little fuzzy.
2013-11-30 14:41:40 -08:00
Alex Crichton
56e4c82a38 Test fixes and merge conflicts 2013-11-30 14:34:59 -08:00
Eduard Burtescu
a9c4b18b18 Box Block, fn_decl, variant and Ty in the AST, as they were inflating critical enum sizes. 2013-12-01 00:00:39 +02:00
bors
eeaf2e1ddc auto merge of #10735 : alexcrichton/rust/issue-10734, r=cmr
Turns out `with_scope` already translates destructors, so by manually
translating destructors we end up running them all twice (bad).

Closes #10734
2013-11-30 04:01:45 -08:00
Alex Crichton
7bb166ef4f Don't run cleanups twice in "if true" blocks
Turns out `with_scope` already translates destructors, so by manually
translating destructors we end up running them all twice (bad).

Closes #10734
2013-11-30 00:30:28 -08:00
Corey Richardson
572635b76f Wrap the return value of the type_id intrinsic in an opaque box
Closes #10594
2013-11-30 02:58:36 -05:00
Alex Crichton
c1e287af77 Make -Z gen-crate-map usable for I/O
In #10422, I didn't actually test to make sure that the '-Z gen-crate-map'
option was usable before I implemented it. The crate map was indeed generated
when '-Z gen-crate-map' was specified, but the I/O factory slot was empty
because of an extra check in trans about filling in that location.

This commit both fixes that location, and checks in a "fancy test" which does
lots of fun stuff. The test will use the rustc library to compile a rust crate,
and then compile a C program to link against that crate and run the C program.
To my knowledge this is the first test of its kind, so it's a little ad-hoc, but
it seems to get the job done. We could perhaps generalize running tests like
this, but for now I think it's fine to have this sort of functionality tucked
away in a test.
2013-11-29 18:36:14 -08:00
Alex Crichton
e338a4154b Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.

When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.

Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.

Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:

* If both a .dylib and .rlib are found for a rust library, the compiler will
  prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
  overridable by explicitly saying what flavor you'd like (rlib, staticlib,
  dylib).
* If no options are passed to the command line, and no crate_type is found in
  the destination crate, then an executable is generated

With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.

This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.

Closes #552
2013-11-29 18:36:13 -08:00
bors
80991bb578 auto merge of #10719 : Kimundi/rust/switch_to_multi_item_macros, r=alexcrichton
- Removed module reexport workaround for the integer module macros
- Removed legacy reexports of `cmp::{min, max}` in the integer module macros
- Combined a few macros in `vec` into one
- Documented a few issues
2013-11-29 14:01:48 -08:00
Marvin Löbel
0d8ace823b Removed useless cmp::{min, max} reexports from the integer modules 2013-11-29 20:19:22 +01:00
bors
08f4d1ff9f auto merge of #10697 : pcwalton/rust/path-new, r=pcwalton
r+

(carrying over from @alexcrichton's review)
2013-11-29 11:01:50 -08:00
Patrick Walton
c54427ddfb libstd: Change Path::new to Path::init. 2013-11-29 10:55:13 -08:00
Felix S. Klock II
fffa10c175 Removed some dead code.
While tracking down how this function became dead, identified a spot
(@fn cannot happen) where we probably would prefer to ICE rather than
pass silently; so added fail! invocation.
2013-11-29 18:20:27 +01:00
Alex Crichton
ab387a6838 Register new snapshots 2013-11-28 20:27:56 -08:00
bors
859c3baf64 auto merge of #10519 : nikomatsakis/rust/issue-8624-borrowck-overly-permissive, r=pnkfelix
See #8624 for details.

r? @pnkfelix
2013-11-28 03:51:32 -08:00
Niko Matsakis
09e12fa553 Test that reborrowing contents of an &'a mut &'b mut pointer can only
be done for at most lifetime `'a`

Fixes #8624
2013-11-28 06:43:39 -05:00
bors
d662820b29 auto merge of #10680 : alexcrichton/rust/relax-feature-gate, r=thestinger
Instead of forcibly always aborting compilation, allow usage of
 #[warn(unknown_features)] and related lint attributes to selectively abort
 compilation. By default, this lint is deny.
2013-11-27 14:17:41 -08:00
Alex Crichton
a9bd049fc0 Relax restrictions on unknown feature directives
Instead of forcibly always aborting compilation, allow usage of
 #[warn(unknown_features)] and related lint attributes to selectively abort
 compilation. By default, this lint is deny.
2013-11-27 09:54:30 -08:00
bors
23674be0b1 auto merge of #10684 : jld/rust/unstruct-unhack-typekind, r=alexcrichton 2013-11-27 06:17:40 -08:00
bors
faf4c939fb auto merge of #10670 : eddyb/rust/node-u32, r=alexcrichton
### Rationale
There is no reason to support more than 2³² nodes or names at this moment, as compiling something that big (even without considering the quadratic space usage of some analysis passes) would take at least **64GB**.
Meanwhile, some can't (or barely can) compile rustc because it requires almost **1.5GB**.

### Potential problems
Can someone confirm this doesn't affect metadata (de)serialization? I can't tell myself, I know nothing about it.

### Results
Some structures have a size reduction of 25% to 50%: [before](https://gist.github.com/luqmana/3a82a51fa9c86d9191fa) - [after](https://gist.github.com/eddyb/5a75f8973d3d8018afd3).
Sadly, there isn't a massive change in the memory used for compiling stage2 librustc (it doesn't go over **1.4GB** as [before](http://huonw.github.io/isrustfastyet/mem/), but I can barely see the difference).
However, my own testcase (previously peaking at **1.6GB** in typeck) shows a reduction of **200**-**400MB**.
2013-11-26 22:07:44 -08:00
Eduard Burtescu
7ed27b5531 Shink NodeId, CrateNum, Name and Mrk down to 32 bits on x64. 2013-11-27 07:02:25 +02:00
Jed Davis
57c1a01a93 Remove enum struct return workaround from LLVM bindings. 2013-11-26 17:47:49 -08:00
bors
fb52956fe4 auto merge of #10677 : jld/rust/type-enum-discrim-rm, r=alexcrichton 2013-11-26 17:32:45 -08:00
bors
18687a92ae auto merge of #10649 : sfackler/rust/multi-macro, r=alexcrichton
The majority of this change is modifying some of the `ast_visit` methods to return multiple values.

It's prohibitively expensive to allocate a `~[Foo]` every time a statement, declaration, item, etc is visited, especially since the vast majority will have 0 or 1 elements. I've added a `SmallVector` class that avoids allocation in the 0 and 1 element cases to take care of that.
2013-11-26 14:52:05 -08:00
Steven Fackler
c403c1f18e Clean up SmallVector use a bit 2013-11-26 13:56:02 -08:00
Steven Fackler
c144752a2d Support multiple item macros
Closes #4375
2013-11-26 13:56:02 -08:00
bors
35ebf03489 auto merge of #10312 : thestinger/rust/thread_local, r=alexcritchton
This provides a building block for fast thread-local storage. It does
not change the safety semantics of `static mut`.

Closes #10310
2013-11-26 13:32:43 -08:00
Daniel Micay
a5af479bb4 add a thread_local feature gate 2013-11-26 14:49:14 -05:00
Daniel Micay
1795ae4e8a add #[thread_local] attribute
This provides a building block for fast thread-local storage. It does
not change the safety semantics of `static mut`.

Closes #10310
2013-11-26 14:49:10 -05:00
Patrick Walton
9521551b47 librustc: Fix merge fallout. 2013-11-26 11:04:39 -08:00
Jed Davis
792077274c Remove the unused obsolete enum_discrim type. 2013-11-26 10:54:35 -08:00
Patrick Walton
749ee53c6d librustc: Make || lambdas not infer to procs 2013-11-26 08:25:27 -08:00
Patrick Walton
8ceb374ab7 librustc: Remove non-procedure uses of do from librustc, librustdoc,
and librustpkg.
2013-11-26 08:25:00 -08:00
Patrick Walton
9e610573ba librustc: Remove remaining uses of &fn() in favor of ||. 2013-11-26 08:20:58 -08:00
Marvin Löbel
24b316a3b9 Removed unneccessary _iter suffixes from various APIs 2013-11-26 10:02:26 +01:00
bors
c6a87c2721 auto merge of #10316 : klutzy/rust/attr-lint, r=cmr
This patchset makes warning if crate-level attribute is used at other places, obsolete attributed is used, or unknown attribute is used, since they are usually from mistakes.

Closes #3348
2013-11-25 21:47:16 -08:00
klutzy
fa2077af99 rustc: Add crate-level attribute lint 2013-11-26 14:07:48 +09:00
klutzy
9432e2a25d rustc: Update obsolete attribute list 2013-11-26 14:06:52 +09:00
klutzy
37f2f7173b rustc: Add lint for unknown attributes 2013-11-26 14:05:50 +09:00
bors
720bcd81de auto merge of #10652 : jld/rust/enum-unstruct, r=thestinger
This is needed so that the FFI works as expected on platforms that don't
flatten aggregates the way the AMD64 ABI does, especially for `#[repr(C)]`.

This moves more of `type_of` into `trans::adt`, because the type might
or might not be an LLVM struct.

Closes #10308.
2013-11-25 20:32:22 -08:00
klutzy
1f7bfac9d2 rustc: Add lint for obsolete attributes
This also moves `#[auto_{en,de}code]` checker from syntax to lint.
2013-11-26 13:13:17 +09:00
klutzy
6ff697d393 rustc: Add lint for misplaced crate attributes 2013-11-26 13:13:17 +09:00
Seo Sanghyeon
9028330f39 Take &Pat in visit_pat 2013-11-26 03:22:21 +09:00
Seo Sanghyeon
eb5cbfebfd Take &Pat 2013-11-25 23:37:03 +09:00
Seo Sanghyeon
cd7a9b7234 Remove arms_have_move_bindings 2013-11-25 23:36:20 +09:00
Jed Davis
8624d5b186 Represent C-like enums with a plain LLVM integer, not a struct.
This is needed so that the FFI works as expected on platforms that don't
flatten aggregates the way the AMD64 ABI does, especially for `#[repr(C)]`.

This moves more of `type_of` into `trans::adt`, because the type might
or might not be an LLVM struct.
2013-11-24 22:44:48 -08:00
bors
2cc1e16ac0 auto merge of #10603 : alexcrichton/rust/no-linked-failure, r=brson
The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
2013-11-24 21:32:13 -08:00
Alex Crichton
acca9e3834 Remove linked failure from the runtime
The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
2013-11-24 21:21:12 -08:00
Kiet Tran
9a4c8da501 Add comments to ast, ast_map, ty, and pat_util 2013-11-24 18:38:41 -05:00
bors
b3ff24adaa auto merge of #10475 : astrieanna/rust/issue8763, r=alexcrichton
Issue #8763 is about improving a particular error message.

* added case & better error message for "impl trait for module"
* added compile-fail test trait-impl-for-module.rs
* updated copyright dates
* revised compile-fail test trait-or-new-type-instead
   (the error message for the modified test is still unclear, but that's a different bug https://github.com/mozilla/rust/issues/8767)
2013-11-24 10:17:03 -08:00
Leah Hanson
e1d1ad34f7 Fix issue #8763
* added case & better error message for "impl trait for module"
* used better way to print the module
* switched from //error-pattern to //~ ERROR
* added compile-fail test trait-impl-for-module.rs
* revised compile-fail test trait-or-new-type-instead
    (the error message for the modified test is still unclear, but that's a different bug)
* added FIXME to trait-or-new-type-instead
2013-11-24 11:14:27 -06:00
Corey Richardson
a8a6188a1a Use -O1 for non-GNU linkers 2013-11-24 08:50:16 -05:00
bors
738eb9b930 auto merge of #10620 : cmr/rust/linker_opts, r=thestinger 2013-11-23 23:56:30 -08:00
bors
9ba473f86f auto merge of #10578 : luqmana/rust/mingw64, r=alexcrichton
With these changes I was able to cross compile for windows from a linux box. (Using the mingw-w64 package on Debian Testing).

Fixed a bug where the `target_family` cfg would be wrong when targeting something with a different value than the host. (i.e windows -> unix or unix -> windows).

Also, removed `LIBUV_FLAGS` in `mk/rt.mk` because of the redundancy between it and `CFG_GCCISH_CFLAGS_(target)`.

After this we can create a snapshot and migrate to mingw64 instead of mingw32.
2013-11-23 21:36:50 -08:00
Corey Richardson
672549372c Use linker optimizations on Linux 2013-11-23 10:03:41 -05:00
Steven Fackler
5759f2fc57 Strip down Cell functionality 2013-11-22 21:19:53 -08:00
Luqman Aden
6820ed4dcf Fix up mingw64 target. 2013-11-22 20:39:58 -05:00
bors
fb279aa02a auto merge of #10605 : huonw/rust/ascii-ident-gate, r=pcwalton
cf. https://mail.mozilla.org/pipermail/rust-dev/2013-November/006920.html
2013-11-22 13:51:34 -08:00
Huon Wilson
ab2a99f699 Put non-ascii identifiers behind a feature gate.
cf. https://mail.mozilla.org/pipermail/rust-dev/2013-November/006920.html
2013-11-23 08:18:50 +11:00
bors
cd9069ca73 auto merge of #10583 : alexcrichton/rust/privacy-reexport, r=pcwalton
I added a test case which does not compile today, and required changes on
privacy's side of things to get right. Additionally, this moves a good bit of
logic which did not belong in reachability into privacy.

All of reachability should solely be responsible for determining what the
reachable surface area of a crate is given the exported surface area (where the
exported surface area is that which is usable by external crates).

Privacy will now correctly figure out what's exported by deeply looking
through reexports. Previously if a module were reexported under another name,
nothing in the module would actually get exported in the executable. I also
consolidated the phases of privacy to be clearer about what's an input to what.
The privacy checking pass no longer uses the notion of an "all public" path, and
the embargo visitor is no longer an input to the checking pass.

Currently the embargo visitor is built as a saturating analysis because it's
unknown what portions of the AST are going to get re-exported.

This also cracks down on exported methods from impl blocks and trait blocks. If you implement a private trait, none of the symbols are exported, and if you have an impl for a private type none of the symbols are exported either. On the other hand, if you implement a public trait for a private type, the symbols are still exported. I'm unclear on whether this last part is correct, but librustc will fail to link unless it's in place.
2013-11-22 10:06:35 -08:00
Alex Crichton
93a0dec202 Move more of the exportation burden into privacy
I added a test case which does not compile today, and required changes on
privacy's side of things to get right. Additionally, this moves a good bit of
logic which did not belong in reachability into privacy.

All of reachability should solely be responsible for determining what the
reachable surface area of a crate is given the exported surface area (where the
exported surface area is that which is usable by external crates).

Privacy will now correctly figure out what's exported by deeply looking
through reexports. Previously if a module were reexported under another name,
nothing in the module would actually get exported in the executable. I also
consolidated the phases of privacy to be clearer about what's an input to what.
The privacy checking pass no longer uses the notion of an "all public" path, and
the embargo visitor is no longer an input to the checking pass.

Currently the embargo visitor is built as a saturating analysis because it's
unknown what portions of the AST are going to get re-exported.
2013-11-22 10:02:10 -08:00
bors
d3cb24b1fe auto merge of #10610 : thestinger/rust/breakpoint, r=pnkfelix
This can be used to grab the attention of a debugger, and unlike
`abort` execution can be resumed.
2013-11-22 07:31:35 -08:00
Daniel Micay
bf61641e9f add a breakpoint intrinsic for debugging
This can be used to grab the attention of a debugger, and unlike
`abort` execution can be resumed.
2013-11-22 10:29:04 -05:00
Daniel Micay
d97ce15c14 mention Gc in the managed box feature gate 2013-11-22 07:02:56 -05:00
Daniel Micay
a1afe9cc0a add lint for unsafe blocks 2013-11-21 17:58:49 -05:00
Seo Sanghyeon
8470639319 Remove ty_mac 2013-11-21 22:59:56 +09:00
bors
ea5d1dfb1c auto merge of #10567 : sanxiyn/rust/bytepos, r=alexcrichton 2013-11-20 23:31:27 -08:00
bors
e12bc239b4 auto merge of #10527 : eholk/rust/win64, r=alexcrichton
This was needed to access UEFI boot services in my new Boot2Rust experiment.

I also realized that Rust functions declared as extern always use the C calling convention regardless of how they were declared, so this pull request fixes that as well.
2013-11-20 11:01:34 -08:00
Seo Sanghyeon
5e1e487624 Make BytePos 32-bit 2013-11-20 16:51:25 +09:00
Patrick Walton
7e3f20133a librustc: Change most uses of &fn() to ||. 2013-11-19 13:22:03 -08:00
Patrick Walton
77f621bff4 librustc: Remove the one use of ~fn() 2013-11-18 18:27:30 -08:00
bors
7fc3e82aae auto merge of #10366 : brson/rust/ignore-patterns, r=alexcrichton
This replaces `*` with `..` in enums, `_` with `..` in structs, and `.._` with `..` in vectors. It adds obsolete syntax warnings for the old forms but doesn't turn them on yet because we need a snapshot.

#5830
2013-11-18 16:36:33 -08:00
Eric Holk
5b534e4a22 Use the correct calling convention for extern rust functions. 2013-11-18 19:20:09 -05:00
Eric Holk
50fb4be1cc Add Win64 calling convention. 2013-11-18 19:20:09 -05:00
Brian Anderson
85f107d8cb Use '..' as slice wildcard in vectors 2013-11-18 16:19:48 -08:00
bors
9062988610 auto merge of #10552 : michaelwoerister/rust/ifstepping, r=brson
This PR improves the single-stepping experience for if-expression (no more jumping into the *else* branch before entering the *then* branch, no more jumping to the end of the *else* branch after finishing the *then* branch). Unfortunately I don't know of a straight-forward way of writing automated tests for this. Suggestions welcome!
2013-11-18 15:26:29 -08:00
bors
6c8b702cf7 auto merge of #10539 : alexcrichton/rust/external-linkage, r=pcwalton
If a function is marked as external, then it's likely desired for use with some
native library, so we're not really accomplishing a whole lot by internalizing
all of these symbols.
2013-11-18 10:26:49 -08:00
Alex Crichton
4ddeef35e5 Don't mark reachable extern fns as internal
If a function is marked as external, then it's likely desired for use with some
native library, so we're not really accomplishing a whole lot by internalizing
all of these symbols.
2013-11-18 10:21:58 -08:00
Michael Woerister
d0872eb692 debuginfo: Improved stepping for if-expressions 2013-11-18 16:56:44 +01:00
bors
8eda5d8315 auto merge of #10443 : alexcrichton/rust/meaninless-pub-priv, r=cmr
Closes #10111
2013-11-17 22:21:23 -08:00
Alex Crichton
dab8fec4af Forbid privacy in inner functions
Closes #10111
2013-11-17 21:28:18 -08:00
Corey Richardson
ed34cd1e3c Better error message when using vectors in statics
Closes #10487
2013-11-17 18:35:52 -05:00
bors
5208332a1a auto merge of #10518 : huonw/rust/6911, r=alexcrichton
Bringing it into line with the unused-variable one,

    fn main() {
        let mut _a = 1;
    }

will not warn that `_a` is never used mutably.

Fixes #6911.
2013-11-17 06:21:47 -08:00
Huon Wilson
6bd8bb51a0 lint: _-prefixed variables don't get an unused-mut warning.
Bringing it into line with the unused-variable one,

    fn main() {
        let mut _a = 1;
    }

will not warn that `_a` is never used mutably.

Fixes #6911.
2013-11-16 22:20:42 +11:00
Corey Richardson
ab9e3a6652 Adjust error message for method type mismatch
Closes #10118, Closes #5925
2013-11-16 00:50:20 -05:00
Jaemin Moon
51bdec18b0 Show the name of the trait in the error message 2013-11-16 00:50:18 -05:00
bors
ade310cbb6 auto merge of #10018 : fhahn/rust/check-inferred-ints, r=alexcrichton
I've started working on this issue and pushed a small commit, which adds a range check for integer literals in `middle::const_eval` (no `uint` at the moment) 
At the moment, this patch is just a proof of concept, I'm not sure if there is a better function for the checks in `middle::const_eval`. This patch does not check for overflows after constant folding, eg:

    let x: i8 = 99 + 99;
2013-11-14 13:01:35 -08:00
bors
af62adfad0 auto merge of #9788 : geoffhill/rust/bare-fn-cast, r=pnkfelix
Bare functions are another example of a scalar but non-numeric
type (like char) that should be handled separately in casts.
This disallows expressions like `0 as extern "Rust" fn() -> int;`.

It might be advantageous to allow casts between bare functions
and raw pointers in unsafe code in the future, to pass function
pointers between Rust and C.

Closes #8728
2013-11-14 05:21:21 -08:00
bors
314d6f693f auto merge of #10277 : dcrewi/rust/missing-doc-and-visibility-rules, r=alexcrichton
Now the privacy pass returns enough information that other passes do not need to duplicate the visibility rules, and the missing_doc implementation is more consistent with other lint checks.
2013-11-13 10:16:29 -08:00
David Creswick
1f7eb4f9aa make missing_doc lint respect the visibility rules
Previously, the `exported_items` set created by the privacy pass was
incomplete. Specifically, it did not include items that had been defined
at a private path but then `pub use`d at a public path. This commit
finds all crate exports during the privacy pass. Consequently, some code
in the reachable pass and in rustdoc is no longer necessary. This commit
then removes the separate `MissingDocLintVisitor` lint pass, opting to
check missing_doc lint in the same pass as the other lint checkers using
the visibility result computed by the privacy pass.

Fixes #9777.
2013-11-13 11:31:59 -06:00
bors
3b0d48634f auto merge of #10427 : alexcrichton/rust/no-xray, r=brson
Just a few triage issues that I ran into.
2013-11-12 12:16:21 -08:00
bors
f1a67bd4c0 auto merge of #10423 : alexcrichton/rust/move-io, r=pcwalton
I still plan on reorganizing the internals of the IO module a bit, but this is the major move which has been on the horizon for awhile.
2013-11-12 11:01:24 -08:00
Florian Hahn
20627c7430 Check inferred integer literals for overflows, closes #4220 2013-11-12 19:36:46 +01:00
Florian Hahn
be09626148 Remove type overflow checks from check_const.rs, refs #4220
The checks are now handled by the linter
2013-11-12 19:35:55 +01:00
Alex Crichton
5fdbcc4020 Improve error message for breaks in blocks
Before it was always stated that it was a "break outside of a loop" when you
could very well be in a loop, but just in a block instead.

Closes #3064
2013-11-12 09:40:21 -08:00
bors
34035036e3 auto merge of #10198 : alexcrichton/rust/darwin-quiet, r=jdm
Instead of running dsymutil for all builds, this changes it to only run the program for debug builds.

Closes #3495
2013-11-11 22:56:07 -08:00
Alex Crichton
49ee49296b Move std::rt::io to std::io 2013-11-11 20:44:07 -08:00
bors
86787f8bef auto merge of #10109 : pcmattman/rust/pass-nonzero-exit-status-on-termination-by-signal, r=alexcrichton
The UvProcess exit callback is called with a zero exit status and non-zero termination signal when a child is terminated by a signal.

If a parent checks only the exit status (for example, only checks the return value from `wait()`), it may believe the process completed successfully when it actually failed.

Helpers for common use-cases are in `std::rt::io::process`.

Should resolve https://github.com/mozilla/rust/issues/10062.
2013-11-11 18:11:17 -08:00
Matthew Iselin
f698decf37 Implemented a ProcessExit enum and helper methods to std::rt::io::process for getting process termination status, or the signal that terminated a process.
A test has been added to rtio-processes.rs to ensure signal termination is picked up correctly.
2013-11-12 11:37:14 +10:00
bors
c0b7972f7d auto merge of #10422 : alexcrichton/rust/explicit-crate-map, r=pcwalton
As we start to move runtime components into the crate map, it's becoming harder
and harder to start the runtime from a C function as rust is embedded in another
application. Right now if you compile a rust crate as a dynamic library which is
then linked to another application, when using std::rt::start there are no I/O
local services, even though rustuv was linked against and requested. The reason
for this is that there is no top level crate map available specifying where to
find libuv I/O.

This option is not meant to be used regularly, but rather whenever compiling a
final library crate and linking it into another application. This lifts the
requirement that to get a crate map you must have the final destination be an
executable.
2013-11-11 16:11:22 -08:00
Alex Crichton
0cc5e6c83f Remove resolve's xray infrastructure
Since the removal of privacy from resolve, this flag is no longer necessary to
get the test runner working. All of the privacy checks are bypassed by a special
item attribute in the privacy visitor.

Closes #4947
2013-11-11 11:26:31 -08:00
Alex Crichton
7755ffd013 Remove #[fixed_stack_segment] and #[rust_stack]
These two attributes are no longer useful now that Rust has decided to leave
segmented stacks behind. It is assumed that the rust task's stack is always
large enough to make an FFI call (due to the stack being very large).

There's always the case of stack overflow, however, to consider. This does not
change the behavior of stack overflow in Rust. This is still normally triggered
by the __morestack function and aborts the whole process.

C stack overflow will continue to corrupt the stack, however (as it did before
this commit as well). The future improvement of a guard page at the end of every
rust stack is still unimplemented and is intended to be the mechanism through
which we attempt to detect C stack overflow.

Closes #8822
Closes #10155
2013-11-11 10:40:34 -08:00
Alex Crichton
2eb92b77a9 Add a flag to force generating toplevel crate map
As we start to move runtime components into the crate map, it's becoming harder
and harder to start the runtime from a C function as rust is embedded in another
application. Right now if you compile a rust crate as a dynamic library which is
then linked to another application, when using std::rt::start there are no I/O
local services, even though rustuv was linked against and requested. The reason
for this is that there is no top level crate map available specifying where to
find libuv I/O.

This option is not meant to be used regularly, but rather whenever compiling a
final library crate and linking it into another application. This lifts the
requirement that to get a crate map you must have the final destination be an
executable.
2013-11-11 09:26:24 -08:00
Alex Crichton
64afa4ea22 Only run dsymutil on OSX in debug builds
When there are no debug symbols generated, then the program just prints an
annoying warning otherwise.

Closes #10198
2013-11-10 13:58:11 -08:00
bors
3851f908d1 auto merge of #10367 : alexcrichton/rust/system-abi, r=nikomatsakis
This adds an other ABI option which allows a custom selection over the target
architecture and OS. The only current candidate for this change is that kernel32
on win32 uses stdcall, but on win64 it uses the cdecl calling convention.
Otherwise everywhere else this is defined as using the Cdecl calling convention.

cc #10049
Closes #8774
2013-11-09 12:26:12 -08:00
Alex Crichton
2fcc70ec9d Add a "system" ABI
This adds an other ABI option which allows a custom selection over the target
architecture and OS. The only current candidate for this change is that kernel32
on win32 uses stdcall, but on win64 it uses the cdecl calling convention.
Otherwise everywhere else this is defined as using the Cdecl calling convention.

cc #10049
Closes #8774
2013-11-09 11:16:09 -08:00