Commit Graph

38367 Commits

Author SHA1 Message Date
Brian Anderson
456d23e73e Add a lint for writing #[feature] for stable features, warn by default.
The 'stable_features' lint helps people progress from unstable to
stable Rust by telling them when they no longer need a `feature`
attribute because upstream Rust has declared it stable.

This compares to the existing 'unstable_features', which is used
to implement feature staging, and triggers on *any* use
of `#[feature]`.
2015-02-04 23:18:24 -08:00
Joseph Crail
fc0fd289c9 Fix for misspelled comments in tests.
Just spelling corrections.
2015-02-04 23:04:10 -05:00
Joseph Crail
dc2e444e50 Fix for misspelled comments.
The spelling corrections were made in both documentation comments and
regular comments.
2015-02-04 23:00:02 -05:00
bors
fa28f023c2 Auto merge of #21152 - steveklabnik:tasks, r=huonw
This moves the "Tasks" chapter to a "Concurrency" one, as it's about threads, but also about how to deal with concurrency issues.

r? @aturon
2015-02-05 03:11:57 +00:00
Steve Klabnik
5401f086f0 A concurrency chapter to replace the tasks chapter.
Fixes #18936
Fixes #18938
Fixes #20038
Fixes #8395
Fixes #2080
Fixes #21194
2015-02-04 21:47:16 -05:00
Seo Sanghyeon
4ef7551cca Fix type inference related to upvars in closures 2015-02-05 11:29:38 +09:00
Jorge Aparicio
92f11e938a register snapshots 2015-02-04 20:06:12 -05:00
Jorge Aparicio
571cc7f8e9 remove all kind annotations from closures 2015-02-04 20:06:08 -05:00
Alexis
5cbbc12827 stabilize core Entry API 2015-02-04 19:42:58 -05:00
Ulrik Sverdrup
75239142a8 Implement .. syntax for RangeFull as expression
Allows the expression `..` (without either endpoint) in general, can be
used in slicing syntax `&expr[..]` where we previously wrote `&expr[]`.

The old syntax &expr[] is not yet removed or warned for.
2015-02-04 23:23:12 +01:00
Alex Crichton
6c62839a7f rustc: Recognize -L framework=foo
On OSX the linker has a separate framework lookup path which is specified via
the `-F` flag. This adds a new kind of `-L` path recognized by the compiler for
frameworks to be passed through to the linker.

Closes #20259
2015-02-04 13:54:49 -08:00
Hugo van der Wijst
6f872113ab Add QPath construction to ExtCtxt for UFCS support. 2015-02-04 22:44:34 +01:00
bors
ba2f13ef06 Auto merge of #21885 - dotdash:nonnull_load, r=alexcrichton
These pointers are never null, let's tell LLVM about it.
2015-02-04 20:03:55 +00:00
Björn Steinbrink
db8f2d5903 Avoid unnecessary codegen in with_cond()
Currently "k / 2" generates one (k: uint) or two (k: int) "br false,
..." instructions and the corresponding basic blocks, producing quite
some noise and making the code unnecessarily hard to read.

Additionally we can skip translation if the code would end up
unreachable anyway.
2015-02-04 20:06:17 +01:00
Alex Crichton
f77dd70d61 std: Add reexports for core parse errors
These were forgotten reexports from #21718

Closes #21929
2015-02-04 08:48:46 -08:00
bors
3ae76d5c1c Auto merge of #21544 - P1start:mangle-unicode, r=alexcrichton
`{` and `}` aren’t valid characters on ARM, so this makes Unicode characters render as, e.g., `$u38d$` instead of `$u{38d}`.

This also fixes a small bug where `)` (**r**ight **p**arenthesis) and `*` (**r**aw **p**ointer) would both mangle to `$RP$`, making `)` show up as `*` in backtraces.
2015-02-04 15:49:43 +00:00
bors
ac134f7ca4 Auto merge of #21499 - P1start:issue-8706, r=huonw
Closes #8706.
2015-02-04 12:42:40 +00:00
bors
c3e1f77291 Auto merge of #21892 - huonw:deprecate-rand, r=alexcrichton
Use [`rand`](https://crates.io/crates/rand) and [`derive_rand`](https://crates.io/crates/derive_rand) from crates.io.

[breaking-change]
2015-02-04 08:47:27 +00:00
Steven Fackler
85a85c2070 Switch missing_copy_implementations to default-allow
This was particularly helpful in the time just after OIBIT's
implementation to make sure things that were supposed to be Copy
continued to be, but it's now creates a lot of noise for types that
intentionally don't want to be Copy.
2015-02-03 23:31:07 -08:00
Steve Klabnik
d992d3d9f3 Fix issue with rt::unwind::try() docs
This is now a Result, not an Option.
2015-02-04 02:19:54 -05:00
bors
d6c15d9b2d Auto merge of #21919 - alexcrichton:rollup, r=alexcrichton 2015-02-04 06:40:12 +00:00
Alex Crichton
70ecd8ed38 Test fixes and rebase conflicts 2015-02-03 21:30:32 -08:00
Alex Crichton
d0029a47c2 rollup merge of #21910: Manishearth/missing_stability
Currently, if a `#![staged_api]` crate contains an exported item without a stability marker (or inherited stability),
the item is useless.

This change introduces a check to ensure that all exported items have a defined stability.

it also introduces the `unmarked_api` feature, which lets users import unmarked features. While this PR should in theory forbid these from existing,
in practice we can't be so sure; so this lets users bypass this check instead of having to wait for the library and/or compiler to be fixed (since otherwise this is a hard error).

r? @aturon
2015-02-03 20:11:20 -08:00
Alex Crichton
9db593c90a rollup merge of #21907: alexcrichton/iter-by-ref
This removes the `ByRef` iterator adaptor to stay in line with the changes to
`std::io`. The `by_ref` method instead just returns `&mut Self`.

This also removes the implementation of `Iterator for &mut Iterator` and instead
generalizes it to `Iterator for &mut I` where `I: Iterator + ?Sized`. The
`Box<I>` implementations were also updated.
2015-02-03 20:11:20 -08:00
Alex Crichton
74f7e06939 rollup merge of #21899: nikomatsakis/closure-unify-anyhow
This *almost* completes the job for #16440. The idea is that even if we do not know whether some closure type `C` implements `Fn` or `FnMut` (etc), we still know its argument and return types. So if we see an obligation `C : Fn(_0)`, we can unify `_0` with those argument types while still considering the obligation ambiguous and unsatisfied. This helps to make a lot of progress with type inference even before closure kind inference is done.

As part of this PR, the explicit `:` syntax is removed from the AST and completely ignored. We still infer the closure kind based on the expected type if that is available. There are several reasons for this. First, deciding the closure kind earlier is always better, as it allows us to make more progress. Second, this retains a (admittedly obscure) way for users to manually specify the closure kind, which is useful for writing tests if nothing else. Finally, there are still some cases where inference can fail, so it may be useful to have this manual override. (The expectation is that we will eventually revisit an explicit syntax for specifying the closure kind, but it will not be `:` and may be some sort of generalization of the `||` syntax to handle other traits as well.)

This commit does not *quite* fix #16640 because a snapshot is still needed to enable the obsolete syntax errors for explicit `&mut:` and friends.

r? @eddyb as he reviewed the prior patch in this direction
2015-02-03 20:11:20 -08:00
Alex Crichton
1d921f557d rollup merge of #21897: dotdash/rposition
The extra check caused by the expect() call can, in general, not be
optimized away, because the length of the iterator is unknown at compile
time, causing a noticable slow-down. Since the check only triggers if
the element isn't actually found in the iterator, i.e. it isn't
guaranteed to trigger for ill-behaved ExactSizeIterators, it seems
reasonable to switch to an implementation that doesn't need the check
and just always returns None if the value isn't found.

Benchmark:
````rust
let v: Vec<u8> = (0..1024*65).map(|_| 0).collect();
b.iter(|| {
    v.as_slice().iter().rposition(|&c| c == 1)
});
````

Before:
````
test rposition  ... bench:     49939 ns/iter (+/- 23)
````

After:
````
test rposition  ... bench:     33306 ns/iter (+/- 68)
````
2015-02-03 20:11:20 -08:00
Alex Crichton
61b2f3a4f0 rollup merge of #21893: vhbit/ios-build-fix 2015-02-03 20:11:19 -08:00
P1start
cfe18fb836 Fix Unicode name mangling
`{` and `}` aren’t valid characters on ARM.

This also fixes a small bug where `)` (**r**ight **p**arenthesis) and `*`
(**r**aw **p**ointer) would both mangle to `$RP$`, making `)` show up as `*` in
backtraces.
2015-02-04 15:32:59 +13:00
Andrea Canciani
8f7c2d518d Replace be with become
As per rust-lang/rfcs#601, replace `be` with `become` as reserved
keyword for tail call optimization.
2015-02-04 01:25:24 +01:00
Alex Crichton
5a35ad7100 rollup merge of #21882: Gankro/vec_entry
Building over night, posting for review now. Presumably not much should need change.

I consider this necessary to move forward with a proper stabilization of the API.

r? @huonw
2015-02-03 15:35:57 -08:00
Alex Crichton
087e8479b9 rollup merge of #21870: alexcrichton/missing-stability
* Display::fmt is stable
* Debug::fmt is stable
* FromIterator::from_iter is stable
* Peekable::peek is stable
2015-02-03 15:35:55 -08:00
Alex Crichton
b53695b47a rollup merge of #21835: alexcrichton/iov2
This commit is an implementation of [RFC 576][rfc] which adds back the `std::io`
module to the standard library. No functionality in `std::old_io` has been
deprecated just yet, and the new `std::io` module is behind the same `io`
feature gate.

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

A good bit of functionality was copied over from `std::old_io`, but many tweaks
were required for the new method signatures. Behavior such as precisely when
buffered objects call to the underlying object may have been tweaked slightly in
the transition. All implementations were audited to use composition wherever
possible. For example the custom `pos` and `cap` cursors in `BufReader` were
removed in favor of just using `Cursor<Vec<u8>>`.

A few liberties were taken during this implementation which were not explicitly
spelled out in the RFC:

* The old `LineBufferedWriter` is now named `LineWriter`
* The internal representation of `Error` now favors OS error codes (a
  0-allocation path) and contains a `Box` for extra semantic data.
* The io prelude currently reexports `Seek` as `NewSeek` to prevent conflicts
  with the real prelude reexport of `old_io::Seek`
* The `chars` method was moved from `BufReadExt` to `ReadExt`.
* The `chars` iterator returns a custom error with a variant that explains that
  the data was not valid UTF-8.
2015-02-03 15:35:54 -08:00
Alex Crichton
8550bf74c1 rollup merge of #21759: aturon/new-path
This PR implements [path reform](https://github.com/rust-lang/rfcs/pull/474), and motivation and details for the change can be found there.

For convenience, the old path API is being kept as `old_path` for the time being. Updating after this PR is just a matter of changing imports to `old_path` (which is likely not needed, since the prelude entries still export the old path API).

This initial PR does not include additional normalization or platform-specific path extensions. These will be done in follow up commits or PRs.

[breaking-change]

Closes #20034
Closes #12056
Closes #11594
Closes #14028
Closes #14049
Closes #10035
2015-02-03 15:35:53 -08:00
Aaron Turon
45ddf50ceb Add new path module
Implements [RFC 474](https://github.com/rust-lang/rfcs/pull/474); see
that RFC for details/motivation for this change.

This initial commit does not include additional normalization or
platform-specific path extensions. These will be done in follow up
commits or PRs.
2015-02-03 14:52:03 -08:00
Huon Wilson
df1ac7aa63 Deprecate in-tree rand, std::rand and #[derive(Rand)].
Use the crates.io crate `rand` (version 0.1 should be a drop in
replacement for `std::rand`) and `rand_macros` (`#[derive_Rand]` should
be a drop-in replacement).

[breaking-change]
2015-02-04 09:39:40 +11:00
Aaron Turon
3e39f0bc0e Rename std::path to std::old_path
As part of [RFC 474](https://github.com/rust-lang/rfcs/pull/474), this
commit renames `std::path` to `std::old_path`, leaving the existing path
API in place to ease migration to the new one. Updating should be as
simple as adjusting imports, and the prelude still maps to the old path
APIs for now.

[breaking-change]
2015-02-03 14:34:42 -08:00
Manish Goregaokar
a5ddacf001 More test fixes 2015-02-04 03:46:36 +05:30
Manish Goregaokar
2258f906ab Don't check stability for tests 2015-02-04 03:21:10 +05:30
Manish Goregaokar
f5e5bdb197 Fix test 2015-02-04 03:20:12 +05:30
Manish Goregaokar
d02d4c3c9b Add staged_api and unmarked_api features to reference.md 2015-02-04 02:30:31 +05:30
Manish Goregaokar
b64572cefe Add unmarked_api feature (fixes #21884) 2015-02-04 02:30:31 +05:30
Manish Goregaokar
4aa661ab36 Add test for missing stability checker 2015-02-04 02:30:31 +05:30
Manish Goregaokar
c6aaea6725 Fix some missing stability attrs 2015-02-04 02:30:31 +05:30
Manish Goregaokar
6ec5a0f62b Error when #![staged_api] crates are missing stability markers 2015-02-04 02:30:27 +05:30
Alex Crichton
5cf9905e25 std: Add io module again
This commit is an implementation of [RFC 576][rfc] which adds back the `std::io`
module to the standard library. No functionality in `std::old_io` has been
deprecated just yet, and the new `std::io` module is behind the same `io`
feature gate.

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

A good bit of functionality was copied over from `std::old_io`, but many tweaks
were required for the new method signatures. Behavior such as precisely when
buffered objects call to the underlying object may have been tweaked slightly in
the transition. All implementations were audited to use composition wherever
possible. For example the custom `pos` and `cap` cursors in `BufReader` were
removed in favor of just using `Cursor<Vec<u8>>`.

A few liberties were taken during this implementation which were not explicitly
spelled out in the RFC:

* The old `LineBufferedWriter` is now named `LineWriter`
* The internal representation of `Error` now favors OS error codes (a
  0-allocation path) and contains a `Box` for extra semantic data.
* The io prelude currently reexports `Seek` as `NewSeek` to prevent conflicts
  with the real prelude reexport of `old_io::Seek`
* The `chars` method was moved from `BufReadExt` to `ReadExt`.
* The `chars` iterator returns a custom error with a variant that explains that
  the data was not valid UTF-8.
2015-02-03 12:51:12 -08:00
Alex Crichton
d30f225b49 std: Remove iter::ByRef and generalize impls
This removes the `ByRef` iterator adaptor to stay in line with the changes to
`std::io`. The `by_ref` method instead just returns `&mut Self`.

This also removes the implementation of `Iterator for &mut Iterator` and instead
generalizes it to `Iterator for &mut I` where `I: Iterator + ?Sized`. The
`Box<I>` implementations were also updated.

This is a breaking change due to the removal of the `std::iter::ByRef` type. All
mentions of `ByRef<'a, T>` should be replaced with `&mut T` to migrate forward.

[breaking-change]
2015-02-03 12:41:23 -08:00
Manish Goregaokar
0b9e227a16 Move stability pass after privacy pass 2015-02-04 00:32:37 +05:30
Niko Matsakis
8ddcb06b1d Update for new snapshot after rebasing. 2015-02-03 13:14:36 -05:00
Niko Matsakis
68ad6949d4 Correct one case where the inference was detecting a looser result than the
explicit annotation, leading to "extra `mut` declaration" lint errors.
2015-02-03 13:14:29 -05:00
Niko Matsakis
0431134119 Remove the explicit closure kind syntax from the parser and AST;
upgrade the inference based on expected type so that it is able to
infer the fn kind in isolation even if the full signature is not
available (and we could perhaps do better still in some cases, such as
extracting just the types of the arguments but not the return value).
2015-02-03 11:56:16 -05:00