Commit Graph

39585 Commits

Author SHA1 Message Date
Steve Klabnik
a60089903a Add note about pre/post increment to the design FAQ.
Fixes #14686
2015-03-09 16:49:19 -04:00
bors
b2f09c1165 Auto merge of #23127 - alexcrichton:bench-wrapping, r=brson
Right now the rust upgrade in cargo is blocked on fixing this overflow. If a
this benchmark is run it will trigger an overflow error today:

    #[bench]
    fn foo(b: &mut test::Bencher) {}

This commit adds a check on each iteration of the loop that the maximum
multiplier (10) doesn't overflow, and if it does just return the results so far.
2015-03-08 08:34:56 +00:00
bors
d30609ffd7 Auto merge of #23160 - rprichard:fix-numtest-assert, r=brson
The previous code was passing "true" as the panic! error value.
2015-03-08 05:20:17 +00:00
bors
97ca2a1ee9 Auto merge of #23145 - semarie:openbsd-5806, r=alexcrichton
follow freebsd due to last deprecation of `std::old_io::fs`
2015-03-08 01:43:22 +00:00
Ryan Prichard
4a0c7ebc87 Use assert_eq! rather than assert!
The previous code was passing "true" as the panic! error value.
2015-03-07 16:53:01 -08:00
bors
2fc8b1e7c4 Auto merge of #23143 - 5paceToast:cygwin-6.3, r=alexcrichton
Not checking for 32/64 bit, since `uname -s` no longer contains an indicator (and `uname -m` returns correct results)
2015-03-07 21:52:20 +00:00
bors
668c647408 Auto merge of #23137 - kmcallister:derive-sugar, r=sfackler
This is a hack, but I don't think we can do much better as long as `derive` is running at the syntax expansion phase.

If the `custom_derive` feature gate is enabled, this works with user-defined traits and syntax extensions. Without the gate, you can't use e.g. `#[derive_Clone]` directly, so this does not change the stable language.

To make this effective, we now check gated attributes both before and after macro expansion. This uncovered a number of tests that were missing feature gates.

This PR also cleans up the deriving code somewhat, and forbids some previously-meaningless attribute syntax. For this reason it's technically a

    [breaking-change]

r? @sfackler
2015-03-07 18:39:17 +00:00
bors
b8c6eb179e Auto merge of #23146 - lifthrasiir:oh-noes-i-broke-rustdoc-sidebars-what-to-do-now, r=Manishearth
We require the *deferred* loading, not just an opportunistic asynchronous loading. (Yes, that was my oversight, as I only checked it locally...) I think `<script defer>` is safe to use, according to <http://caniuse.com/#feat=script-defer>.
2015-03-07 14:08:29 +00:00
Kang Seonghoon
a3e4a1617b rustdoc: Fixed an asynchronous loading of rustdoc sidebars.
We require the *deferred* loading, not just an opportunistic
asynchronous loading. I think `<script defer>` is safe to use,
according to <http://caniuse.com/#feat=script-defer>.
2015-03-07 23:01:31 +09:00
Sébastien Marie
17d5acc4a0 disable test for issue-5806 on openbsd
follow freebsd due to last deprecation of std::old_io::fs
2015-03-07 13:40:35 +01:00
bors
36cd65f786 Auto merge of #22549 - steveklabnik:doc_documentation, r=huonw
This chapter covers writing documentation in depth.

Fixes #4361
Fixes #12862
Fixes #14070
Fixes #14967
2015-03-07 10:01:13 +00:00
Chloe
9f28f7249f added support for CYGWIN 6.3 into configure script
Not checking for 32/64 bit, since `uname -s` no longer contains an indicator (and `uname -m` returns correct results)
2015-03-07 03:44:02 -05:00
bors
098daa1d7f Auto merge of #23132 - alexcrichton:remove-deprecated-unicode-escapes, r=huonw
These have been deprecated for quite some time, so we should be good to remove
them now.
2015-03-07 06:48:45 +00:00
bors
270a677d4d Auto merge of #23107 - Manishearth:rollup, r=alexcrichton 2015-03-07 03:28:03 +00:00
Alex Crichton
aed31ee08e Test fixes and rebase conflicts 2015-03-06 19:27:36 -08:00
Keegan McAllister
491054f08e Make #[derive(Anything)] into sugar for #[derive_Anything]
This is a hack, but I don't think we can do much better as long as `derive` is
running at the syntax expansion phase.

If the custom_derive feature gate is enabled, this works with user-defined
traits and syntax extensions. Without the gate, you can't use e.g. #[derive_Clone]
directly, so this does not change the stable language.

This commit also cleans up the deriving code somewhat, and forbids some
previously-meaningless attribute syntax. For this reason it's technically a

    [breaking-change]
2015-03-06 18:20:16 -08:00
Keegan McAllister
e60e6f0693 Check gated attributes before and after macro expansion
This is important because attributes can affect expansion.
2015-03-06 17:15:19 -08:00
Alex Crichton
11ddfb8af0 rollup merge of #23124: brson/oldtests 2015-03-06 15:38:09 -08:00
Alex Crichton
bc409cbb4c rollup merge of #23117: japaric/default-impl
fixes #23080

r? @nikomatsakis
cc @FlaPer87
2015-03-06 15:38:06 -08:00
Alex Crichton
3c2c516d0c rollup merge of #23097: alexcrichton/issue-23076
The `rsplitn` call was called with 2 instead of 1 so the iterator would yield 3
items in some cases, not the 2 that it should have.

Closes #23076
2015-03-06 15:37:56 -08:00
Alex Crichton
31af63748b rollup merge of #23091: japaric/phantom
r? @nikomatsakis See the cfail test, it compiles without this patch
cc #13231
2015-03-06 15:37:51 -08:00
Alex Crichton
697de42f69 rollup merge of #23087: nagisa/std-undeadlock
Being a person who somehow has taken a liking to premature optimisation, my knee-jerk reaction to
locking in std handles was preamble resembling following snippet:

    let stdout = stdout();
    let lstdout = stdout.lock();
    let stdin = stdin();
    let lstdin = stdin.lock();

and then reading from the locked handle like this:

    let mut letter = [0; 1];
    lstdin.read(&mut letter).unwrap();

As it is now this code will deadlock because the `read` method attempts to lock stdout as well!

r? @alexcrichton

---

Either way, I find flushing stdout when stdin is used debatable. I believe people who write prompts should take care to flush stdout when necessary themselves.

Another idea: Would be cool if locks on std handles would be taken for a thread, rather than a handle, so given preamble (first code snippet)

    stdin.lock()

or more generally

    stdin.read(…)

worked fine. I.e. if more than a single lock are all taken inside the same thread, it would work, though not sure if our synchronisation primitives are expressive enough to make it possible.
2015-03-06 15:37:47 -08:00
Alex Crichton
2bd02ca837 rollup merge of #22975: alexcrichton/stabilize-ffi
Conflicts:
	src/librustc_trans/back/link.rs
	src/librustc_trans/lib.rs
2015-03-06 15:37:14 -08:00
Alex Crichton
fd86a01bb9 rollup merge of #22813: alexcrichton/deprecate-net
The `std::net` primitives should be ready for use now and as a result the old
ones are now deprecated and slated for removal. Most TCP/UDP functionality is
now available through `std::net` but the `std::old_io::net::pipe` module is
removed entirely from the standard library.

Unix socket funtionality can be found in sfackler's [`unix_socket`][unix] crate
and there is currently no replacement for named pipes on Windows.

[unix]: https://crates.io/crates/unix_socket

[breaking-change]
2015-03-06 15:36:08 -08:00
Alex Crichton
1a30412ebf Suppress some warnings about features 2015-03-06 15:11:59 -08:00
Keegan McAllister
63ee3fe566 Consolidate ExpansionConfig feature tests 2015-03-06 14:12:28 -08:00
Alex Crichton
39e2c69541 syntax: Remove deprecated unicode escapes
These have been deprecated for quite some time, so we should be good to remove
them now.
2015-03-06 14:11:09 -08:00
Alex Crichton
16ff1401d8 std: Ignore a test on windows
This test is known to fail on windows.
2015-03-06 13:55:06 -08:00
Alex Crichton
946a3963f3 test: Fix an overflow on empty benchmarks
Right now the rust upgrade in cargo is blocked on fixing this overflow. If a
this benchmark is run it will trigger an overflow error today:

    #[bench]
    fn foo(b: &mut test::Bencher) {}

This commit adds a check on each iteration of the loop that the maximum
multiplier (10) doesn't overflow, and if it does just return the results so far.
2015-03-06 12:01:23 -08:00
bors
4d716decb5 Auto merge of #22474 - iKevinY:pandoc-version-check, r=brson
Executing `configure` seems to create the following error due to how the script [parses Pandoc's version](https://github.com/rust-lang/rust/blob/master/configure#L705):

```text
./configure: line 705: [: pandoc: integer expression expected
./configure: line 705: [: 1.12.4.2: integer expression expected
```

This issue seems to stem from a discrepancy between BSD and GNU versions of sed. This patch changes the sed command to use an extended regex, which works with both flavours of sed.
2015-03-06 19:04:53 +00:00
Alex Crichton
9aea749b83 std: Deprecate the std::old_io::net primitives
The `std::net` primitives should be ready for use now and as a result the old
ones are now deprecated and slated for removal. Most TCP/UDP functionality is
now available through `std::net` but the `std::old_io::net::pipe` module is
removed entirely from the standard library.

Unix socket funtionality can be found in sfackler's [`unix_socket`][unix] crate
and there is currently no replacement for named pipes on Windows.

[unix]: https://crates.io/crates/unix_socket

[breaking-change]
2015-03-06 10:27:28 -08:00
Brian Anderson
f7594e14b8 Remove two green threading tests 2015-03-06 10:10:47 -08:00
Jorge Aparicio
8a391dd8cf move check into wf pass, add a test for assoc types 2015-03-06 12:37:28 -05:00
Manish Goregaokar
7ed4660a51 Rollup merge of #22474 - iKevinY:pandoc-version-check, r=brson
Executing `configure` seems to create the following error due to how the script [parses Pandoc's version](https://github.com/rust-lang/rust/blob/master/configure#L705):

```text
./configure: line 705: [: pandoc: integer expression expected
./configure: line 705: [: 1.12.4.2: integer expression expected
```

This issue seems to stem from a discrepancy between BSD and GNU versions of sed. This patch changes the sed command to use an extended regex, which works with both flavours of sed.
2015-03-06 22:22:40 +05:30
Manish Goregaokar
61c6b199bc BufferedWriter -> BufWriter (fixup #23060) 2015-03-06 22:22:39 +05:30
Manish Goregaokar
aaaa4310cc Rollup merge of #23100 - wesleywiser:fix_23059, r=brson
Fixes #23059
2015-03-06 22:22:38 +05:30
Manish Goregaokar
ae16afb9e3 Rollup merge of #23096 - posborne:paths-documentation-grammar-fix, r=huonw 2015-03-06 22:22:37 +05:30
Manish Goregaokar
88cef035b0 Rollup merge of #23094 - brson:beta, r=huonw
No more alphas, please.
2015-03-06 22:22:35 +05:30
Manish Goregaokar
a14d6a9052 Rollup merge of #23082 - killercup:patch-6, r=alexcrichton
This should fix #22615. Previously, the playpen links grabbed the content of all `.rusttest` containers on the same level to build the URL. Now they just select the one before the `pre` they are shown in.

I have only tested this by changing the file in my local build of the docs (not by running rustdoc itself).
2015-03-06 22:22:35 +05:30
Manish Goregaokar
babd41e5e7 Rollup merge of #23067 - oli-obk:doc_examle_fix, r=alexcrichton
The compiler even tells us this won't work.
```
let mut i = s.len();
while i < 0 { ... }
```
2015-03-06 22:22:34 +05:30
Manish Goregaokar
2fcdd824ef Rollup merge of #23056 - awlnx:master, r=nrc 2015-03-06 22:22:33 +05:30
Manish Goregaokar
ce2d04a77a Rollup merge of #23048 - davbo:fix-broken-link-in-old-guide, r=brson
Having come back to rust recently after > 6months I was looking for docs
on tasks and stumbled upon this broken link.
2015-03-06 22:22:32 +05:30
Manish Goregaokar
55087e78fa Rollup merge of #23045 - ctjhoa:master, r=Manishearth
r? @steveklabnik
2015-03-06 22:22:32 +05:30
Manish Goregaokar
417639885c Rollup merge of #23025 - huonw:better-iter-infer, r=Gankro
This concretely improves type inference of some cases (see included
test). I assume the compiler struggles to reason about multiple layers
of generic type parameters (even with associated-type equalities) but
*can* understand pure associated types, since they are always directly
computable from the input types.

Thanks to @shepmaster for noticing the issue with `Cloned` (I took that example as a test case).
2015-03-06 22:22:31 +05:30
Manish Goregaokar
7a2eea5808 Rollup merge of #23101 - laijs:fix-file-perm, r=alexcrichton
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2015-03-06 22:22:30 +05:30
Manish Goregaokar
56e0229f9a Rollup merge of #23099 - brson:lint-cstack, r=alexcrichton 2015-03-06 22:22:29 +05:30
Manish Goregaokar
f2a1cf2cb4 Rollup merge of #23098 - brson:ignore-fast, r=alexcrichton 2015-03-06 22:22:28 +05:30
Jorge Aparicio
707f7a1617 Check that traits with default impls have no methods
fixes #23080
2015-03-06 08:50:34 -05:00
Simonas Kazlauskas
3f94260b0f Fix an easy to trigger deadlock in std::io::stdio
Being a person who somehow has taken a liking to premature optimisation, my knee-jerk reaction to
locking in std handles was preamble resembling following snippet:

    let stdout = stdout();
    let lstdout = stdout.lock();
    let stdin = stdin();
    let lstdin = stdin.lock();

and then reading from the locked handle like this:

    let mut letter = [0; 1];
    lstdin.read(&mut letter).unwrap();

As it is now this code will deadlock because the `read` method attempts to lock stdout as well!
2015-03-06 11:22:07 +02:00
bors
1fe8f22145 Auto merge of #22899 - huonw:macro-stability, r=alexcrichton
Unstable items used in a macro expansion will now always trigger
stability warnings, *unless* the unstable items are directly inside a
macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns
unless the span of the unstable item is a subspan of the definition of a
macro marked with that attribute.

E.g.

    #[allow_internal_unstable]
    macro_rules! foo {
        ($e: expr) => {{
            $e;
            unstable(); // no warning
            only_called_by_foo!();
        }}
    }

    macro_rules! only_called_by_foo {
        () => { unstable() } // warning
    }

    foo!(unstable()) // warning

The unstable inside `foo` is fine, due to the attribute. But the
`unstable` inside `only_called_by_foo` is not, since that macro doesn't
have the attribute, and the `unstable` passed into `foo` is also not
fine since it isn't contained in the macro itself (that is, even though
it is only used directly in the macro).

In the process this makes the stability tracking much more precise,
e.g. previously `println!("{}", unstable())` got no warning, but now it
does. As such, this is a bug fix that may cause [breaking-change]s.

The attribute is definitely feature gated, since it explicitly allows
side-stepping the feature gating system.

---

This updates `thread_local!` macro to use the attribute, since it uses
unstable features internally (initialising a struct with unstable
fields).
2015-03-06 05:20:11 +00:00