Commit Graph

36624 Commits

Author SHA1 Message Date
Alex Crichton
cc20935ad8 rollup merge of #20570: sanxiyn/no-analysis 2015-01-06 15:24:55 -08:00
Alex Crichton
f358dbf1e7 rollup merge of #20557: cactorium/prettyprinters
As per https://github.com/rust-lang/rust/issues/20405. To be more precise, the changes just the processing of enums when the name is "RUST$ENCODED$ENUM$..." so it correctly parses when there is more than one number encoding the location of the field it's looking for to determine state of the enum
2015-01-06 15:24:52 -08:00
Piotr Czarnecki
d85c017f92 Cleanup and followup to PR #17830: parsing changes
Prevents breaking down `$name` tokens into separate `$` and `name`.
Reports unknown macro variables.

Fixes #18775
Fixes #18839
Fixes #15640
2015-01-07 00:24:48 +01:00
Alex Crichton
e2f97f51ad Register new snapshots
Conflicts:
	src/librbml/lib.rs
	src/libserialize/json_stage0.rs
	src/libserialize/serialize_stage0.rs
	src/libsyntax/ast.rs
	src/libsyntax/ext/deriving/generic/mod.rs
	src/libsyntax/parse/token.rs
2015-01-06 15:24:24 -08:00
Alex Crichton
5c3ddcb15d rollup merge of #20481: seanmonstar/fmt-show-string
Conflicts:
	src/compiletest/runtest.rs
	src/libcore/fmt/mod.rs
	src/libfmt_macros/lib.rs
	src/libregex/parse.rs
	src/librustc/middle/cfg/construct.rs
	src/librustc/middle/dataflow.rs
	src/librustc/middle/infer/higher_ranked/mod.rs
	src/librustc/middle/ty.rs
	src/librustc_back/archive.rs
	src/librustc_borrowck/borrowck/fragments.rs
	src/librustc_borrowck/borrowck/gather_loans/mod.rs
	src/librustc_resolve/lib.rs
	src/librustc_trans/back/link.rs
	src/librustc_trans/save/mod.rs
	src/librustc_trans/trans/base.rs
	src/librustc_trans/trans/callee.rs
	src/librustc_trans/trans/common.rs
	src/librustc_trans/trans/consts.rs
	src/librustc_trans/trans/controlflow.rs
	src/librustc_trans/trans/debuginfo.rs
	src/librustc_trans/trans/expr.rs
	src/librustc_trans/trans/monomorphize.rs
	src/librustc_typeck/astconv.rs
	src/librustc_typeck/check/method/mod.rs
	src/librustc_typeck/check/mod.rs
	src/librustc_typeck/check/regionck.rs
	src/librustc_typeck/collect.rs
	src/libsyntax/ext/format.rs
	src/libsyntax/ext/source_util.rs
	src/libsyntax/ext/tt/transcribe.rs
	src/libsyntax/parse/mod.rs
	src/libsyntax/parse/token.rs
	src/test/run-pass/issue-8898.rs
2015-01-06 15:22:24 -08:00
Jakub Vrána
7846eb6aaa Use a better word in the guide 2015-01-06 15:13:47 -08:00
Nick Cameron
9f07d055f7 markers -> marker 2015-01-07 12:10:31 +13:00
Alex Crichton
5f27b50080 rollup merge of #20609: cmr/mem 2015-01-06 15:07:48 -08:00
Alex Crichton
1afe8a4fb8 rollup merge of #20562: nick29581/arrays-3 2015-01-06 15:05:53 -08:00
Nick Cameron
0c7f7a5fb8 fallout 2015-01-07 12:02:52 +13:00
Corey Richardson
ac8e10519a Stricter rules surrounding adjacent nonterminals and sequences 2015-01-06 18:02:00 -05:00
Aaron Turon
caca9b2e71 Fallout from stabilization 2015-01-06 14:57:52 -08:00
Sean McArthur
44440e5c18 core: split into fmt::Show and fmt::String
fmt::Show is for debugging, and can and should be implemented for
all public types. This trait is used with `{:?}` syntax. There still
exists #[derive(Show)].

fmt::String is for types that faithfully be represented as a String.
Because of this, there is no way to derive fmt::String, all
implementations must be purposeful. It is used by the default format
syntax, `{}`.

This will break most instances of `{}`, since that now requires the type
to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the
correct fix. Types that were being printed specifically for users should
receive a fmt::String implementation to fix this.

Part of #20013

[breaking-change]
2015-01-06 14:49:42 -08:00
Niko Matsakis
d31105e4f5 Add new tests covering various cases. 2015-01-06 17:17:49 -05:00
Niko Matsakis
d91323992c Fix fallout in tests. 2015-01-06 17:17:49 -05:00
Niko Matsakis
2375a79152 Implement impl reachability rules. This is a [breaking-change]. Type
parameters on impls must now also appear in the trait ref, self type,
or some associated type declared on the impl. This ensures that they
are constrianed in some way and that the semantics of the trait system
are well-defined (always a good thing).

There are three major ways to fix this error:

1. Convert the trait to use associated types; most often the type
   parameters are not constrained because they are in fact outputs of
   the impl.

2. Move the type parameters to methods.

3. Add an additional type parameter to the self type or trait so that
   the unused parameter can appear there.

In some cases, it is not possible to fix the impl because the trait
definition needs to be changed first (and that may be out of your
control). In that case, for the time being, you can opt out of these
rules by using `#[old_impl_check]` on the impl and adding a
`#![feature(old_impl_check)]` to your crate declaration.
2015-01-06 17:17:48 -05:00
Niko Matsakis
3ed7f067dc Fix fallout in libs. For the most part I just tagged impls as #[old_impl_check]. 2015-01-06 17:17:48 -05:00
Jonathan Reem
2404232369 Remove the unneeded Sized bound on TypeId creation
This bound is probably unintentional and is unnecessarily
constricting.
2015-01-06 22:59:07 +01:00
Nick Cameron
791f545685 Pretty print empty structs properly 2015-01-07 10:49:00 +13:00
Nick Cameron
480374a696 Only use built-in indexing for uint indexes 2015-01-07 10:49:00 +13:00
Nick Cameron
77ed497456 Tests 2015-01-07 10:49:00 +13:00
Nick Cameron
e970db37a9 Remove old slicing hacks and make new slicing work 2015-01-07 10:49:00 +13:00
Corey Richardson
5a4ca31918 test fallout from isize/usize 2015-01-06 16:48:33 -05:00
Nick Cameron
f7ff37e4c5 Replace full slice notation with index calls 2015-01-07 10:46:33 +13:00
Nick Cameron
918255ef8c Impls using the new scheme for slicing 2015-01-07 10:24:19 +13:00
Nick Cameron
91ba66fa99 Review changes 2015-01-07 09:46:16 +13:00
Nick Cameron
ba2a77b450 stabilisation 2015-01-07 09:46:16 +13:00
Nick Cameron
503709708c Change std::kinds to std::markers; flatten std::kinds::marker
[breaking-change]
2015-01-07 09:45:28 +13:00
Corey Richardson
abcbe27695 syntax/rustc: implement isize/usize 2015-01-06 15:15:07 -05:00
Alex Crichton
169fbed251 std: Revert stability of Entry-based APIs
There's been some debate over the precise form that these APIs should take, and
they've undergone some changes recently, so these APIs are going to be left
unstable for now to be fleshed out during the next release cycle.
2015-01-06 11:59:26 -08:00
Dylan Ede
25eada1574 [breaking change] Revert Entry behaviour to take keys by value. 2015-01-06 11:59:26 -08:00
bors
ea6f65c5f1 auto merge of #20633 : vhbit/rust/ios-cstring, r=brson 2015-01-06 19:47:08 +00:00
Niko Matsakis
2486d93e5b Fix ICE that @steveklabnik encountered in rust-ice. The problems turned out to be that were being very loose with bound regions in trans (we were basically just ignoring and flattening binders). Since binders are significant to subtyping and hence to trait selection, this can cause a lot of problems. So this patch makes us treat them more strictly -- for example, we propagate binders, and avoid skipping past the Binder by writing foo.0.
Fixes #20644.
2015-01-06 13:42:42 -05:00
Michael Neumann
134eb0e26f Tuning pthread_key_t type
Both FreeBSD and DragonFly define pthread_key_t as int, while Linux
defines it as uint. As pthread_key_t is used as an opaque type and
storage size of both int and uint are the same, this is rather a
cosmetic change.

iOS uses ulong (as OS X) so difference is critical on 64bit platforms.
2015-01-06 20:12:19 +02:00
klutzy
68cb17097a std: prevent CreateProcess() race on Windows
Believe or not, `CreateProcess()` is racy if several threads create
child processes: [0], [1], [2].

This caused some tests show crash dialogs during
`make check-stage#-rpass`.

More explanation:

On Windows, `SetErrorMode()` controls display of error dialogs: it
accepts new error mode and returns old error mode.
The error mode is process-global and automatically inherited to child
process when created.

MSYS2 bash shell internally sets it to not show error dialogs, therefore
`make check-stage#-rpass` should not show them either.

However, [1] says that `CreateProcess()` internally invokes
`SetErrorMode()` twice: at first it sets mode `0x8001` and saves
original mode, and at second it restores original mode.
So if two threads simultaneously call `CreateProcess()`, the first
thread sets error mode to `0x8001` then the second thread recognizes
that current error mode is `0x8001`. Therefore, The second thread will
create process with wrong error mode.

This really occurs inside `compiletest`: it creates several processes on
each thread, so some `run-pass` tests are invoked with wrong error mode
therefore show crash dialog.

This commit adds `StaticMutex` for `CreateProcess()` call. This seems
to fix the "dialog annoyance" issue.

[0]: http://support.microsoft.com/kb/315939
[1]: https://code.google.com/p/nativeclient/issues/detail?id=2968
[2]: https://ghc.haskell.org/trac/ghc/ticket/2650
2015-01-07 03:07:49 +09:00
Aaron Turon
7de9a73ab5 Stabilize std::error
This commit is a first past stabilization of `std::error`:

* The module is stable.
* The `FromError` trait and impls are stable
* The `Error` trait itself is left unstable, pending current APIs and
  possible revisions during the alpha cycle.
2015-01-06 09:20:40 -08:00
Alexander Light
570bda6657 update zsh rust completions 2015-01-06 12:15:41 -05:00
Aaron Turon
f67b81e8d4 Stabilize std::thread
This commit takes a first pass at stabilizing `std::thread`:

* It removes the `detach` method in favor of two constructors -- `spawn`
  for detached threads, `scoped` for "scoped" (i.e., must-join)
  threads. This addresses some of the surprise/frustrating debug
  sessions with the previous API, in which `spawn` produced a guard that
  on destruction joined the thread (unless `detach` was called).

  The reason to have the division in part is that `Send` will soon not
  imply `'static`, which means that `scoped` thread creation can take a
  closure over *shared stack data* of the parent thread. On the other
  hand, this means that the parent must not pop the relevant stack
  frames while the child thread is running. The `JoinGuard` is used to
  prevent this from happening by joining on drop (if you have not
  already explicitly `join`ed.) The APIs around `scoped` are
  future-proofed for the `Send` changes by taking an additional lifetime
  parameter. With the current definition of `Send`, this is forced to be
  `'static`, but when `Send` changes these APIs will gain their full
  flexibility immediately.

  Threads that are `spawn`ed, on the other hand, are detached from the
  start and do not yield an RAII guard.

  The hope is that, by making `scoped` an explicit opt-in with a very
  suggestive name, it will be drastically less likely to be caught by a
  surprising deadlock due to an implicit join at the end of a scope.

* The module itself is marked stable.

* Existing methods other than `spawn` and `scoped` are marked stable.

The migration path is:

```rust
Thread::spawn(f).detached()
```

becomes

```rust
Thread::spawn(f)
```

while

```rust
let res = Thread::spawn(f);
res.join()
```

becomes

```rust
let res = Thread::scoped(f);
res.join()
```

[breaking-change]
2015-01-06 09:04:48 -08:00
Corey Richardson
e0b4287df6 Fix fallout 2015-01-06 12:04:41 -05:00
Corey Richardson
6680c9c5c7 syntax: implement 'macro input future proofing'
See RFC 550 (https://github.com/rust-lang/rfcs/pull/550) for the motivation
and details.

If this breaks your code, add one of the listed tokens after the relevant
non-terminal in your matcher.

[breaking-change]
2015-01-06 12:03:12 -05:00
bors
6539cb417f auto merge of #20618 : alexcrichton/rust/less-warn, r=brson
This warning has been around in the compiler for quite some time now, but the
real place for a warning like this, if it should exist, is in Cargo, not in the
compiler itself. It's a first-class feature of Cargo that multiple versions of a
crate can be compiled into the same executable, and we shouldn't be warning
about our first-class features.
2015-01-06 16:42:43 +00:00
Jorge Aparicio
ec133fed40 cleanup: use short AT notation (Ty::Item instead of <Ty as Trait>::Item) 2015-01-06 11:23:18 -05:00
Alex Crichton
9d0b3c9fc9 rustc: Turn off multiple versions of crate warning
This warning has been around in the compiler for quite some time now, but the
real place for a warning like this, if it should exist, is in Cargo, not in the
compiler itself. It's a first-class feature of Cargo that multiple versions of a
crate can be compiled into the same executable, and we shouldn't be warning
about our first-class features.
2015-01-06 08:22:59 -08:00
bors
8efd9901b6 auto merge of #20573 : huonw/rust/num-stab-2, r=alexcrichton
cc #19260 

Open questions:

- I still feel weird about marking functions like `exp` as `#[stable]` in `core` since they're highly likely to call into libm which is theoretically something core is designed to avoid and so we may be forced/want to move it at some point in the future, and so it feels like a lie to call it `#[stable]` (I know `core` is `#[experimental]`, but still...)
- `abs_sub` is a horrible name IMO: it feels like it is `(a - b).abs()`, but it is actually `(a - b).max(0.)`. maybe something along the lines of `pos_diff` ("positive difference") is better.
- the associated-function nature of `Int::from_be` and `Int::from_le` feel strange to me, it feels like they should be methods, but I cannot think of a good name.

I'm also not hugely in favour of `ldexp` and `frexp` but the precedent from C is large. (e.g. AFAICT,  `ldexp` must mean "load exponent" which is essentially what it does... but only for a subset of its inputs.)
2015-01-06 13:30:29 +00:00
Valerii Hiora
72e08006da iOS: CString fallout 2015-01-06 15:21:04 +02:00
Huon Wilson
f3a80ab9d2 Apply stability attributes to core::num::{Int, SignedInt, UnsignedInt}. 2015-01-06 23:21:27 +11:00
Huon Wilson
49feb0c431 Unstabilise f32/f64 constants that are int/uint.
Pending integer conventions.
2015-01-06 23:21:27 +11:00
Huon Wilson
65922dd42d Apply stability attributes to std::num::Float. 2015-01-06 23:21:27 +11:00
Huon Wilson
ae4762761c Merge core::num::Float and std::num::FloatMath.
`FloatMath` no longer exists and all functionality from both traits is
available under `Float`. Change from

    use std::num::{Float, FloatMath};

to

    use std::num::Float;

[breaking-change]
2015-01-06 23:21:27 +11:00
Huon Wilson
1291fc76e0 Reword unstability message for core::num::Float. 2015-01-06 23:21:01 +11:00