Commit Graph

38063 Commits

Author SHA1 Message Date
Nick Sarten
b796c1d614 Updated unicode escape documentation to match current implementation.
Unicode escapes were changed in [this
RFC](28aeb3c391/text/0446-es6-unicode-escapes.md)
to use the ES6 \u{00FFFF} syntax with a variable number of digits from
1-6, eliminating the need for two different syntaxes for unicode
literals.
2015-02-01 16:42:22 +13:00
Keegan McAllister
cedc6753f2 Fix end of TtDelimited span 2015-01-31 17:41:38 -08:00
bors
e8489d3cc7 Auto merge of #21792 - nikomatsakis:orphan-ordered-first, r=aturon
Update the coherence rules to "covered first" -- the first type parameter to contain either a local type or a type parameter must contain only covered type parameters.

cc #19470.
Fixes #20974.
Fixes #20749.

r? @aturon
2015-02-01 01:34:08 +00:00
bors
f1398d2736 Auto merge of #21760 - brson:snaps, r=alexcrichton 2015-01-31 20:21:02 +00:00
Dan Yang
7eaa589fe5 fix use decl code example in reference 2015-01-31 12:16:14 -08:00
Edward Wang
60fa1ff347 Fix fallout 2015-02-01 04:06:18 +08:00
Edward Wang
1935bbd913 Make use of a binary operator's RHS type for LHS inference
For "symmetric" binary operators, meaning the types of two side must be
equal, if the type of LHS doesn't know yet but RHS does, use that as an
hint to infer LHS' type.

Closes #21634
2015-02-01 04:06:06 +08:00
Alexis
998599187f make Send/Sync impl of RawTable manual 2015-01-31 14:11:53 -05:00
Simonas Kazlauskas
afa526c571 Update tests for overflowing literals
Changed in 64ca751
2015-01-31 20:16:31 +02:00
Simonas Kazlauskas
64ca751eb0 Mention the type in the overflowing literal lint
Fixes #21807
2015-01-31 20:12:48 +02:00
Tobias Bucher
b4a43f3864 Kill more isizes 2015-01-31 17:40:40 +01:00
Jorge Aparicio
c3841b9c9f remove Copy impls from remaining iterators 2015-01-31 09:09:22 -05:00
madmalik
e9ade4826a updating the link to rustdoc
http://doc.rust-lang.org/rustdoc.html states that its content was moved to http://doc.rust-lang.org/book/documentation.html
2015-01-31 12:27:57 +01:00
Tobias Bucher
105bfd3001 Reference: Purge isize from non-memory-related examples
Also explain integer fallback to `i32`.
2015-01-31 12:23:26 +01:00
Niko Matsakis
2c2879bbce Adjust error message not to mention the self type 2015-01-31 04:39:16 -05:00
Brian Anderson
f9f7ad74cf rustc: Make unused_features lint warn by default
When it was un*known*_features it was reasonably to by deny by default.

cc #21798
2015-01-30 22:27:36 -08:00
bors
474b324eda Auto merge of #21791 - alexcrichton:rollup, r=alexcrichton 2015-01-31 03:57:01 +00:00
Alex Crichton
e8fd9d3d0b Merge remote-tracking branch 'origin/master' into rollup 2015-01-30 19:55:37 -08:00
Alex Crichton
0832364946 std: Stabilize Atomic{Isize,Usize} methods
These methods were intended to be stable as of #16258 but the tags have since
been lost in various refactorings. This commit re-adds the `#[stable]`
attributes to each of these functions.
2015-01-30 18:02:57 -08:00
Niko Matsakis
ecaa68768c Update the coherence rules to "covered first" -- the first type parameter to contain either a local type or a type parameter must contain only covered type parameters. 2015-01-30 20:25:07 -05:00
Carl Lerche
60ba03d812 Implement Thread::park_timeout 2015-01-30 17:09:15 -08:00
Alex Crichton
64dd7be2c5 Merge remote-tracking branch 'origin/master' into rollup
Conflicts:
	src/liballoc/lib.rs
	src/libcore/ops.rs
2015-01-30 14:55:34 -08:00
Alex Crichton
3a2530d611 Test fixes and rebase conflicts
Also some tidying up of a bunch of crate attributes
2015-01-30 14:53:34 -08:00
Brian Anderson
ef1b33c74b Register snaps 2015-01-30 14:32:15 -08:00
Alex Crichton
188d7c0bc3 rollup merge of #21631: tbu-/isize_police
Conflicts:
	src/libcoretest/iter.rs
2015-01-30 13:27:02 -08:00
Alex Crichton
4c25687c2b rollup merge of #21528: tshepang/simpler-replace-example 2015-01-30 13:26:43 -08:00
Alex Crichton
f6dd25bb38 rollup merge of #21713: alexcrichton/second-pass-fmt 2015-01-30 13:26:42 -08:00
Alex Crichton
8397217629 rollup merge of #21760: brson/snaps 2015-01-30 13:26:42 -08:00
Alex Crichton
eb3a06093c rollup merge of #21783: lukesteensen/patch-1 2015-01-30 12:03:37 -08:00
Alex Crichton
a75e308a61 rollup merge of #21780: steveklabnik/no_as_slice
Use auto deref instead.
2015-01-30 12:03:35 -08:00
Alex Crichton
6ea5fb8a6d rollup merge of #21765: P1start/non-ascii-style-lints
An alternative to #21749.

This also refactors the naming lint code a little bit and slightly rephrases some warnings (`uppercase` → `upper case`).

Closes #21735.
2015-01-30 12:03:34 -08:00
Alex Crichton
62a8462ba4 rollup merge of #21762: brson/users 2015-01-30 12:03:32 -08:00
Alex Crichton
9d970c6528 rollup merge of #21753: dzamlo/master
Before, unknown -Z option would result in a "error: unknown codegen option"
message instead of "error: unknown debugging option".
2015-01-30 12:03:30 -08:00
Alex Crichton
42e4c1aef6 rollup merge of #21747: nikomatsakis/issue-21726-projection-subtyping
Make subtyping for projection types stricter. Fixes #21726.

r? @pnkfelix
2015-01-30 12:03:29 -08:00
Alex Crichton
c8f2726b39 rollup merge of #21739: alexcrichton/better-print
Closes rust-lang/cargo#1234
2015-01-30 12:03:27 -08:00
Alex Crichton
e2282f9cfb rollup merge of #21738: steveklabnik/move_out_editors
As we grow, these don't belong in-tree.

http://internals.rust-lang.org/t/moving-editor-highlighting-into-their-own-repos/1395

* https://github.com/rust-lang/rust.vim
* https://github.com/rust-lang/rust-mode
* https://github.com/rust-lang/gedit-config
* https://github.com/rust-lang/kate-config
* https://github.com/rust-lang/nano-config
* https://github.com/rust-lang/zsh-config
2015-01-30 12:03:26 -08:00
Alex Crichton
ebee4b4b37 rollup merge of #21736: sfackler/bufread-capacity-fix
We don't care about how much space the allocation has, but the actual
usable space in the buffer.

r? @alexcrichton
2015-01-30 12:03:24 -08:00
Alex Crichton
f8b3d5c2db rollup merge of #21733: mneumann/fix-io-rename-df 2015-01-30 12:03:23 -08:00
Alex Crichton
c0705c1f81 rollup merge of #21720: huonw/simd-cmp
Previously comparisons of SIMD types were always signed, even unsigned
comparisons, meaning 0xFFFF_FFFF_u32 < 0 inside a SIMD vector.

Fixes #21719.
2015-01-30 12:03:21 -08:00
Alex Crichton
ac1a03d742 rollup merge of #21718: alexcrichton/stabilize-from-str
This commits adds an associated type to the `FromStr` trait representing an
error payload for parses which do not succeed. The previous return value,
`Option<Self>` did not allow for this form of payload. After the associated type
was added, the following attributes were applied:

* `FromStr` is now stable
* `FromStr::Err` is now stable
* `FromStr::from_str` is now stable
* `StrExt::parse` is now stable
* `FromStr for bool` is now stable
* `FromStr for $float` is now stable
* `FromStr for $integral` is now stable
* Errors returned from stable `FromStr` implementations are stable
* Errors implement `Display` and `Error` (both impl blocks being `#[stable]`)

Closes #15138
2015-01-30 12:03:20 -08:00
Alex Crichton
0ba812fbf0 rollup merge of #21706: reem/missing-zeroable-impl-for-unique
This allows the use of `NonZero<Unique<T>>` for owned,
non-null raw pointers.

cc https://github.com/Gankro/collect-rs/pull/103
2015-01-30 12:03:19 -08:00
Alex Crichton
692a3661fb rollup merge of #21704: FlaPer87/macro-reexport
Conflicts:
	src/libstd/lib.rs
2015-01-30 12:03:16 -08:00
Alex Crichton
103f1459c0 rollup merge of #21702: nikomatsakis/issue-21636
Check and extract bindings from trait definitions.

Fixes #21636.

r? @nick29581
2015-01-30 12:02:56 -08:00
Alex Crichton
16120e9a1f rollup merge of #21693: tomjakubowski/rustdoc-fix-21442
Fix #21442
2015-01-30 12:02:55 -08:00
Alex Crichton
b70ec4d9f0 rollup merge of #21678: vojtechkral/threads-native-names
Fixes #10302

I really am not sure I'm doing this right, so here goes nothing...

Also testing this isn't easy. I don't have any other *nix boxes besides a Linux one.

Test code:

```rust
use std::thread;
use std::io::timer::sleep;
use std::time::duration::Duration;

fn make_thread<'a>(i: i64) -> thread::JoinGuard<'a, ()>
{
	thread::Builder::new().name(format!("MyThread{}", i).to_string()).scoped(move ||
	{
		println!("Start: {}", i);
		sleep(Duration::seconds(i));
		println!("End: {}", i);
	})
}

fn main()
{
	let mut guards = vec![make_thread(3)];

	for i in 4i64..16
	{
		guards.push(make_thread(i));
	}
}
```

GDB output on my machine:

```
(gdb) info threads
  Id   Target Id         Frame
  15   Thread 0x7fdfbb35f700 (LWP 23575) "MyThread3" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  14   Thread 0x7fdfba7ff700 (LWP 23576) "MyThread4" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  13   Thread 0x7fdfba5fe700 (LWP 23577) "MyThread5" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  12   Thread 0x7fdfba3fd700 (LWP 23578) "MyThread6" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  11   Thread 0x7fdfb8dfe700 (LWP 23580) "MyThread4" 0x00007fdfbb746193 in select () from /usr/lib/libc.so.6
  10   Thread 0x7fdfb8fff700 (LWP 23579) "MyThread7" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  9    Thread 0x7fdfb8bfd700 (LWP 23581) "MyThread8" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  8    Thread 0x7fdfb3fff700 (LWP 23582) "MyThread9" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  7    Thread 0x7fdfb3dfe700 (LWP 23583) "MyThread10" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  6    Thread 0x7fdfb3bfd700 (LWP 23584) "MyThread11" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  5    Thread 0x7fdfb2bff700 (LWP 23585) "MyThread12" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  4    Thread 0x7fdfb29fe700 (LWP 23586) "MyThread13" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  3    Thread 0x7fdfb27fd700 (LWP 23587) "MyThread14" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
  2    Thread 0x7fdfb1bff700 (LWP 23588) "MyThread15" 0x00007fdfbbe35a8d in nanosleep () from /usr/lib/libpthread.so.0
* 1    Thread 0x7fdfbc411800 (LWP 23574) "threads" 0x00007fdfbbe2e505 in pthread_join () from /usr/lib/libpthread.so.0
```
(I'm not sure why one of the threads is duplicated, but it does that without my patch too...)
2015-01-30 12:02:53 -08:00
Alex Crichton
b446c5b679 rollup merge of #21495: richo/unexported-unmangled-lint
The usecase is that functions made visible to systems outside of the
rust ecosystem require the symbol to be visible.

This adds a lint for functions that are not exported, but also not mangled.

It has some gotchas:

[ ]: There is fallout in core that needs taking care of
[ ]: I'm not convinced the error message is correct
[ ]: It has no tests

~~However, there's an underlying issue which I'd like feedback on- which is that my belief that that non-pub functions would not have their symbols exported, however that seems not to be the case in the first case that this lint turned up in rustc (`rust_fail`), which intuition suggests has been working.~~

This seems to be a separate bug in rust, wherein the symbols are exported in binaries, but not in rlibs or dylibs. This lint would catch that case.
2015-01-30 12:02:51 -08:00
Alex Crichton
9ff540ba37 rollup merge of #21494: jatinn/jsnav
Added javascript code to insert next/prev links in the rust book.
Related Issue - https://github.com/rust-lang/rust/issues/20835
2015-01-30 12:02:48 -08:00
Alex Crichton
15dd0a5acb rollup merge of #21385: nick29581/save-fix2
r? @huonw
2015-01-30 12:02:46 -08:00
Alex Crichton
341e858bd8 rollup merge of #20790: japaric/for-loops
As per [RFC #235][rfc], you can now do:

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0235-collections-conventions.md#intoiterator-and-iterable

``` rust
let mut v = vec![1];

// iterate over immutable references
for x in &v {
    assert_eq!(x, &1);
}

// iterate over mutable references
for x in &mut v {
    assert_eq!(x, &mut 1);
}

// iterate over values, this consumes `v`
for x in v {
    assert_eq!(x, 1);
}
```

[breaking-change]s

For loops now "consume" (move) the iterator, this breaks iterating over mutable references to iterators, and also breaks multiple iterations over the same iterator:

``` rust
fn foo(mut it: &mut Iter) {  // `Iter` implements `Iterator`
    for x in it { .. }  //~ error: `&mut Iter` doesn't implement Iterator
}

fn bar() {
    for x in it { .. }  //~ note: `it` moved here
    for x in it { .. }  //~ error: `it` has been moved
}
```

Both cases can be fixed using the `by_ref()` adapter to create an iterator from the mutable reference:

``` rust
fn foo(mut it: &mut Iter) {
    for x in it.by_ref() { .. }
}

fn bar() {
    for x in it.by_ref() { .. }
    for x in it { .. }
}
```

This PR also makes iterator non-implicitly copyable, as this was source of subtle bugs in the libraries. You can still use `clone()` to explictly copy the iterator.

Finally, since the for loops are implemented in the frontend and use global paths to `IntoIterator`, `Iterator` and `Option` variants, users of the `core` crate will have to use add an `std` module to the root of their crate to be able to use for loops:

``` rust
#![no_std]

extern crate core;

fn main() {
    for x in 0..10 {}
}

#[doc(hidden)]
mod std {
    // these imports are needed to use for-loops
    pub use core::iter;
    pub use core::option;
}
```

---

r? @nikomatsakis @aturon
cc #18424
closes #18045
2015-01-30 12:02:44 -08:00
bors
1d00c545ed Auto merge of #21495 - richo:unexported-unmangled-lint, r=alexcrichton
The usecase is that functions made visible to systems outside of the
rust ecosystem require the symbol to be visible.

This adds a lint for functions that are not exported, but also not mangled.

It has some gotchas:

[ ]: There is fallout in core that needs taking care of
[ ]: I'm not convinced the error message is correct
[ ]: It has no tests

~~However, there's an underlying issue which I'd like feedback on- which is that my belief that that non-pub functions would not have their symbols exported, however that seems not to be the case in the first case that this lint turned up in rustc (`rust_fail`), which intuition suggests has been working.~~

This seems to be a separate bug in rust, wherein the symbols are exported in binaries, but not in rlibs or dylibs. This lint would catch that case.
2015-01-30 19:56:34 +00:00