Commit Graph

34710 Commits

Author SHA1 Message Date
Erick Tryzelaar
e20ea0b67d collections: dramatically speed up Vec::reserve with magic
Somehow llvm is able to optimize this version of Vec::reserve
into dramatically faster than the old version. In micro-benchmarks
this was 2-10 times faster. It also shaved 14 minutes off of
rust's compile times.

Closes #19281.
2014-12-05 11:29:41 -08:00
bors
4573da6f4f auto merge of #19334 : alexcrichton/rust/issue-19333, r=aturon
This may have inadvertently switched during the runtime overhaul, so this
switches TcpListener back to using sockets instead of file descriptors. This
also renames a bunch of variables called `fd` to `socket` to clearly show that
it's not a file descriptor.

Closes #19333
2014-12-05 15:03:18 +00:00
bors
52636007ce auto merge of #19362 : nikomatsakis/rust/crateification, r=nikomatsakis
This has the goal of further reducing peak memory usage and enabling more parallelism. This patch should allow trans/typeck to build in parallel. The plan is to proceed by moving as many additional passes as possible into distinct crates that lay alongside typeck/trans. Basically, the idea is that there is the `rustc` crate which defines the common data structures shared between passes. Individual passes then go into their own crates. Finally, the `rustc_driver` crate knits it all together.

cc @jakub-: One wrinkle is the diagnostics plugin. Currently, it assumes all diagnostics are defined and used within one crate in order to track what is used and what is duplicated. I had to disable this. We'll have to find an alternate strategy, but I wasn't sure what was best so decided to just disable the duplicate checking for now.
2014-12-05 09:23:09 +00:00
Alex Crichton
d6d4088bbf std: Close TcpListener with closesocket()
This may have inadvertently switched during the runtime overhaul, so this
switches TcpListener back to using sockets instead of file descriptors. This
also renames a bunch of variables called `fd` to `socket` to clearly show that
it's not a file descriptor.

Closes #19333
2014-12-05 00:49:31 -08:00
Niko Matsakis
602fc781ff Remove crates from test list so that we don't waste time building them. 2014-12-05 02:01:57 -05:00
Niko Matsakis
70c1463519 Fix various references in late-running tests and things 2014-12-05 01:52:18 -05:00
bors
361baabb07 auto merge of #19303 : nodakai/rust/libsyntax-reject-dirs, r=alexcrichton
On *BSD systems, we can `open(2)` a directory and directly `read(2)` from it due to an old tradition.  We should avoid doing so by explicitly calling `fstat(2)` to check the type of the opened file.

Opening a directory as a module file can't always be avoided.  Even when there's no "path" attribute trick involved, there can always be a *directory* named `my_module.rs`.

Incidentally, remove unnecessary mutability of `&self` from `io::fs::File::stat()`.
2014-12-05 00:22:58 +00:00
Niko Matsakis
14f9127d8a Delete diagnostics tests because that model doesn't scale to multiple crates 2014-12-04 16:34:13 -05:00
bors
d9c7c00b9a auto merge of #18980 : erickt/rust/reader, r=erickt
This continues the work @thestinger started in #18885 (which hasn't landed yet, so wait for that to land before landing this one). Instead of adding more methods to `BufReader`, this just allows a `&[u8]` to be used directly as a `Reader`. It also adds an impl of `Writer` for `&mut [u8]`.
2014-12-04 21:33:07 +00:00
Erick Tryzelaar
298b525951 core: fix a doctest 2014-12-04 07:57:13 -08:00
Niko Matsakis
5d19432679 FIXME(#19497) -- Stop messing around and just give rustc 32MB of stack unconditionally. This is prompted by some sort of bug in trans that causes a stack overflow when the modules in trans are made private. (In particular, the overflow can also be avoided by making controlflow and callee public, but that seems strictly worse than just using more stack.) 2014-12-04 10:04:52 -05:00
Niko Matsakis
61edb0ccb7 Separate the driver into its own crate that uses trans, typeck. 2014-12-04 10:04:52 -05:00
Niko Matsakis
93eb4333a0 Move typeck into its own crate. 2014-12-04 10:04:52 -05:00
Niko Matsakis
e135fa5b49 Remove dependencies on driver from trans et al. by moving various
structs out from driver and into other places.
2014-12-04 10:04:51 -05:00
Niko Matsakis
cc32f867d8 Modify libsyntax/diagnostics to not be so persnickety. The scheme
doesn't work in a multi-crate context. We'll need to come up with
something better.
2014-12-04 10:04:51 -05:00
Niko Matsakis
1e112e94c3 Move typeck logically in the module tree out to the root and clamp
down on its exports. Remove some dead code that is revealed.
2014-12-04 10:04:51 -05:00
Niko Matsakis
55470abe72 Remove one dependence on typeck from const_eval. 2014-12-04 10:04:51 -05:00
Niko Matsakis
00ca861f9d Remove "dependence" on typeck from comment in substs. 2014-12-04 10:04:51 -05:00
Niko Matsakis
9aeaaab334 Remove dependence on typeck from ppaux. 2014-12-04 10:04:51 -05:00
Niko Matsakis
adda9c1520 Remove dependency on typeck from lint. 2014-12-04 10:04:51 -05:00
Niko Matsakis
db75f8aa91 Move infer out of middle::typeck and into just middle. 2014-12-04 10:04:51 -05:00
Niko Matsakis
7c44561ad6 Move various data structures out of typeck and into ty. 2014-12-04 10:04:26 -05:00
bors
4053e82acb auto merge of #19170 : erickt/rust/rustup, r=erickt
This closes #19168.

Please be careful reviewing this since this gets used all over the place. I've tested all the options and everything appears to be working though.
2014-12-04 15:03:39 +00:00
bors
6d965cc2c9 auto merge of #19167 : japaric/rust/rhs-cmp, r=aturon
Comparison traits have gained an `Rhs` input parameter that defaults to `Self`. And now the comparison operators can be overloaded to work between different types. In particular, this PR allows the following operations (and their commutative versions):

- `&str` == `String` == `CowString`
- `&[A]` == `&mut [B]` == `Vec<C>` == `CowVec<D>` == `[E, ..N]` (for `N` up to 32)
- `&mut A` == `&B` (for `Sized` `A` and `B`)

Where `A`, `B`, `C`, `D`, `E` may be different types that implement `PartialEq`. For example, these comparisons are now valid: `string == "foo"`, and `vec_of_strings == ["Hello", "world"]`.

[breaking-change]s

Since the `==` may now work on different types, operations that relied on the old "same type restriction" to drive type inference, will need to be type annotated. These are the most common fallout cases:

- `some_vec == some_iter.collect()`: `collect` needs to be type annotated: `collect::<Vec<_>>()`
- `slice == &[a, b, c]`: RHS doesn't get coerced to an slice, use an array instead `[a, b, c]`
- `lhs == []`: Change expression to `lhs.is_empty()`
- `lhs == some_generic_function()`: Type annotate the RHS as necessary

cc #19148

r? @aturon
2014-12-04 12:02:56 +00:00
bors
53e8bd641a auto merge of #19449 : nikomatsakis/rust/unboxed-closure-fn-impl, r=pcwalton
Implement the `Fn` trait for bare fn pointers in the compiler rather
than doing it using hard-coded impls. This means that it works also
for more complex fn types involving bound regions.
2014-12-04 08:52:47 +00:00
Niko Matsakis
f2731ffb52 Adjust nits from pcwalton. 2014-12-04 01:49:42 -05:00
Niko Matsakis
64bf5a8687 Add a cache so we don't create so many shims. 2014-12-04 01:49:42 -05:00
Niko Matsakis
39221a013f Implement the Fn trait for bare fn pointers in the compiler rather than doing it using hard-coded impls. This means that it works also for more complex fn types involving bound regions. Fixes #19126. 2014-12-04 01:49:42 -05:00
bors
3c89031e1f auto merge of #18613 : steveklabnik/rust/ownership_guide, r=huonw
This is a work in progress, but this should get *extensive* review, so I'm putting it up early and often.

This is the start of a draft of the new 'ownership guide,' which explains ownership, borrowing, etc. I'm feeling better about this framing than last time's, but we'll see.
2014-12-04 04:52:37 +00:00
NODA, Kai
3980cdecd0 libstd: explicitly disallow io::fs::File to open a directory.
On *BSD systems, we can open(2) a directory and directly read(2) from
it due to an old tradition.  We should avoid doing so by explicitly
calling fstat(2) to check the type of the opened file.

Opening a directory as a module file can't always be avoided.
Even when there's no "path" attribute trick involved, there can always
be a *directory* named "my_module.rs".

Fix #12460

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-12-04 11:19:55 +08:00
NODA, Kai
805a06ca6a libstd: io::fs::File::stat() need not to take &mut self.
The same goes for sys::fs::FileDesc::fstat() on Windows.

Signed-off-by: NODA, Kai <nodakai@gmail.com>
2014-12-04 11:19:55 +08:00
bors
207a508411 auto merge of #18770 : pczarn/rust/hash_map-explicit-shrinking, r=Gankro
Part of enforcing capacity-related conventions, for #18424, the collections reform.

Implements `fn shrink_to_fit` for HashMap.
The `reserve` method now takes as an argument the *extra* space to reserve.
2014-12-04 01:07:48 +00:00
Erick Tryzelaar
f86737973a rustup: simplify downloading packages 2014-12-03 15:21:16 -08:00
Erick Tryzelaar
694500b07d rustup: extract the tarballs as part of installation 2014-12-03 15:20:24 -08:00
Erick Tryzelaar
bd8dac8f75 rustup: rewrite to protect against truncation
This closes #19168. It's possible that if the downloading of `rustup.sh`
is interrupted, bad things could happen, such as running a naked
"rm -rf /" instead of "rm -rf /path/to/tmpdir". This wraps rustup.sh's
functionality in a function that gets called at the last time that should
protect us from these truncation errors.
2014-12-03 15:18:52 -08:00
Erick Tryzelaar
8ca8e6fa4d rustup: factor out installing packages into a function 2014-12-03 15:17:36 -08:00
Erick Tryzelaar
b388dc61a5 rustup: factor out downloading and extracting the snapshot tarballs 2014-12-03 15:17:32 -08:00
bors
daa0745886 auto merge of #18749 : nikomatsakis/rust/builtin-bounds-like-other-traits, r=pcwalton
Treat builtin bounds like all other kinds of trait matches. Introduce a simple hashset in the fulfillment context to catch cases where we register the exact same obligation twice. This helps prevent duplicate error reports but also handles the recursive obligations created by builtin bounds.

r? @pcwalton 
cc @FlaPer87
2014-12-03 22:57:40 +00:00
Erick Tryzelaar
4f65d97bf8 rustup: factor out the install flags into a CFG_INSTALL_FLAGS variable 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
fcb31e8347 rustup: rename TMP_DIR to CFG_TMP_DIR 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
e688eb3b4f rustup: add a RUST_ prefix to the rust-specific variables 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
98f01f1f54 rustup: probe for the existance of tar 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
3b4ad726f1 rustup: make rustup executable 2014-12-03 14:40:33 -08:00
Erick Tryzelaar
c7ae4a9664 whitespace cleanup 2014-12-03 14:40:33 -08:00
bors
dbc379a66e auto merge of #19502 : alexcrichton/rust/issue-19501, r=sfackler
I don't have enough time to investigate this thoroughly, so for now let's get
the queue moving by ignoring this test.

cc #19501
2014-12-03 18:52:48 +00:00
Alex Crichton
719c36c9b9 test: Ignore issue-19501 pretty for now
I don't have enough time to investigate this thoroughly, so for now let's get
the queue moving by ignoring this test.

cc #19501
2014-12-03 09:22:13 -08:00
Jorge Aparicio
5cfac94201 Deprecate Equiv 2014-12-03 10:41:48 -05:00
Jorge Aparicio
09707d70a4 Fix fallout 2014-12-03 10:41:48 -05:00
Jorge Aparicio
eac635de01 Remove unused transmutes from tests 2014-12-03 10:41:48 -05:00
Jorge Aparicio
b32b24d13a Replace equiv method calls with == operator sugar 2014-12-03 10:41:48 -05:00