Commit Graph

34786 Commits

Author SHA1 Message Date
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
Alexander Light
87235687a1 Add ability to use custom alloc::heap::imp
Adds the ability to use a custom allocator heap by passing either --cfg
external_crate and --extern external=<allocator_crate_name> or --cfg
external_funcs and defining the allocator functions prefixed by 'rust_'
somewhere.

This is useful for many reasons including OS/embedded development, and
allocator development and testing.
2014-12-04 16:23:29 -05:00
Adolfo Ochagavía
fdb0d9026e Remove reduntant compile-fail test
Fixes https://github.com/rust-lang/rust/issues/19510
2014-12-04 20:56:44 +01:00
Aaron Liblong
0d3c415617 Add capacity() to VecMap
Changed capacity() tag to unstable and fixed doc assert
2014-12-04 13:21:43 -05:00
Steve Klabnik
010cbd011a Tasks aren't actually lightweight :frown:
Fixes #19402.
2014-12-04 11:43:22 -05:00
Steve Klabnik
f0f7a90068 Some small copy edits to the guide.
Fixes #19335.
2014-12-04 11:39:13 -05: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
Austin Bonander
2e1911b47a core::iter::Unfold: reword docs and add example
Remove note about core
2014-12-04 01:28:16 -08:00
Chase Southwood
cddbb6a75b DerefMut should be for Sized? 2014-12-04 03:10:58 -06: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
Steven Fackler
e7c1f57d6c Back io::stdin with a global singleton BufferedReader
io::stdin returns a new `BufferedReader` each time it's called, which
results in some very confusing behavior with disappearing output. It now
returns a `StdinReader`, which wraps a global singleton
`Arc<Mutex<BufferedReader<StdReader>>`. `Reader` is implemented directly
on `StdinReader`. However, `Buffer` is not, as the `fill_buf` method is
fundamentaly un-thread safe. A `lock` method is defined on `StdinReader`
which returns a smart pointer wrapping the underlying `BufferedReader`
while guaranteeing mutual exclusion.

Code that treats the return value of io::stdin as implementing `Buffer`
will break. Add a call to `lock`:

```rust
io::stdin().lines()
// =>
io::stdin().lock().lines()
```

Closes #14434

[breaking-change]
2014-12-03 23:18:52 -08: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
Kang Seonghoon
a12b83996e rustdoc: Do not deduplicate items when their parents differ.
Fixes #17332.
2014-12-04 13:52:23 +09:00
Kang Seonghoon
4b271f3f64 rustdoc: Preserve query/fragment in redirects whenever possible.
We heavily rely on queries and fragments in the URL structure, so
it is desired to preserve them even in the redirects. The generated
redirect pages try to preserve them with scripts, which take
precedence over the original `Refresh` metadata. Non-scripting
browsers would continue to work (with no queries and fragments).
2014-12-04 12:48:16 +09: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
P1start
108bca53f0 Make the parser’s ‘expected <foo>, found <bar>’ errors more accurate
As an example of what this changes, the following code:

    let x: [int ..4];

Currently spits out ‘expected `]`, found `..`’. However, a comma would also be
valid there, as would a number of other tokens. This change adjusts the parser
to produce more accurate errors, so that that example now produces ‘expected one
of `(`, `+`, `,`, `::`, or `]`, found `..`’.
2014-12-04 13:47:35 +13: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
Corey Richardson
2e1a50121e syntax: support ES6-style unicode escapes
First half of bootstrapping https://github.com/rust-lang/rfcs/pull/446
2014-12-03 15:10:51 -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
Alexander Light
e621116b86 make fmt_macros and rustdoc have standard doc attributes 2014-12-03 12:49:59 -05:00