Commit Graph

37937 Commits

Author SHA1 Message Date
Alex Crichton
87eb67f4f0 rollup merge of #21854: alexcrichton/try-borrow
The existence of these two functions is at odds with our current [error
conventions][conventions] which recommend that panicking and `Result`-like
variants should not be provided together.

[conventions]: https://github.com/rust-lang/rfcs/blob/master/text/0236-error-conventions.md#do-not-provide-both-result-and-fail-variants

This commit adds a new `borrow_state` function returning a `BorrowState` enum to
`RefCell` which serves as a replacemnt for the `try_borrow` and `try_borrow_mut`
functions.
2015-02-02 11:01:23 -08:00
Alex Crichton
0a10e32a5e rollup merge of #21852: FreeFull/patch-1
Misspelling fix.
2015-02-02 11:01:21 -08:00
Alex Crichton
02c149deb9 rollup merge of #21849: alexcrichton/warn2note
There [have been reports][issue] of an unconditional warning causing tooling to
go awry. This isn't actually a warning per se, it's more of a note anyway!

[issue]: https://github.com/rust-lang/cargo/issues/1260

Closes rust-lang/cargo#1260
2015-02-02 11:01:19 -08:00
Alex Crichton
b9e27433fa rollup merge of #21848: Manishearth/book-link
rollupable

r? @steveklabnik
2015-02-02 11:01:18 -08:00
Alex Crichton
3ef2df9e88 rollup merge of #21845: Potpourri/import-syntax
syntax like `use foo::bar::;` and `use foo:: as bar;` should be rejected, see issue #21629
2015-02-02 11:01:17 -08:00
Alex Crichton
99b2bd4bfa rollup merge of #21842: alexcrichton/issue-21839
Now that associated types are fully implemented the iterator adaptors only need
type parameters which are associated with actual storage. All other type
parameters can either be derived from these (e.g. they are an associated type)
or can be bare on the `impl` block itself.

This is a breaking change due to the removal of type parameters on these
iterator adaptors, but code can fairly easily migrate by just deleting the
relevant type parameters for each adaptor. Other behavior should not be
affected.

Closes #21839
[breaking-change]
2015-02-02 11:01:16 -08:00
Alex Crichton
747e6b53e4 rollup merge of #21832: genbattle/doc-unicode-escapes
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.

I have updated The Reference and grammar.md to reflect these changes.
2015-02-02 11:01:15 -08:00
Alex Crichton
7335c7dd63 rollup merge of #21830: japaric/for-cleanup
Conflicts:
	src/librustc/metadata/filesearch.rs
	src/librustc_back/target/mod.rs
	src/libstd/os.rs
	src/libstd/sys/windows/os.rs
	src/libsyntax/ext/tt/macro_parser.rs
	src/libsyntax/print/pprust.rs
	src/test/compile-fail/issue-2149.rs
2015-02-02 11:01:12 -08:00
Alex Crichton
075588a493 rollup merge of #21825: kmcallister/ttdelim-span 2015-02-02 10:58:19 -08:00
Alex Crichton
10de0d9898 rollup merge of #21819: dsyang/doc_fix
as titled.  See issue #21770
2015-02-02 10:58:17 -08:00
Alex Crichton
04213ebd98 rollup merge of #21818: dotdash/llvm_up 2015-02-02 10:58:15 -08:00
Alex Crichton
c64b73e520 rollup merge of #21817: edwardw/symmetric-binop
For "symmetric" binary operators, meaning the types of two sides 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-02 10:58:10 -08:00
Alex Crichton
22fdf97035 rollup merge of #21815: nagisa/overflowing-lints 2015-02-02 10:58:09 -08:00
Alex Crichton
b0dee7b52a rollup merge of #21808: jfager/r20454
Closes #20454
2015-02-02 10:58:07 -08:00
Alex Crichton
85aba7575b rollup merge of #21803: madmalik/patch-1
http://doc.rust-lang.org/rustdoc.html states that its content was moved to http://doc.rust-lang.org/book/documentation.html
2015-02-02 10:58:06 -08:00
Alex Crichton
387722b304 rollup merge of #21800: brson/unused_features
When it was un*known*_features it was reasonable to be deny by default.

cc #21798

r? @alexcrichton
2015-02-02 10:58:05 -08:00
Alex Crichton
1641c32d83 rollup merge of #21794: alexcrichton/stabilize-atomic-usize
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-02-02 10:58:04 -08:00
Alex Crichton
902abab144 rollup merge of #21787: alexcrichton/std-env
Conflicts:
	src/libstd/sys/unix/backtrace.rs
	src/libstd/sys/unix/os.rs
2015-02-02 10:58:01 -08:00
Alex Crichton
7b185f9cda rollup merge of #21782: alexcrichton/issue-21771
Previously if --extern was specified it would not override crates in the
standard distribution, leading to issues like #21771. This commit alters the
behavior such that if --extern is passed then it will always override any other
choice of crates and no previous match will be used (unless it is the same path
as --extern).

Closes #21771
2015-02-02 10:56:59 -08:00
Alex Crichton
425f2328d0 rollup merge of #21754: semarie/openbsd-rebased
Hi.

Here a commit in order to add OpenBSD support to rust.

- tests status:
run-pass: test result: ok. 1879 passed; 0 failed; 24 ignored; 0 measured
run-fail: test result: ok. 81 passed; 0 failed; 5 ignored; 0 measured
compile-fail: test result: ok. 1634 passed; 0 failed; 22 ignored; 0 measured
run-pass-fulldeps: test result: ok. 22 passed; 0 failed; 1 ignored; 0 measured
compile-fail-fulldeps: test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured

- The current implementation of load_self function (src/libstd/sys/unix/os.rs) isn't optimal as under OpenBSD I haven't found a reliable method to get the filename of a running process. The current implementation is enought for bootstrapping purpose.

- I have disable `run-pass/tcp-stress.rs` test under openbsd. When run manually, the test pass, but when run under `compiletest`, it timeout and echo continuoulsy `Too many open files`.

- For building with jemalloc, a more recent version of jemalloc would be mandatory. See https://github.com/jemalloc/jemalloc/pull/188 for more details.
2015-02-02 10:56:57 -08:00
Alex Crichton
9529ab0e7e rollup merge of #21710: alfie/libsyntax
Conflicts:
	src/libsyntax/parse/parser.rs
2015-02-02 10:56:55 -08:00
Alex Crichton
8c468b69ae rollup merge of #21567: steveklabnik/doc_char 2015-02-02 10:56:11 -08:00
Alex Crichton
5e25d11ebf rollup merge of #21509: lucab/lucab/copyright-update
valgrind files moved and modpath.iss deleted. Both entries updated in
COPYRIGHT file.

Signed-off-by: Luca Bruno <lucab@debian.org>
2015-02-02 10:56:10 -08:00
Alex Crichton
a392d9131e rollup merge of #21362: aochagavia/copy_rawptr
Fixes #21272 and #21296

r? @cmr
2015-02-02 10:56:07 -08:00
Alex Crichton
ddcfb158fd rollup merge of #21223: P1start/expected-token-improvements
Fixes #21153.
2015-02-02 10:56:05 -08:00
Jorge Aparicio
3484706c38 remove unused mut qualifiers 2015-02-02 13:40:18 -05:00
Jorge Aparicio
fd702702ee for x in xs.into_iter() -> for x in xs
Also `for x in option.into_iter()` -> `if let Some(x) = option`
2015-02-02 13:40:18 -05:00
Jorge Aparicio
d5f61b4332 for x in xs.iter_mut() -> for x in &mut xs
Also `for x in option.iter_mut()` -> `if let Some(ref mut x) = option`
2015-02-02 13:40:18 -05:00
Jorge Aparicio
d5d7e6565a for x in xs.iter() -> for x in &xs 2015-02-02 13:40:18 -05:00
Jorge Aparicio
9f90d666e0 impl IntoIterator for HashSet 2015-02-02 13:38:32 -05:00
Jorge Aparicio
afabb022b0 impl IntoIterator for HashMap 2015-02-02 13:38:32 -05:00
Jorge Aparicio
134cf707df register snapshots 2015-02-02 13:38:32 -05:00
Adolfo Ochagavía
8b84f097fb Add test for #21296 2015-02-02 16:28:08 +01:00
Adolfo Ochagavía
b9a67e3236 Do not warn when deriving Copy for raw pointers
Fixes #21272 and #21296
2015-02-02 16:28:07 +01:00
bors
eaf4c5c784 Auto merge of #21864 - sanxiyn:no-chain, r=nikomatsakis
This avoids triggering #21694. It probably is a better way to do it anyway.
2015-02-02 15:04:54 +00:00
Steve Klabnik
fcf1a57cea Documenting libcore/char.rs 2015-02-02 09:08:51 -05:00
bors
758a296e27 Auto merge of #21647 - alfie:suffix-medium, r=alexcrichton 2015-02-02 11:52:34 +00:00
Seo Sanghyeon
6a1a46e8d7 Avoid an excessive use of iterator chain 2015-02-02 18:33:24 +09:00
Alfie John
9683745fed Omit integer suffix when unnecessary
See PR # 21378 for context
2015-02-02 04:05:54 +00:00
Alex Crichton
deed093a38 std: Deprecate RefCell::{try_borrow, try_borrow_mut}
The existence of these two functions is at odds with our current [error
conventions][conventions] which recommend that panicking and `Result`-like
variants should not be provided together.

[conventions]: https://github.com/rust-lang/rfcs/blob/master/text/0236-error-conventions.md#do-not-provide-both-result-and-fail-variants

This commit adds a new `borrow_state` function returning a `BorrowState` enum to
`RefCell` which serves as a replacemnt for the `try_borrow` and `try_borrow_mut`
functions.
2015-02-01 18:58:14 -08:00
P1start
597b4fa984 Tweak some ‘expected…’ error messages
Fixes #21153.
2015-02-02 15:30:35 +13:00
Jason Fager
6342af8c51 Add test, closes #20454 2015-02-01 21:08:33 -05:00
Filip Szczepański
f371af4815 Closes issue #21850 2015-02-02 00:46:34 +00:00
Alex Crichton
0187ea61a6 rustc: Change an unconditional warn to a note
There [have been reports][issue] of an unconditional warning causing tooling to
go awry. This isn't actually a warning per se, it's more of a note anyway!

[issue]: https://github.com/rust-lang/cargo/issues/1260

Closes rust-lang/cargo#1260
2015-02-01 14:25:55 -08:00
Manish Goregaokar
8d57f8c0a0 Fix stale doc link (guide -> book) 2015-02-02 03:45:52 +05:30
bors
ca4b9674c2 Auto merge of #21318 - stepancheg:box-fns, r=alexcrichton
Functions are needed for safety and convenience.

It is a common pattern to use `mem::transmute` to convert between
`Box` and raw pointer, like this:

```
let b = Box::new(3);
let p = mem::transmute(b);
// pass `p` to some C library
```

After this commit, conversion can be written as:

```
let p = b.into_raw();
```

`into_raw` and `from_raw` functions are still unsafe, but they are
much safer than `mem::transmute`, because *raw functions do not
convert between incompatible pointers. For example, this likely
incorrect code can be successfully compiled:

```
let p: *mut u64 = ...
let b: Box<u32> = mem::transmute(p);
```

Using `from_raw` results in compile-time error:

```
let p: *mut u64 = ...
let b: Box<u32> = Box::from_raw(p); // compile-time error
```

`into_raw` and `from_raw` functions are similar to C++ `std::unique_ptr`
`release` function [1] and constructor from pointer [2].

[1] http://en.cppreference.com/w/cpp/memory/unique_ptr/release
[2] http://en.cppreference.com/w/cpp/memory/unique_ptr/unique_ptr
2015-02-01 21:53:53 +00:00
Alex Crichton
0e4448409e std: Remove extra type params on iter adaptors
Now that associated types are fully implemented the iterator adaptors only need
type parameters which are associated with actual storage. All other type
parameters can either be derived from these (e.g. they are an associated type)
or can be bare on the `impl` block itself.

This is a breaking change due to the removal of type parameters on these
iterator adaptors, but code can fairly easily migrate by just deleting the
relevant type parameters for each adaptor. Other behavior should not be
affected.

Closes #21839
[breaking-change]
2015-02-01 13:05:23 -08:00
Potpourri
0828efd72f Reject syntax like use foo::bar::; and use foo:: as bar; and keywords in view path idents 2015-02-01 23:31:21 +03:00
Alex Crichton
70ed3a48df std: Add a new env module
This is an implementation of [RFC 578][rfc] which adds a new `std::env` module
to replace most of the functionality in the current `std::os` module. More
details can be found in the RFC itself, but as a summary the following methods
have all been deprecated:

[rfc]: https://github.com/rust-lang/rfcs/pull/578

* `os::args_as_bytes`   => `env::args`
* `os::args`            => `env::args`
* `os::consts`          => `env::consts`
* `os::dll_filename`    => no replacement, use `env::consts` directly
* `os::page_size`       => `env::page_size`
* `os::make_absolute`   => use `env::current_dir` + `join` instead
* `os::getcwd`          => `env::current_dir`
* `os::change_dir`      => `env::set_current_dir`
* `os::homedir`         => `env::home_dir`
* `os::tmpdir`          => `env::temp_dir`
* `os::join_paths`      => `env::join_paths`
* `os::split_paths`     => `env::split_paths`
* `os::self_exe_name`   => `env::current_exe`
* `os::self_exe_path`   => use `env::current_exe` + `pop`
* `os::set_exit_status` => `env::set_exit_status`
* `os::get_exit_status` => `env::get_exit_status`
* `os::env`             => `env::vars`
* `os::env_as_bytes`    => `env::vars`
* `os::getenv`          => `env::var` or `env::var_string`
* `os::getenv_as_bytes` => `env::var`
* `os::setenv`          => `env::set_var`
* `os::unsetenv`        => `env::remove_var`

Many function signatures have also been tweaked for various purposes, but the
main changes were:

* `Vec`-returning APIs now all return iterators instead
* All APIs are now centered around `OsString` instead of `Vec<u8>` or `String`.
  There is currently on convenience API, `env::var_string`, which can be used to
  get the value of an environment variable as a unicode `String`.

All old APIs are `#[deprecated]` in-place and will remain for some time to allow
for migrations. The semantics of the APIs have been tweaked slightly with regard
to dealing with invalid unicode (panic instead of replacement).

The new `std::env` module is all contained within the `env` feature, so crates
must add the following to access the new APIs:

    #![feature(env)]

[breaking-change]
2015-02-01 11:08:15 -08:00
bors
c2bda2a5bb Auto merge of #21806 - edwardw:new-range-impl, r=alexcrichton
The new `::ops::Range` has separated implementations for each of the
numeric types, while the old `::iter::Range` has one for type `Int`.
However, we do not take output bindings into account when selecting
traits. So it confuses `typeck` and makes the new range does not work as
good as the old one when it comes to type inference.

This patch implements `Iterator` for the new range for one type `Int`.
This limitation could be lifted, however, if we ever reconsider the
output types' role in type inference.

Closes #21595
Closes #21649
Closes #21672
2015-02-01 19:07:11 +00:00