Commit Graph

32265 Commits

Author SHA1 Message Date
Daniel Micay
396f910617 heap: rm out-of-date FIXMEs 2014-09-15 15:28:25 -04: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
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
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
Eduard Burtescu
2094514049 hexfloat: fix fallout from using ptr::P. 2014-09-14 04:20:35 +03:00
Eduard Burtescu
9651d94a56 fourcc: fix fallout from using ptr::P. 2014-09-14 04:20:35 +03:00
Eduard Burtescu
9295454ff5 rustdoc: fix fallout from using ptr::P. 2014-09-14 04:20:34 +03:00
Eduard Burtescu
b06212864f rustc: fix fallout from using ptr::P. 2014-09-14 04:20:34 +03:00
bors
931b11549f auto merge of #17189 : bkoropoff/rust/extern-existing-crate, r=alexcrichton
When checking for an existing crate, compare against the `crate_metadata::name` field, which is the crate name which was requested during resolution, rather than the result of the `crate_metadata::name()` method, which is the crate name within the crate metadata, as these may not match when using the --extern option to `rustc`.

This fixes spurious "multiple crate version" warnings under the following scenario:

- The crate `foo`, is referenced multiple times
- `--extern foo=./path/to/libbar.rlib` is specified to rustc
- The internal crate name of `libbar.rlib` is not `foo`

The behavior surrounding `Context::should_match_name` and the comments in `loader.rs` both lead me to believe that this scenario is intended to work.

Fixes #17186
2014-09-14 00:51:05 +00:00
Eduard Burtescu
d379ad111c syntax: tests: fix fallout from using ptr::P. 2014-09-14 03:39:36 +03:00
Eduard Burtescu
ccd8498afb syntax: fix fallout from using ptr::P. 2014-09-14 03:39:36 +03:00
Eduard Burtescu
d6fb338d01 syntax: ast_map: use borrowed references into the AST. 2014-09-14 03:39:36 +03:00
Eduard Burtescu
9259b022f8 syntax: fold: use move semantics for efficient folding. 2014-09-14 03:39:35 +03:00
Eduard Burtescu
cccb6f84a3 syntax: ast: replace Gc<T> (previously @T) with P<T>. 2014-09-14 03:39:35 +03:00
Eduard Burtescu
1872c4c6b5 syntax: add a custom owned smart pointer in ptr::P. 2014-09-14 03:39:35 +03:00
bors
79a5448f41 auto merge of #17188 : thestinger/rust/tvec, r=pcwalton
`Box<[T]>` is created by allocating `Box<[T, ..n]>` and coercing it so
this code path is never used. It's also broken because it clamps the
capacity of the memory allocations to 4 elements and that's incompatible
with sized deallocation. This dates back to when `~[T]` was a growable
vector type implemented as:

*{ { tydesc, ref_count, prev, next }, { length, capacity, data[] } }

Since even empty vectors had to allocate, it started off the capacity of
all vectors at 4 as a heuristic. It's not possible to grow `Box<[T]>`
and there is no need for a memory allocation when it's empty, so it
would be a terrible heuristic today even if it worked.
2014-09-13 20:36:02 +00:00
bors
7277fe9ee7 auto merge of #17161 : vadimcn/rust/fix-debuginfo, r=alexcrichton
This PR fixes debuginfo tests on Windows.
2014-09-13 17:25:54 +00:00
bors
079951ed2a auto merge of #17187 : damag/rust/ffi-guide-fixes, r=alexcrichton
Updates the callbacks section to refer to the right function name and fixes a couple of minor whitespace issues in the examples.
2014-09-13 13:50:57 +00:00
bors
13475a0851 auto merge of #17182 : luqmana/rust/rnp, r=alexcrichton
Fixes #17120.
2014-09-13 11:25:59 +00:00
Patrick Walton
467bea04fa librustc: Forbid inherent implementations that aren't adjacent to the
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 {
            ...
        }
    }

Additionally, if you used the I/O path extension methods `stat`,
`lstat`, `exists`, `is_file`, or `is_dir`, note that these methods have
been moved to the the `std::io::fs::PathExtensions` trait. This breaks
code like:

    fn is_it_there() -> bool {
        Path::new("/foo/bar/baz").exists()
    }

Change this code to:

    use std::io::fs::PathExtensions;

    fn is_it_there() -> bool {
        Path::new("/foo/bar/baz").exists()
    }

Closes #17059.

RFC #155.

[breaking-change]
2014-09-13 02:07:39 -07:00
bors
90304ed266 auto merge of #17175 : pcwalton/rust/region-bounds-on-closures, r=huonw
This can break code like:

    fn call_rec(f: |uint| -> uint) -> uint {
        (|x| f(x))(call_rec(f))
    }

Change this code to use a temporary instead of violating the borrow
rules:

    fn call_rec(f: |uint| -> uint) -> uint {
        let tmp = call_rec(|x| f(x)); f(tmp)
    }

Closes #17144.

[breaking-change]

r? @huonw
2014-09-13 08:06:00 +00:00
bors
a9cf19889a auto merge of #17162 : sfackler/rust/decorator-traits, r=huonw
The other extension types already worked this way and it can be useful to track some state along with the extension.

I also removed the `BasicMacroExpander` and `BasicIdentMacroExpander` since the span inside of them was never used. The expander function types now directly implement the relevant trait.
2014-09-13 05:25:57 +00:00
Brian Koropoff
3da255d35a Add regression test for #17186 2014-09-12 18:09:47 -07:00
bors
ccae356ace auto merge of #17155 : steveklabnik/rust/dherman_fixes, r=brson
Fixing more suggestions from @dherman . I made them individual commits in case we want to discuss any of them further.
2014-09-12 23:30:54 +00:00
bors
8780d9c6b5 auto merge of #17134 : vberger/rust/lint_unused_extern_crate, r=alexcrichton
This PR creates a new lint : ``unused_extern_crate``, which do pretty much the same thing as ``unused_import``, but for ``extern crate`` statements. It is related to feature request #10385.

I adapted the code tracking used imports so that it tracks extern crates usage as well. This was mainly trial and error and while I believe all cases are covered, there might be some code I added that is useless (long compile times didn't give me the opportunity to check this in detail).

Also, I removed some unused ``extern crate`` statements from the libs, that where spotted by this new lint.
2014-09-12 19:05:53 +00:00
Valerii Hiora
b7514c08f3 Updated jemalloc 2014-09-12 17:25:44 +03:00
bors
9c68679f2e auto merge of #17069 : eddyb/rust/visitor, r=pnkfelix
Few visitors used the context passing feature and it can be easily emulated.
The added lifetime threading allows a visitor to keep safe references to AST
nodes it visits, making a non-owning ast_map design possible, for #13316.
2014-09-12 13:45:41 +00:00
Tobias Bucher
259930e2a3 Document why core::str::Searcher::new doesn't overflow 2014-09-12 15:03:50 +02:00
Eduard Burtescu
7ef6ff0669 Track the visited AST's lifetime throughout Visitor. 2014-09-12 14:24:45 +03:00
Eduard Burtescu
a09dbf28e6 Remove largely unused context from Visitor. 2014-09-12 14:24:45 +03:00
bors
e9278c9219 auto merge of #17159 : brson/rust/snaps, r=alexcrichton
This switches win64 hosts to bootstrap from win64 snaps.
2014-09-12 11:20:42 +00:00
Victor Berger
8e61612889 Removing unused extern crates. 2014-09-12 11:24:31 +02:00
Victor Berger
9f8ec427e5 New lint : unused_extern_crate. #10385 2014-09-12 11:24:31 +02:00
bors
22e749ded1 auto merge of #17145 : ahmedcharles/rust/unicode, r=alexcrichton 2014-09-12 08:05:42 +00:00
Daniel Micay
0fc06b14c5 remove dead and broken tvec ~[T] code path
`Box<[T]>` is created by allocating `Box<[T, ..n]>` and coercing it so
this code path is never used. It's also broken because it clamps the
capacity of the memory allocations to 4 elements and that's incompatible
with sized deallocation. This dates back to when `~[T]` was a growable
vector type implemented as:

*{ { tydesc, ref_count, prev, next }, { length, capacity, data[] } }

Since even empty vectors had to allocate, it started off the capacity of
all vectors at 4 as a heuristic. It's not possible to grow `Box<[T]>`
and there is no need for a memory allocation when it's empty, so it
would be a terrible heuristic today even if it worked.
2014-09-12 03:37:20 -04:00