Commit Graph

34263 Commits

Author SHA1 Message Date
Alex Crichton
bb5f03b900 mk: Add -C prefer-dynamic to stage3 libs
Right now the windows nightlies are failing because they're encountering a
linker error when producing stage3 libs. The stage3 libs aren't actually used in
general, and we primarily just want to generate a static stage3 binary, not
static stage3 dylibs.
2014-11-06 11:29:49 -08:00
qwitwa
31ce92d910 14.3 - helpfully implied code sample is broken
As a new user, I spent a while confused when flycheck told me the code sample I'd typed in was invalid. I ended up figuring out some of what comes after the code sample more painfully by myself because there was no indication that it was broken in the text beforehand. This one line change makes it clear that the code following it is an experiment that may not work rather than something to assume just works.
2014-11-06 19:25:00 +00:00
Jorge Aparicio
5272e6c4c6 Add tests 2014-11-06 14:14:31 -05:00
Brandon Sanderson
d80a62d84b Fix soundness hole in struct with expressions.
Fixes #18567. Struct{x:foo, .. with_expr} did not walk with_expr, which allowed
using moved variables in some cases.  The CFG for structs also built up with
with_expr happening before the fields, which is now reversed. (Fields are now
before the with_expr in the CFG)
2014-11-06 10:42:40 -08:00
Jorge Aparicio
73b86e4778 Implement Default for Box<[T]> 2014-11-06 13:10:20 -05:00
Jorge Aparicio
679eb9191d DTSify libserialize traits
- ToBase64
- FromBase64
- ToHex
- FromHex
- ToJson
- Encodable
2014-11-06 13:08:24 -05:00
Steve Klabnik
c4fe781763 link to raw string docs in libregex docs
Fixes #17023
2014-11-06 12:49:04 -05:00
Fabrice Desré
f230e788e0 Fix a couple of build warnings 2014-11-06 09:37:54 -08:00
Alexis Beingessner
eec145be3f Fallout from collection conventions 2014-11-06 12:26:08 -05:00
Alexis Beingessner
cf3b2e4fe6 Implement low-hanging fruit of collection conventions
* Renames/deprecates the simplest and most obvious methods
* Adds FIXME(conventions)s for outstanding work
* Marks "handled" methods as unstable

NOTE: the semantics of reserve and reserve_exact have changed!
Other methods have had their semantics changed as well, but in a
way that should obviously not typecheck if used incorrectly.

Lots of work and breakage to come, but this handles most of the core
APIs and most eggregious breakage. Future changes should *mostly* focus on
niche collections, APIs, or simply back-compat additions.

[breaking-change]
2014-11-06 12:25:44 -05:00
bors
8ed288edb2 auto merge of #18559 : aturon/rust/prelude_cleanup, r=alexcrichton
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses.

The renamings are consistent with the [new `-Prelude` suffix](https://github.com/rust-lang/rfcs/pull/344). There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules.

Because this renames traits, it is a:

[breaking-change]

However, I do not expect any code that currently uses the standard library to actually break.

Closes #17917
2014-11-06 16:52:09 +00:00
Aaron Turon
cfafc1b737 Prelude: rename and consolidate extension traits
This commit renames a number of extension traits for slices and string
slices, now that they have been refactored for DST. In many cases,
multiple extension traits could now be consolidated. Further
consolidation will be possible with generalized where clauses.

The renamings are consistent with the [new `-Prelude`
suffix](https://github.com/rust-lang/rfcs/pull/344). There are probably
a few more candidates for being renamed this way, but that is left for
API stabilization of the relevant modules.

Because this renames traits, it is a:

[breaking-change]

However, I do not expect any code that currently uses the standard
library to actually break.

Closes #17917
2014-11-06 08:03:18 -08:00
tshakah
00ae767609 Update guide.md
Corrected singular/plural reference to enums
2014-11-06 15:19:00 +00:00
Steve Klabnik
d108613ba0 expand description of the link attribute
Fixes #18288
2014-11-06 10:13:29 -05:00
Vitali Haravy
461945ee9e Correct building documenation with Pandoc and TeX on Windows. 2014-11-06 18:08:33 +03:00
bors
60a669a174 auto merge of #18608 : alexcrichton/rust/lint-some-crates, r=aturon
This commit adds support for linting `extern crate` statements for stability
attributes attached to the crate itself. This is likely to be the mechanism used
to deny access to experimental crates that are part of the standard
distribution.

cc #18585 

r? @aturon
2014-11-06 14:06:59 +00:00
Subhash Bhushan
2cde618b17 Make Filetype Clonable 2014-11-06 19:17:50 +05:30
klutzy
fdf5195f58 std::rand::OsRng: Use getrandom syscall on Linux
`getrandom(2)` system call [1] has been added on Linux 3.17.
This patch makes `OsRng` use `getrandom` if available, and use
traditional `/dev/urandom` fallback if not.

[1]:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c6e9d6f38894798696f23c8084ca7edbf16ee895
2014-11-06 22:01:31 +09:00
Niko Matsakis
d0fa4c6239 Remove the unboxed closure |:| notation from types and trait references completely. 2014-11-06 06:48:24 -05:00
Niko Matsakis
221edbae38 Support parenthesized paths Foo(A,B) -> C that expand to Foo<(A,B),C>. These paths also bind anonymous regions (or will, once HRTB is fully working).
Fixes #18423.
2014-11-06 06:48:23 -05:00
Niko Matsakis
4e352892c8 Restructure parsing of paths, which is quite tortured 2014-11-06 06:48:23 -05:00
bors
e84e7a00dd auto merge of #18467 : japaric/rust/eq, r=alexcrichton
`eq`, `ne`, `cmp`, etc methods now require one less level of indirection when dealing with `&str`/`&[T]`

``` rust
"foo".ne(&"bar") -> "foo".ne("bar")
slice.cmp(&another_slice) -> slice.cmp(another_slice)
// slice and another_slice have type `&[T]`
```

[breaking-change]
2014-11-06 08:06:50 +00:00
Nathan Zadoks
dddef44a6b Make x86_64-unknown-linux-gnu.json true to its name 2014-11-06 06:37:40 +01:00
Daniel Micay
cfae691e46 fix typo in librustc target spec 2014-11-06 00:17:56 -05:00
bors
0e2f9b9485 auto merge of #18388 : nikomatsakis/rust/fn-trait-hierarchy, r=acrichto
Add blanket impls to allow the various `Fn` traits to be interconverted.

Fixes #18387.
2014-11-06 04:21:49 +00:00
Niko Matsakis
cf753a2dc7 Correct tests that were supposed to fail but now pass due to the fn trait hierarchy. 2014-11-05 22:01:30 -05:00
Niko Matsakis
ff361530b5 Partial fix for #17901: Be less conservative around unbound type
variables in the intracrate case. This requires a deeper distinction
between inter- and intra-crate so as to keep coherence working.

I suspect the best fix is to generalize the recursion check that
exists today, but this requires a bit more refactoring to achieve.

(In other words, where today it says OK for an exact match, we'd want
to not detect exact matches but rather skolemize each trait-reference
fresh and return AMBIG -- but that requires us to make builtin bounds
work shallowly like everything else and move the cycle detection into
the fulfillment context.)
2014-11-05 22:01:30 -05:00
Niko Matsakis
f791473937 Reverse order of lookup 2014-11-05 22:01:30 -05:00
Niko Matsakis
680d579ff0 Add blanket impls to allow the various Fn traits to be interconverted.
Fixes #18387.
2014-11-05 22:01:29 -05:00
Brian Anderson
f383ce62e8 rustc: Add some more checks to the stability lint
This catches uses of unstable traits in

```
trait Foo: UnstableTrait { }
```

and

```
impl UnstableTrait for Foo { }
```
2014-11-05 17:35:40 -08:00
Jorge Aparicio
11f4baeafb Fix tests 2014-11-05 20:13:25 -05:00
Jorge Aparicio
6216822249 Add test for the first half of issue #15689
cc #15689
2014-11-05 20:13:12 -05:00
Jorge Aparicio
4c3b42271b DSTify Box<T> implementation of PartialEq, PartialOrd, Eq, Ord 2014-11-05 20:13:08 -05:00
Jorge Aparicio
1e5f311d16 Fix fallout of DSTifying PartialEq, PartialOrd, Eq, Ord 2014-11-05 20:12:14 -05:00
Jorge Aparicio
2896278313 DSTify PartialEq, PartialOrd, Eq, Ord 2014-11-05 20:12:00 -05:00
Jorge Aparicio
1a94375426 Fix fallout of changing the expansion of #[deriving(PartialEq)] 2014-11-05 20:11:54 -05:00
Jorge Aparicio
88ed2d1c41 Use operator sugar in the expansion of #[deriving(PartialEq)] 2014-11-05 20:11:14 -05:00
Vitali Haravy
bec2ee77f7 Properly escape paths to executables. Fixes #18632. 2014-11-05 23:33:18 +00:00
bors
63c4f22f2b auto merge of #18486 : nikomatsakis/rust/operator-dispatch, r=pcwalton
This branch cleans up overloaded operator resolution so that it is strictly based on the traits in `ops`, rather than going through the normal method lookup mechanism. It also adds full support for autoderef to overloaded index (whereas before autoderef only worked for non-overloaded index) as well as for the slicing operators.

This is a [breaking-change]: in the past, we were accepting combinations of operands that were not intended to be accepted. For example, it was possible to compare a fixed-length array and a slice, or apply the `!` operator to a `&int`. See the first two commits in this pull-request for examples.

One downside of this change is that comparing fixed-length arrays doesn't always work as smoothly as it did before. Before this, comparisons sometimes worked due to various coercions to slices. I've added impls for `Eq`, `Ord`, etc for fixed-lengths arrays up to and including length 32, but if the array is longer than that you'll need to either newtype the array or convert to slices. Note that this plays better with deriving in any case than the previous scheme.

Fixes #4920.
Fixes #16821.
Fixes #15757.

cc @alexcrichton 
cc @aturon
2014-11-05 22:31:44 +00:00
Piotr Czarnecki
a8ce669b42 Workaround to have doc comments desugared only in macros 2014-11-05 23:06:01 +01:00
Piotr Czarnecki
6f30a4ee6c Remove Matchers 2014-11-05 23:06:01 +01:00
Piotr Czarnecki
38ce6d9eac Use TokenTrees in lhs of macros 2014-11-05 23:06:01 +01:00
Cristi Burcă
e4794250c8 Fix example in HashMap::new() docs 2014-11-05 22:11:52 +02:00
bors
5c1fd5f8b7 auto merge of #18462 : netvl/rust/to-socket-addr, r=alexcrichton
This is a follow-up to [RFC PR #173](https://github.com/rust-lang/rfcs/pull/173). I was told there that changes like this don't need to go through the RFC process, so I'm submitting this directly.

This PR introduces `ToSocketAddr` trait as defined in said RFC. This trait defines a conversion from different types like `&str`, `(&str, u16)` or even `SocketAddr` to `SocketAddr`. Then this trait is used in all constructor methods for `TcpStream`, `TcpListener` and `UdpSocket`.

This unifies these constructor methods - previously they were using different types of input parameters (TCP ones used `(&str, u16)` pair while UDP ones used `SocketAddr`), which is not consistent by itself and sometimes inconvenient - for example, when the address initially is available as `SocketAddr`, you still need to convert it to string to pass it to e.g. `TcpStream`. This is very prominently demonstrated by the unit tests for TCP functionality. This PR makes working with network objects much like with `Path`, which also uses similar trait to be able to be constructed from `&[u8]`, `Vec<u8>` and other `Path`s.

This is a breaking change. If constant literals were used before, like this:
```rust
TcpStream::connect("localhost", 12345)
```
then the nicest fix is to change it to this:
```rust
TcpStream::connect("localhost:12345")
```

If variables were used before, like this:
```rust
TcpStream::connect(some_address, some_port)
```
then the arguments should be wrapped in another set of parentheses:
```rust
TcpStream::connect((some_address, some_port))
```

`UdpSocket` usages won't break because its constructor method accepted `SocketAddr` which implements `ToSocketAddr`, so `bind()` calls:
```rust
UdpSocket::bind(some_socket_addr)
```
will continue working as before.

I haven't changed `UdpStream` constructor because it is deprecated anyway.
2014-11-05 18:01:53 +00:00
Michael Woerister
36088ab21f debuginfo: Add a timeout for LLDB tests.
Fixes #18649.
2014-11-05 18:35:24 +01:00
Niko Matsakis
81c00e66f5 Better debug printouts 2014-11-05 11:29:15 -05:00
Niko Matsakis
dfe840245b Remove incorrect doc annotation, mark experimental since we haven't discussed in an API meeting 2014-11-05 11:29:15 -05:00
Niko Matsakis
63718792df Update the guide examples and try not to leave user hanging as to what
this `&x` sigil is all about.
2014-11-05 11:29:15 -05:00
Niko Matsakis
0b5bc3314f Implement new operator dispatch semantics.
Key points are:
1. `a + b` maps directly to `Add<A,B>`, where `A` and `B` are the types of `a` and `b`.
2. Indexing and slicing autoderefs consistently.
2014-11-05 11:29:15 -05:00
Vladimir Matveev
0f610f3c14 Fixed not compiling code in docstring 2014-11-05 19:18:30 +03:00