Commit graph

32404 commits

Author SHA1 Message Date
Steven Fackler
0e8cc52311 Properly implement Show for EnumSet 2014-09-13 17:37:03 -07:00
Brian Koropoff
5857ec6d78 Fix issue #17216
The cleanup scope of for loop bindings should translated when
popped to ensure resources are not leaked.
2014-09-13 15:35:21 -07: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
Steve Klabnik
1b818020a0 Remove container guide.
This isn't really what guides are for, this information belongs in the
module-level docs.

Fixes #9314.
2014-09-13 15:06:00 -04:00
Steve Klabnik
84030fd05a Move info into individual modules. 2014-09-13 15:05:56 -04: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
Markus Unterwaditzer
d36ac4def5 These two lines are actually three. 2014-09-13 15:16:59 +02: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
Tshepang Lekhonkhobe
46e3014ce0 doc: that felt like it needed a stronger break than what comma provides
Remove trailing whitespace while at it
2014-09-13 09:40:30 +02: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
Peter Atashian
bcad3a5816 Improve memory usage of libsyntax
Replaces some usage of `.to_string()` with `.into_string()`

Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-09-13 01:13:59 -04:00
Brian Koropoff
26d716a500 Remove unused, unsound method on StrInterner
The string slices returned by `get_ref` can actually be
invalidated by calling `clear`.  Since this method is unused,
it is easiest to simply remove it.

Closes #17181
2014-09-12 21:52:56 -07: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
Keegan McAllister
ad9a1daa81 Add -C remark for LLVM optimization remarks
Fixes #17116.
2014-09-12 11:46:38 -07:00
Keegan McAllister
225353d8bb Add a Rust string ostream for LLVM 2014-09-12 11:46:38 -07:00
Keegan McAllister
77b3a7ba8b Fix bad error message copypasta 2014-09-12 11:46:38 -07:00
Brian Anderson
1324a37795 Remove build system support for i686-pc-mingw32 triple in favor if i686-w64-mingw32 2014-09-12 10:46:31 -07: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
Damien Grassart
d4b2edc3ee Use a space after colons per the Rust coding style:
https://github.com/rust-lang/rust-guidelines/blob/master/style/whitespace.md
2014-09-12 09:10:03 +02:00
Damien Grassart
0eedec560c The example code uses trigger_callback(), not do_callback(). 2014-09-12 09:03:15 +02:00
Brian Koropoff
957229c215 Fix check for existing crate when using --extern
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-11 23:10:44 -07:00
Brian Koropoff
f9888ac339 Make debug message about resolving extern crate statements more helpful 2014-09-11 22:49:41 -07:00
bors
805cf81b77 auto merge of #17112 : nick29581/rust/unsized-fields, r=nikomatsakis
closes #16977 

r? @nikomatsakis
2014-09-12 03:35:38 +00:00
Luqman Aden
a152d5fced librustc: Enum nullable pointer opt should not apply to raw pointers. 2014-09-11 21:58:01 -04:00
bors
4727381685 auto merge of #16657 : steveklabnik/rust/goodbye_tutorial, r=brson
The Guide isn't 100% perfect, but it's basically complete. It's
certainly better than the tutorial is. Time to start pointing more
people its way.

I also just made it consistent to call all things 'guides' rather than
tutorials.

Fixes #9874. This is the big one.

And two bugs that just go away.

Fixes #14503.
Fixes #15009.
2014-09-12 01:15:41 +00:00
Brian Anderson
0af2bb5fbe mk: Fix defs for i686-w64-mingw32 2014-09-11 18:01:07 -07:00
Ahmed Charles
5b3c3511c9 Fix bug in padding unicode, #17105. 2014-09-11 17:40:46 -07:00
bors
06c0b1d28a auto merge of #16957 : vadimcn/rust/package-gcc, r=brson
Package rustc's mingw dependencies into Windows installer to avoid requiring a separate mingw install.

Closes #11782
2014-09-11 21:55:42 +00:00
Nick Cameron
4028ebc603 Handle always-unsized structs
closes #16977
2014-09-12 09:16:05 +12:00
Steve Klabnik
c456cca90a only deprecate the guide rather than 🔥 🔥 🔥 2014-09-11 16:21:32 -04:00
Steve Klabnik
a99ba25f2b Replace the Tutorial with the Guide.
The Guide isn't 100% perfect, but it's basically complete. It's
certainly better than the tutorial is. Time to start pointing more
people its way.

I also just made it consistent to call all things 'guides' rather than
tutorials.

Fixes #9874. This is the big one.

And two bugs that just go away.

Fixes #14503.
Fixes #15009.
2014-09-11 16:21:32 -04:00
Patrick Walton
a9b929dbb6 librustc: Make sure region bounds on closures outlive calls to them.
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]
2014-09-11 12:00:56 -07:00
bors
d24c82420b auto merge of #17154 : steveklabnik/rust/array_clarification, r=huonw
fixes #17148
2014-09-11 18:50:41 +00:00
Vadim Chugunov
7085b3edd9 Package rustc's mingw dependencies into Windows installer.
gcc, ld, ar, dlltool, windres go into $(RUST)/bin/rustlib/<triple>/bin/
platform libraries and startup objects got into $(RUST)/bin/rustlib/<triple>/lib/
2014-09-11 09:40:21 -07:00
Vadim Chugunov
0ac9e9b561 Update license notice. 2014-09-11 09:40:20 -07:00
Vadim Chugunov
c05ba8a298 Append target-specific tools directory ($(RUST)/bin/rustlib/<triple>/bin/) to PATH during linking,
so that rustc can invoke them.
2014-09-11 09:40:20 -07:00