Commit Graph

39760 Commits

Author SHA1 Message Date
Steve Klabnik
044b3bf2d7 Add examples of all three syntaxes in method syntax chapter of trpl
Fixes #18787
2015-03-08 10:49:13 -04:00
Steve Klabnik
1014b22b31 remove confusing language about casting types
Fixes #17481
2015-03-08 10:35:58 -04:00
Steve Klabnik
d65064da34 Move 'more strings' after ownership
Fixes #22553
2015-03-08 09:34:03 -04:00
Steve Klabnik
9653a521b5 Clean up references to opt-out traits
They're opt-in now.

Fixes #22572
2015-03-08 09:32:18 -04:00
Steve Klabnik
5b0acb5846 remove 'generally' to reduce confusion
Fixes #22610
2015-03-08 09:29:47 -04:00
Steve Klabnik
ce223a62f1 Mention deref coercions in the String guide.
Fixes #22637
2015-03-08 09:25:50 -04:00
Steve Klabnik
e56fcbcd99 Remove reference to NoSend in concurrency chapter of the book
Fixes #23052
2015-03-08 09:15:06 -04:00
Steve Klabnik
de44baac8b Add default methods to trait documentation 2015-03-08 08:55:17 -04:00
Amol Mundayoor
45c397d738 Fix array syntax in comment.
Fixes #22721.
2015-03-08 08:39:47 -04:00
Łukasz Niemier
3ad1c83540 Add description of fold function arguments. 2015-03-08 08:38:27 -04:00
Pyry Kontio
6dcc0e5631 Adds an example for PhantomData<T>. 2015-03-08 08:38:10 -04:00
bors
ead9ab84b8 Auto merge of #23167 - rprichard:fix-plugin-rustbook, r=steveklabnik
* "let mut text" was previously of &String type.  Now it is of &str type.

 * Update the slicing syntax.  Both &text[] and text.slice_from() evaluate
   to a &str.

 * We were passing a u32 to expr_usize.  Call expr_u32 instead.

r? @steveklabnik
Fixes #23166
2015-03-08 12:10:42 +00: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
Ryan Prichard
52124d7c80 Fix #23166. Get the Compiler Plugins example compiling again.
* "let met text" was previously of &String type.  Now it is of &str type.

 * Update the slicing syntax.  Both &text[] and text.slice_from() evaluate
   to a &str.

 * We were passing a u32 to expr_usize.  Call expr_u32 instead.
2015-03-07 22:58:28 -08: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
Manish Goregaokar
f81f8d81d3 Register new snapshots (270a677) 2015-03-08 00:36:56 +05:30
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
FuGangqiang
ae7dce674e indicate from_str_radix is code 2015-03-07 18:03:38 +08: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
Niko Matsakis
4e789e03be Remove the coherence impls pass that was specialized to builtin bounds,
since there are separate checks that apply to Copy (and Send uses the
generic defaulted trait rules). Also prohibit `Sized` from being
manually implemented for now.
2015-03-06 18:27:50 -05:00
Niko Matsakis
2e216896e4 Add stricter orphan rules for cross-crate impls of default traits. 2015-03-06 18:27:50 -05:00
Niko Matsakis
dbec033e29 Change the data structures for tracking defaulted traits. In the tcx, we
now have a simple set of trait def-ids. During coherence, we use a
separate table to track the default impls for any given trait so that we
can report a nice error. This fixes various bugs in the metadata
encoding that led to `ty::trait_has_default_impl` yielding the wrong
values in the cross-crate case. (In particular, default impl def-ids
were not included in the list of all impl def-ids; I debated fixing just
that, but this approach seemed cleaner overall, since we usually treat
the "defaulted" bit on traits as being a property of the trait, and now
iterating over a list of impls doesn't intermingle default impls with
normal impls.)
2015-03-06 18:27:50 -05: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
Dan Burkert
e8ed2d4150 Implement std::error::Error for std::sync::mpsc error types 2015-03-06 09:50:05 -08:00