Commit graph

32306 commits

Author SHA1 Message Date
Aaron Turon
2ff07af996 Deprecate libnum in favor of rust-lang/num
This is part of the migration of crates into the Cargo ecosystem. There
is now an external repository https://github.com/rust-lang/num for bignums.

The single use of libnum elsewhere in the repository is for a shootout
benchmark, which is being moved into the external crate.

Due to deprecation, this is a:

[breaking-change]
2014-09-16 11:29:29 -07:00
bors
946654a721 auto merge of #17197 : nikomatsakis/rust/issue-5527-trait-reform-revisited, r=pcwalton
This patch does not make many functional changes, but does a lot of restructuring towards the goals of #5527. This is the biggest patch, basically, that should enable most of the other patches in a relatively straightforward way.

Major changes:

- Do not track impls through trans, instead recompute as needed.
- Isolate trait matching code into its own module, carefully structure to distinguish various phases (selection vs confirmation vs fulfillment)
- Consider where clauses in their more general form
- Integrate checking of builtin bounds into the  trait matching process, rather than doing it separately in kind.rs (important for opt-in builtin bounds)

What is not included:

- Where clauses are still not generalized. This should be a straightforward follow-up patch.
- Caching. I did not include much caching. I have plans for various kinds of caching we can do. Should be straightforward. Preliminary perf measurements suggested that this branch keeps compilation times roughly what they are.
- Method resolution. The initial algorithm I proposed for #5527 does not work as well as I hoped. I have a revised plan which is much more similar to what we do today.
- Deref vs deref-mut. The initial fix I had worked great for autoderef, but not for explicit deref. 
- Permitting blanket impls to overlap with specific impls. Initial plan to consider all nested obligations before considering an impl to match caused many compilation errors. We have a revised plan but it is not implemented here, should be a relatively straightforward extension.
2014-09-16 15:25:59 +00:00
bors
cdd46f8592 auto merge of #17245 : sfackler/rust/enumset-show, r=alexcrichton 2014-09-16 13:41:00 +00:00
bors
c09437ab2d auto merge of #17244 : spastorino/rust/patch-1, r=alexcrichton 2014-09-16 11:11:03 +00:00
bors
e6a3dabe43 auto merge of #17232 : untitaker/rust/patch-1, r=alexcrichton
The wording is correct if you consider that two of these lines were extracted from the original example. It still tripped me up while reading, so i just removed any reference to the linecount.
2014-09-16 09:26:03 +00:00
bors
3212d70302 auto merge of #17280 : thestinger/rust/heap, r=pcwalton 2014-09-16 04:56:01 +00:00
bors
f8426e2e21 auto merge of #17288 : alexcrichton/rust/change-snap, r=brson
I'm rotating in some CentOS 5.10 bots so we *actually* build on Linux 2.6.18
like we advertise doing so. Currently the snapshots are incompatible with CentOS
5.10 due to snapshots requiring glibc 2.6 and CentOS 5.10 having glibc 2.5.

It turns out that rustc only requires *one* symbol from glibc 2.6, which is
`futimens`. The rust distribution itself does not use this symbol, but LLVM
conditionally detects it and then uses it. This symbol isn't even called as part
of the compilation process, so we don't even need it!

The new snapshot was generated following these instructions [1]:

1. Download the current x86_64 linux snapshot and unpack it.
2. Open the rustc binary in a hex editor.
3. Change the linkage against glibc 2.6 from strong to *weak*
4. Write changes and re-run src/etc/make-snapshot.py
5. Upload new tarball to S3

On CentOS 5.10 a warning is printed each time the snapshot runs that the symbol
cannot be found (anyone with glibc 2.6+ does not have this warning printed). The
key part is that we can *bootstrap* on CentOS 5.10 at this point. The next
snapshot will be naturally compatible with glibc 2.3 (even older!) and will not
need to be manually edited.

[1]: http://jamesbond3142.no-ip.org/wiki/wiki.cgi/NewAppsOnOldGlibc
2014-09-16 02:26:01 +00:00
Alex Crichton
ba0c100f3b Change the last linux 64-bit snapshot
I'm rotating in some CentOS 5.10 bots so we *actually* build on Linux 2.6.18
like we advertise doing so. Currently the snapshots are incompatible with CentOS
5.10 due to snapshots requiring glibc 2.6 and CentOS 5.10 having glibc 2.5.

It turns out that rustc only requires *one* symbol from glibc 2.6, which is
`futimens`. The rust distribution itself does not use this symbol, but LLVM
conditionally detects it and then uses it. This symbol isn't even called as part
of the compilation process, so we don't even need it!

The new snapshot was generated following these instructions [1]:

1. Download the current x86_64 linux snapshot and unpack it.
2. Open the rustc binary in a hex editor.
3. Change the linkage against glibc 2.6 from strong to *weak*
4. Write changes and re-run src/etc/make-snapshot.py
5. Upload new tarball to S3

On CentOS 5.10 a warning is printed each time the snapshot runs that the symbol
cannot be found (anyone with glibc 2.6+ does not have this warning printed). The
key part is that we can *bootstrap* on CentOS 5.10 at this point. The next
snapshot will be naturally compatible with glibc 2.3 (even older!) and will not
need to be manually edited.

[1]: http://jamesbond3142.no-ip.org/wiki/wiki.cgi/NewAppsOnOldGlibc
2014-09-15 18:14:26 -07:00
Niko Matsakis
eafeb335a0 Update docs to include Sized trait, which is needed 2014-09-15 18:52:20 -04:00
Daniel Micay
d206f05132 remove the closure_exchange_malloc lang item 2014-09-15 18:16:33 -04:00
bors
63eaba24d6 auto merge of #17221 : bkoropoff/rust/strinterner-unsafe, r=sfackler
The `StrInterner::clear()` method takes self immutably but can invalidate references returned by `StrInterner::get_ref`. Since `get_ref` is unused, just remove it.

Closes #17181
2014-09-15 21:56:00 +00:00
Daniel Micay
84b37374bf heap: optimize EMPTY to avoid relocations
Sized deallocation makes it pointless to provide an address that never
overlaps with pointers returned by an allocator. Code can branch on the
capacity of the allocation instead of a comparison with this sentinel.

This improves the situation in #8859, and the remaining issues are only
from the logging API, which should be disabled by default in optimized
release builds anyway along with debug assertions. The remaining issues
are part of #17081.

Closes #8859
2014-09-15 16:48:20 -04:00
Daniel Micay
396f910617 heap: rm out-of-date FIXMEs 2014-09-15 15:28:25 -04:00
Niko Matsakis
48bc291a80 silence various warnings in stdlib, no idea why they suddenly started 2014-09-15 15:28:12 -04:00
Niko Matsakis
a2b95624fd add Send bound on impl because stricter trait checking requires it 2014-09-15 15:28:12 -04:00
Niko Matsakis
5ba0196cb8 misc ppaux changes 2014-09-15 15:28:12 -04:00
Niko Matsakis
688ddf7915 typeck/kind -- stop using old trait framework.
- Unify the "well-formedness" checking that typeck was already doing with what
  was taking place in kind.
- Move requirements that things be sized into typeck.
- I left the checking on upvars in kind, though I think it should eventually be
  refactored into regionck (which would perhaps be renamed).

This reflects a general plan to convert typeck so that it registers
obligations or other pending things for conditions it cannot check
eventually. This makes it easier to identify all the conditions that
apply to an AST expression, but can also influence inference in somec
cases (e.g., `Send` implies `'static`, so I already had to promote a lot
of the checking that `kind.rs` was doing into typeck, this branch just
continues the process).
2014-09-15 15:28:12 -04:00
Niko Matsakis
088c94ae96 trans -- stop tracking vtables precisely, instead recompute as needed. 2014-09-15 15:28:12 -04:00
Niko Matsakis
6349a61231 Port coherence to use the new trait matching code 2014-09-15 15:28:12 -04:00
bors
382fc45759 auto merge of #17199 : jakub-/rust/issues-that-need-tests, r=alexcrichton
Closes #7813.
Closes #10902.
Closes #11374.
Closes #11714.
Closes #12920.
Closes #13202.
Closes #13624.
Closes #14039.
Closes #15730.
Closes #15783.
2014-09-15 19:10:55 +00:00
Niko Matsakis
c5754f3971 Guts of the new trait matching algorithm, not yet in use 2014-09-15 14:58:49 -04:00
Niko Matsakis
713cf373c1 Take core as a dependency on librlibc. This is needed so that it can
see the lang-items for Sized etc. @acrichto and @thestinger had no
objections.
2014-09-15 14:58:49 -04:00
Niko Matsakis
b88f86782e Update error messages in compile-fail tests 2014-09-15 14:58:49 -04:00
bors
a8d478db51 auto merge of #17208 : kmcallister/rust/llvm-diagnostics, r=thestinger
I would like to map this information back to AST nodes, so that we can print remarks with spans, and so that remarks can be enabled on a per-function basis.  Unfortunately, doing this would require a lot more code restructuring — for example, we currently throw away the AST map and lots of other information before LLVM optimizations run.  So for the time being, we print the remarks with debug location strings from LLVM.  There's a warning if you use `-C remark` without `--debuginfo`.

Fixes #17116.
2014-09-15 16:56:03 +00:00
Jakub Wieczorek
8a4ef62570 Add tests for a few A-needstest issues
Closes #7813.
Closes #10902.
Closes #11374.
Closes #11714.
Closes #12920.
Closes #13202.
Closes #13624.
Closes #14039.
Closes #15730.
Closes #15783.
2014-09-15 18:09:24 +02:00
bors
8e2860407b auto merge of #16887 : steveklabnik/rust/guide_iterators, r=alexcrichton
This isn't ready to merge yet.

The 'containers and iterators' guide is basically just a collection of stuff that should be in the module definitions. So I'm moving the guide to just an 'iterators' guide, and moved the info that was there into the right places.

So, is this a good path forward, and is all of the information still correct?
2014-09-15 15:11:12 +00:00
bors
e73156fe32 auto merge of #17200 : brson/rust/wintrip-w64, r=cmr
This updates our build system to prefer `i686-w64-mingw32` as the 32-bit windows triple instead of `i686-pc-mingw32`. This is an interim step to make the build artifacts consistent until https://github.com/rust-lang/rust/issues/15717 is done.
2014-09-15 12:56:13 +00:00
bors
1f5ee97184 auto merge of #17192 : skade/rust/fix-osx-linking, r=alexcrichton
Don't pass -fno-use-linker-plugin on OS X as clang does not accept it.

clang fails linking with:

```
error: linking with `cc` failed: exit code: 1
... arg list omitted...
note: clang: error: unknown argument: '-fno-use-linker-plugin' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
```

clang version:

```
$ clang -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
```
2014-09-15 09:56:11 +00:00
bors
3e7e2af472 auto merge of #17256 : alexcrichton/rust/issue-17183, r=sfackler
This file is touched during the build process and will trigger more rebuilds
than necessary.

Closes #17183
2014-09-15 07:06:09 +00:00
Florian Gilcher
e9c4efb1bf Only pass -fno-use-linker-plugin on Windows
Only pass -fno-use-linker-plugin on Windows where it avoids pulling in
dependencies. Passing it to clang on OS X and Linux would make it fail
though.
2014-09-15 07:12:52 +02:00
bors
e4771d142b auto merge of #16853 : tbu-/rust/pr_mapinplace, r=aturon
This is implemented using a new struct PartialVec which implements the proper
drop semantics in case the conversion is interrupted by an unwind.

For the old pull requests, see #15302, #16369.
2014-09-15 04:46:13 +00:00
Alex Crichton
134c1e954e mk: Don't depend on src/jemalloc/VERSION
This file is touched during the build process and will trigger more rebuilds
than necessary.

Closes #17183
2014-09-14 14:42:45 -07:00
Tobias Bucher
2c7f6eee0c Fixed map_in_place tests after rustc upgrade
This replaces the now obsolete syntax `&[]` with `[].as_slice()`.
2014-09-14 21:35:49 +02:00
Tobias Bucher
7ccab3ae8a Added missing } from map_in_place rebase 2014-09-14 21:35:49 +02:00
Tobias Bucher
79427f0bc0 Remove the unused Iterator implementation of the private PartialVec 2014-09-14 21:35:49 +02:00
Tobias Bucher
b7e0969a49 Minimize the public interface and rename it to map_in_place 2014-09-14 21:35:48 +02:00
Tobias Bucher
5efa232160 Check that the min_align_of the both types in a PartialVec matches
This is important because the underlying allocator of the `Vec` passes that
information to the deallocator which needs the guarantee that it is the same
parameters that were also passed to the allocation function.
2014-09-14 21:35:48 +02:00
Tobias Bucher
23f2c78d21 Fix some of the issues mentioned in the PR on Github
This specifically includes:
- Fix of the tests
- Remove `transmute` between `Vec`s of different types
2014-09-14 21:35:48 +02:00
Tobias Bucher
af293372e4 PartialVec: Remove TODOs and rename unwrap to into_vec 2014-09-14 21:35:48 +02:00
Tobias Bucher
dbc3cb3a54 Add support for in-place map for Vecs of types with same size
This is implemented using a new struct `PartialVec` which implements the proper
drop semantics in case the conversion is interrupted by an unwind.
2014-09-14 21:35:48 +02:00
bors
793a36617b auto merge of #17196 : vhbit/rust/jemalloc-update, r=thestinger
Fixes #17168
2014-09-14 12:56:05 +00:00
bors
21d1f4d7c0 auto merge of #17195 : tbu-/rust/pr_strfindoverflow2, r=alexcrichton 2014-09-14 10:36:08 +00:00
bors
13037a3727 auto merge of #17163 : pcwalton/rust/impls-next-to-struct, r=alexcrichton
type they provide an implementation for.

This breaks code like:

    mod foo {
        struct Foo { ... }
    }

    impl foo::Foo {
        ...
    }

Change this code to:

    mod foo {
        struct Foo { ... }

        impl Foo {
            ...
        }
    }

Closes #17059.

RFC #155.

[breaking-change]

r? @brson
2014-09-14 08:11:04 +00:00
bors
0f99abae9c auto merge of #17130 : jakub-/rust/issue-17033, r=pcwalton
Fixes #17033.
Fixes #15965.

cc @nikomatsakis
2014-09-14 05:46:05 +00:00
bors
19311b6103 auto merge of #13316 : eddyb/rust/ast-ptr, r=brson
Replaces Gc<T> in the AST with a custom owned smart pointer, P<T>. Fixes #7929.

## Benefits
* **Identity** (affinity?): sharing AST nodes is bad for the various analysis passes (e.g. one could bypass borrowck with a shared `ExprAddrOf` node taking a mutable borrow), the only reason we haven't hit any serious issues with it is because of inefficient folding passes which will always deduplicate any such shared nodes. Even if we were to switch to an arena, this would still hold, i.e. we wouldn't just use `&'a T` in the AST, but rather an wrapper (`P<'a, T>`?).

* **Immutability**: `P<T>` disallows mutating its inner `T` (unless that contains an `Unsafe` interior, which won't happen in the AST), unlike `~T`.

* **Efficiency**: folding can reuse allocation space for `P<T>` and `Vec<T>`, the latter even when the input and output types differ (as it would be the case with arenas or an AST with type parameters to toggle macro support). Also, various algorithms have been changed from copying `Gc<T>` to using `&T` and iterators.

* **Maintainability**: there is another reason I didn't just replace `Gc<T>` with `~T`: `P<T>` provides a fixed interface (`Deref`, `and_then` and `map`) which can remain fully functional even if the implementation changes (using a special thread-local heap, for example). Moreover, switching to, e.g. `P<'a, T>` (for a contextual arena) is easy and mostly automated.
2014-09-14 03:21:07 +00:00
Santiago Pastorino
f8bbf6d0e1 rustc main.rs generates main binary file 2014-09-13 22:25:38 -03:00
Eduard Burtescu
8577343f9e Fix fallout in macro_crate/quote tests. 2014-09-14 04:20:36 +03:00
Eduard Burtescu
5b2837b918 syntax: document the ptr module. 2014-09-14 04:20:36 +03:00
Eduard Burtescu
f8df4fadc8 syntax: implement in-place folding of P<T> and Vec<T>. 2014-09-14 04:20:35 +03:00
Eduard Burtescu
946bb4b10b regex_macros: fix fallout from using ptr::P. 2014-09-14 04:20:35 +03:00