Commit graph

26341 commits

Author SHA1 Message Date
Randati
0e12934ed3 Revert erroneous fix to tutorial 2014-05-29 15:11:53 +03:00
bors
ff2bf58e9e auto merge of #14481 : alexcrichton/rust/no-format-strbuf, r=sfackler
* Removes `format_strbuf!()`
2014-05-29 03:31:39 -07:00
bors
cb3c4f9c82 auto merge of #14472 : huonw/rust/native-lib-warnings, r=alexcrichton
rustc: clarify warning about native deps for a staticlib.

This adjusts the "unlinked native library" warning one receives when
compiling with `crate_type="staticlib"`. The warning is just trying to
tell the user that they need to link against these libraries, but the
old text wasn't making this obvious, the new text says this explicitly.
2014-05-29 00:16:41 -07:00
bors
a6a1c9071a auto merge of #14477 : alexcrichton/rust/issue-14456, r=brson
When spawning a process, stdio file descriptors can be configured to be ignored,
which basically means that they'll be closed. Currently this is done by
literally closing the file descriptors in the child, but this can have adverse
side effects if the child process then opens a new file descriptor, assigning it
to a stdio number.

To work around the problems of the child, this commit alters the process
spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on
windows) when they are specified as being ignored. This should allow spawned
programs to have more expected behavior when opening new files.

Closes #14456
2014-05-28 22:41:38 -07:00
Kevin Ballard
eb98c9eeaa Replace StrAllocating.into_owned() with .into_string()
We already have into_string(), but it was implemented in terms of
into_owned(). Flip it around and deprecate into_owned().

Remove a few spurious calls to .into_owned() that existed in libregex
and librustdoc.
2014-05-28 21:31:19 -07:00
bors
1489374750 auto merge of #14451 : alexcrichton/rust/issue-14442, r=brson
This avoids having to perform conversions from `*u8` to `&'static str` which can
suck in a good deal of code.

Closes #14442
2014-05-28 20:01:37 -07:00
bors
aa151956a7 auto merge of #14465 : Ryman/rust/patch-1, r=alexcrichton 2014-05-28 16:01:36 -07:00
bors
dc5ce0a970 auto merge of #14298 : kmcallister/rust/pattern-macros, r=huonw
First commit is an unrelated fix for a test suite warning I introduced last week.
2014-05-28 14:21:40 -07:00
Keegan McAllister
fd40d0cf5b Test pattern macros 2014-05-28 12:42:21 -07:00
Keegan McAllister
55776f2822 Parse macros in patterns
Fixes #6830.
2014-05-28 12:42:21 -07:00
Keegan McAllister
b2f6dd53c9 Expand macros in patterns 2014-05-28 12:42:21 -07:00
Keegan McAllister
00704ea33b Add patterns to MacResult 2014-05-28 12:42:21 -07:00
Keegan McAllister
5fdd0e4b05 Add AST node for pattern macros 2014-05-28 12:42:21 -07:00
Keegan McAllister
28a4ee5eeb Silence warning in RefCell test suite 2014-05-28 12:42:21 -07:00
bors
e865415c2f auto merge of #14464 : Sawyer47/rust/issue-12925, r=alexcrichton
This is an attempt of fixing #12925.

This PR moves almost all trait implementations for primitive types ((), bool, char, i*, u*, f*) near trait definitions. Only Float trait implementations weren't moved because they heavily rely on constants defined in f32.rs and f64.rs.

Some trait implementations had cfg(not(test)) attribute. I suspect it's because of issue 2912.
Still, someone who knows the problem better should probably check this code.

Closes #12925
2014-05-28 12:41:40 -07:00
Alex Crichton
f786f9bb15 rustc: Accept PartialOrd/PartialOrdEq for Eq/Ord
This is a transitionary step towards completing #12517. This change modifies the
compiler to accept Partial{Ord,Eq} as deriving modes which will currently expand
to implementations of PartialOrd and PartialEq (synonyms for Eq/Ord).

After a snapshot, all of deriving(Eq, Ord) will be removed, and after a snapshot
of that, TotalEq/TotalOrd will be renamed to Eq/Ord.
2014-05-28 10:02:06 -07:00
Ariel Ben-Yehuda
2e8bc9924c Issue #13933: Remove transmute_mut from Arc
directly use the internal pointer instead.
2014-05-28 19:39:46 +03:00
bors
cd6fb59ee2 auto merge of #14437 : Sawyer47/rust/utf16-items, r=alexcrichton
According to Rust's style guide acronyms should be CamelCase.
2014-05-28 09:26:42 -07:00
Ariel Ben-Yehuda
def2232595 Issue #13933: Remove transmute_mut from IO
The IO libraries casted self to mut so they can pass it to seek(SEEK_CUR, 0).
Fix this by introducing a private seek function that takes &self
  - of course one should be careful with it if he lacks an
    exclusive reference to self.
2014-05-28 19:25:51 +03:00
Alex Crichton
42aed6bde2 std: Remove format_strbuf!()
This was only ever a transitionary macro.
2014-05-28 08:35:41 -07:00
Piotr Jawniak
dd0d495f50 Move trait impls for primitives near trait definition
Closes #12925
2014-05-28 17:15:35 +02:00
bors
9659a50957 auto merge of #14463 : SergioBenitez/rust/deprecation-fix, r=alexcrichton
The deprecation warning text for mem::move_val_init was incorrect. It should point users to `overwrite` instead of itself.
2014-05-28 07:46:45 -07:00
Simon Sapin
17697c78c5 Doc: static mut is unsafe too
According to the corresponding section, accessing a mutable static variable requires `unsafe` too, and I believe it counts as as language level feature. Add it to the relevant list in the Unsafety section.
2014-05-28 14:19:25 +01:00
bors
24b1ce1daf auto merge of #14458 : huonw/rust/rustdoc-cross-crate-link-path, r=alexcrichton
Previously this was adding one-too-many `..`s to the path for the
`gotosrc=...` links for local crates. Also, the `root_path` already ends
in `/`s so a trailing / shouldn't be added after the root (some servers
treat `...//...` different to `.../...` including the one running
doc.rust-lang.org).
2014-05-28 06:06:47 -07:00
Huon Wilson
3482ab3699 rustdoc: cross-crate source links are one level lower.
Previously this was adding one-too-many `..`s to the path for the
`gotosrc=...` links for local crates. Also, the `root_path` already ends
in `/`s so a trailing / shouldn't be added after the root (some servers
treat `...//...` different to `.../...` including the one running
doc.rust-lang.org).
2014-05-28 22:02:14 +10:00
bors
bee42a9413 auto merge of #14459 : seanmonstar/rust/select-docs, r=alexcrichton 2014-05-28 04:21:42 -07:00
bors
0a092a8158 auto merge of #14455 : crabtw/rust/mips, r=alexcrichton
Because IPv4 address conversion doesn't consider big-endian target, I add functions to handle that.
These function names may need to be changed, but I can't come up with a good one.
2014-05-28 02:41:44 -07:00
Piotr Jawniak
8c5a8e10b2 Rename UTF16Item[s] to Utf16Item[s]
According to Rust's style guide acronyms should be CamelCase.

[breaking-change]
2014-05-28 11:31:21 +02:00
bors
7e049fefc7 auto merge of #14452 : alexcrichton/rust/issue-14438, r=huonw
This commit alters rustdoc to keep a hash set of known inlined items which is a
whitelist for generating URLs to.

Closes #14438
2014-05-27 23:26:47 -07:00
Ahmed Charles
4e3db5e0f4 Rename PatUniq to PatBox. Fixes part of #13910. 2014-05-27 22:19:29 -07:00
bors
1dea8834cc auto merge of #14364 : alexcrichton/rust/libdebug, r=brson
This commit moves reflection (as well as the {:?} format modifier) to a new
libdebug crate, all of which is marked experimental.

This is a breaking change because it now requires the debug crate to be
explicitly linked if the :? format qualifier is used. This means that any code
using this feature will have to add `extern crate debug;` to the top of the
crate. Any code relying on reflection will also need to do this.

Closes #12019

[breaking-change]
2014-05-27 21:46:46 -07:00
Alex Crichton
b53454e2e4 Move std::{reflect,repr,Poly} to a libdebug crate
This commit moves reflection (as well as the {:?} format modifier) to a new
libdebug crate, all of which is marked experimental.

This is a breaking change because it now requires the debug crate to be
explicitly linked if the :? format qualifier is used. This means that any code
using this feature will have to add `extern crate debug;` to the top of the
crate. Any code relying on reflection will also need to do this.

Closes #12019

[breaking-change]
2014-05-27 21:44:51 -07:00
Alex Crichton
4ef535ebd0 rustdoc: Only link to local inlined foreign items
This commit alters rustdoc to keep a hash set of known inlined items which is a
whitelist for generating URLs to.

Closes #14438
2014-05-27 19:33:57 -07:00
bors
73dac7e4e6 auto merge of #14387 : alan-andrade/rust/remove_managed_boxes_and_gc, r=brson
My main goals were:
- be clear when we talk about "references" and "pointers"
- remove Managed boxes completely and the concept of GC.

https://github.com/mozilla/rust/issues/13987
2014-05-27 19:31:46 -07:00
Alex Crichton
034eb4e724 native: Ignore stdio fds with /dev/null
When spawning a process, stdio file descriptors can be configured to be ignored,
which basically means that they'll be closed. Currently this is done by
literally closing the file descriptors in the child, but this can have adverse
side effects if the child process then opens a new file descriptor, assigning it
to a stdio number.

To work around the problems of the child, this commit alters the process
spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on
windows) when they are specified as being ignored. This should allow spawned
programs to have more expected behavior when opening new files.

Closes #14456
2014-05-27 17:49:31 -07:00
bors
911cc9c352 auto merge of #14414 : richo/rust/features/nerf_unused_string_fns, r=alexcrichton
This should block on #14323
2014-05-27 17:46:48 -07:00
bors
30bf73fd78 auto merge of #14447 : erickt/rust/show-treemap, r=kballard
This is a hodge podge of a couple small cleanup commits. It implements `Show` for `TreeMap` and `TreeSet`, and some removal of commented out code.
2014-05-27 16:11:39 -07:00
Huon Wilson
a167caf106 rustc: clarify warning about native deps for a staticlib.
This adjusts the "unlinked native library" warning one receives when
compiling with `crate_type="staticlib"`. The warning is just trying to
tell the user that they need to link against these libraries, but the
old text wasn't making this obvious; the new text says this explicitly.
2014-05-28 09:03:51 +10:00
bors
1fc29ef0c8 auto merge of #14444 : huonw/rust/nice-for-errors, r=alexcrichton
Change `for` desugaring & make refutable pattern errors more precise

This changes for to desugar to the `let`-based pattern match as described in #14390, and adjusts the compiler to use this information for error messages that even mention that it's in a `for` loop.

Also, it makes the compiler record the exact positions of refutable parts of a pattern, to point to exactly them in error messages.
2014-05-27 14:36:40 -07:00
Ryman
ada85a202b rust manual: supertraits seperator is wrong 2014-05-27 21:40:50 +01:00
bors
1e2bb09bbb auto merge of #14435 : P1start/rust/str-docs-fix, r=sfackler
This tweaks the `std::str` docs to compensate for the recent shift from `~str` to `String`.
2014-05-27 13:01:40 -07:00
Richo Healey
c256dcf8b6 doc: Fix link to string
This was missed in 553074506e
2014-05-27 12:59:31 -07:00
Richo Healey
1f1b2e42d7 std: Rename strbuf operations to string
[breaking-change]
2014-05-27 12:59:31 -07:00
bors
5811d2bd96 auto merge of #14428 : alexcrichton/rust/issue-14422, r=pcwalton
This ensures that a public typedef to a private item is ensured to be public in
terms of linkage. This affects both the visibility of the library's symbols as
well as other lints based on privacy (dead_code for example).

Closes #14421
Closes #14422
2014-05-27 11:26:40 -07:00
Sergio Benitez
ac833da183 Fixed deprecation warning text for mem::move_val_init and its associated comment. 2014-05-27 14:15:34 -04:00
Richo Healey
4348e23b26 std: Remove String's to_owned 2014-05-27 11:11:15 -07:00
Erick Tryzelaar
926504c885 collections: implement Show for Tree{Map,Set} 2014-05-27 10:38:52 -07:00
Erick Tryzelaar
e9e799f750 collections: add Show impl test for HashMap 2014-05-27 10:20:02 -07:00
Erick Tryzelaar
85d9cfb809 serialize: Remove old commented out code 2014-05-27 10:20:02 -07:00
Jyun-Yan You
abc2a92d9c fix MIPS target 2014-05-28 01:15:24 +08:00
Alex Crichton
49a65815f1 rustc: Account for typedefs in privacy
This ensures that a public typedef to a private item is ensured to be public in
terms of linkage. This affects both the visibility of the library's symbols as
well as other lints based on privacy (dead_code for example).

Closes #14421
Closes #14422
2014-05-27 09:04:08 -07:00
Sean McArthur
c710023197 std: change select! docs from 'ports' to 'receivers' 2014-05-27 07:20:06 -07:00
bors
a01bedc2cd auto merge of #14429 : sanrodari/rust/patch-1, r=sfackler 2014-05-27 02:16:32 -07:00
Alex Crichton
5c1a70d498 rustc: Use rust strings for failure arguments
This avoids having to perform conversions from `*u8` to `&'static str` which can
suck in a good deal of code.

Closes #14442
2014-05-27 00:33:05 -07:00
Richo Healey
c7fe4ffe3d std: Remove String::from_owned_str as it's redundant
[breaking-change]
2014-05-26 19:06:13 -07:00
Huon Wilson
0df221e993 rustc: provide more precise information about refutable patterns.
The compiler now points exactly which part(s) of a pattern are
refutable, rather than just highlighting the whole pattern.
2014-05-27 09:24:37 +10:00
Huon Wilson
f2a137829e syntax: desugar a for loop to a let binding to get better error
messages when the pattern is refutable.

This means the compiler points directly to the pattern and said that the
problem is the pattern being refutable (rather than just saying that
some value isn't covered in the `match` as it did previously).

Fixes #14390.
2014-05-27 09:24:37 +10:00
bors
746d086f93 auto merge of #14440 : Sawyer47/rust/tuple-doc, r=alexcrichton 2014-05-26 14:06:26 -07:00
Piotr Jawniak
9051f9bc61 Improve docs for core::tuple 2014-05-26 21:07:29 +02:00
bors
ca287ebc64 auto merge of #14374 : swgillespie/rust/swgillespie-tutorial, r=alexcrichton
The current tutorial says that the only way to get master is to build from source, which isn't true anymore - nightly binaries and an installer for Mac OS X are now available at the install page: http://www.rust-lang.org/install.html . Feedback very much welcome! Addresses issue #13578.
2014-05-26 11:51:27 -07:00
Huon Wilson
6ddd40d436 syntax: Add a source field to Local for tracking if it comes from lets or fors. 2014-05-26 22:44:38 +10:00
bors
6fad19e16b auto merge of #14439 : thestinger/rust/nonnull, r=luqmana 2014-05-26 01:51:25 -07:00
Daniel Micay
22ab5303ff handle attributes for non-immediate types first
Slices are non-immediate and were not having these attributes applied.
2014-05-26 03:26:02 -04:00
bors
ba77c60270 auto merge of #14300 : cmr/rust/enum-size-lint, r=kballard
See commits for details.
2014-05-26 00:16:27 -07:00
Daniel Micay
0c51149ac9 mark non-immediate by-value parameters as non-null 2014-05-26 02:59:19 -04:00
bors
a7ab73344d auto merge of #14432 : kballard/rust/nt_block, r=huonw
Fixes #13678.
2014-05-25 22:36:23 -07:00
Kevin Ballard
ff0f9b62f6 Allow $foo:block nonterminals in expression position
Fixes #13678.
2014-05-25 22:33:12 -07:00
Sean Gillespie
b3fb258406 Update tutorial, see issue #13578 2014-05-25 21:54:49 -07:00
P1start
c1fd3459fa Minor fixes to std::str docs
This tweaks the `std::str` docs to compensate for the recent shift from `~str`
to `String`.
2014-05-26 16:52:12 +12:00
bors
20a41519fd auto merge of #14430 : kballard/rust/squelch_os_warning, r=alexcrichton
Clean up the re-exports of various modules in `std::std`, and remove the
`realstd` stuff from `std::rt::args`.
2014-05-25 18:41:22 -07:00
Santiago Rodriguez
68455a12db Fix to tutorial 2014-05-25 19:00:03 -05:00
bors
db2ddb1bba auto merge of #14423 : Kimundi/rust/static_regex, r=alexcrichton
This patch changes the internals of `Regex` and `regex!()` such that

```rust
static RE: Regex = regex!(...);
```

is valid. It doesn't change anything about the actual regex implementation, it just changes the type to something that can be constructed as a const expression.
2014-05-25 16:46:20 -07:00
Kevin Ballard
009d898a94 De-realstd os::args
With the test runner using ::std::os::args(), and std::std::os now being
a re-export of realstd::os, there's no more need for realstd stuff
mucking up rt::args.

Remove the one test of os::args(), as it's not very useful and it won't
work anymore now that rt::args doesn't use realstd.
2014-05-25 16:37:19 -07:00
Kevin Ballard
69070ac85f libstd: Remove unnecessary re-exports under std::std 2014-05-25 16:21:07 -07:00
bors
0fca6c6a02 auto merge of #14391 : alexcrichton/rust/more-rustdoc-inline, r=huonw
As part of the libstd facade (cc #13851), rustdoc is taught to inline documentation across crate boundaries through the usage of a `pub use` statement. This is done to allow libstd to maintain the facade that it is a standalone library with a defined public interface (allowing us to shuffle around what's underneath it).

A preview is available at http://people.mozilla.org/~acrichton/doc/std/index.html
2014-05-25 13:56:21 -07:00
Marvin Löbel
b997de529a Change regex! macro to expand to a constexpr, allowing to put it in a static 2014-05-25 22:30:50 +02:00
Alex Crichton
3100bc5b82 rustdoc: Move inlining to its own module 2014-05-25 13:26:46 -07:00
Anton Löfgren
5ca437078b guide-runtime.md: Fix a typo 2014-05-25 21:11:54 +02:00
bors
759517c180 auto merge of #14417 : Sawyer47/rust/dlist-fixme, r=huonw
Issue #3511 was closed, but dlist.rs contained a FIXME for it.
2014-05-25 05:01:18 -07:00
bors
489f470886 auto merge of #14370 : cmr/rust/design-faq, r=brson
This indends to help quell frequently answered questions about the language
design in a single, authoritative place.
2014-05-25 03:01:20 -07:00
Corey Richardson
11c0f77107 doc: add a new language design faq
This indends to help quell frequently answered questions about the language
design in a single, authoritative place.
2014-05-25 02:53:53 -07:00
Piotr Jawniak
9b5bdfc2e2 Fix FIXME #3511 in Dlist code
Issue #3511 was closed, but dlist.rs contained a FIXME for it.
2014-05-25 11:41:20 +02:00
Alex Crichton
bd339ced36 doc: Document the new #[doc(no_inline)] attribute 2014-05-25 01:18:37 -07:00
Alex Crichton
8dad7f579e rustdoc: Get [src] links working for inlined dox
These links work by hyperlinking back to the actual documentation page with a
query parameter which will be recognized and then auto-click the appropriate
[src] link.
2014-05-25 01:18:37 -07:00
Alex Crichton
9f13db2cb2 rustdoc: Fix rendering of the 'static bound 2014-05-25 01:18:11 -07:00
Alex Crichton
837d4d8f35 rustdoc: Link to local reexportations of items
Within the documentation for a crate, all hyperlinks to reexported items don't
go across crates, but rather to the items in the crate itself. This will allow
references to Option in the standard library to link to the standard library's
Option, instead of libcore's.

This does mean that other crate's links for Option will still link to libcore's
Option.
2014-05-25 01:18:11 -07:00
Alex Crichton
a96067077a rustdoc: Prevent a segfault when using markdown
The field passed from markdown could sometimes be null, and it wasn't properly
handled.
2014-05-25 01:18:11 -07:00
Alex Crichton
316ef79dc2 rustc: Encode module attributes
This will allow for rustdoc to pick up the documentation on the other end.
2014-05-25 01:18:11 -07:00
Alex Crichton
781e898348 rustdoc: Use csearch for impl loading
The normal analysis passes aren't guaranteed to have loaded all impls, so use
the csearch methods directly to load impls.
2014-05-25 01:18:10 -07:00
Alex Crichton
5ee3d0e1ff rustdoc: Inline reexported modules 2014-05-25 01:18:10 -07:00
Alex Crichton
9181c35ee9 rustdoc: Inline names of function arguments 2014-05-25 01:18:10 -07:00
Alex Crichton
6ee9109c8b rustdoc: Inline argument names of foreign methods 2014-05-25 01:18:10 -07:00
Alex Crichton
ec4f79ff6c rustdoc: Don't show reexported enum variants
For now just assume that the enum type itself is reexported.
2014-05-25 01:17:57 -07:00
Alex Crichton
622c8f7b57 rustdoc: Inline enums across crates 2014-05-25 01:17:57 -07:00
Alex Crichton
c81b511bfd rustdoc: Start inlining structs across crates 2014-05-25 01:17:57 -07:00
Alex Crichton
8b8e70ba1d std: Add doc(noinline) to the prelude reexports 2014-05-25 01:17:34 -07:00
Alex Crichton
712118b9c0 rustdoc: Inline documentation of pub use
This commit teaches rustdoc to inline the documentation for the destination of a
`pub use` statement across crate boundaries. This is intended for the standard
library's facade to show the fact that the facade is just an implementation
detail rather than the api of the standard library itself.

This starts out by inlining traits and functions, but more items will come soon.
The current drawback of this system is that hyperlinks across crates sill go to
the original item's definition rather than the reexported location.
2014-05-25 01:17:14 -07:00
bors
6b1426b87c auto merge of #14415 : Sawyer47/rust/ascii-fixme, r=huonw
Issue #5475 was closed some time ago, but ascii.rs still contained
a FIXME for it.
2014-05-25 01:11:19 -07:00
Piotr Jawniak
d12e12ed99 Fix FIXME #5475 in std::ascii
Issue #5475 was closed some time ago, but ascii.rs still contained
a FIXME for it.
2014-05-25 08:56:50 +02:00
Richo Healey
553074506e core: rename strbuf::StrBuf to string::String
[breaking-change]
2014-05-24 21:48:10 -07:00
bors
bbb70cdd9c auto merge of #14402 : huonw/rust/arc-field-rename, r=alexcrichton
Paper over privacy issues with Deref by changing field names.

Types that implement Deref can cause weird error messages due to their
private fields conflicting with a field of the type they deref to, e.g.,
previously

    struct Foo { x: int }

    let a: Arc<Foo> = ...;
    println!("{}", a.x);

would complain the the `x` field of `Arc` was private (since Arc has a
private field called `x`) rather than just ignoring it.

This patch doesn't fix that issue, but does mean one would have to write
`a._ptr` to hit the same error message, which seems far less
common. (This patch `_`-prefixes all private fields of
`Deref`-implementing types.)

cc #12808
2014-05-24 18:56:19 -07:00
Huon Wilson
9698221f91 Paper over privacy issues with Deref by changing field names.
Types that implement Deref can cause weird error messages due to their
private fields conflicting with a field of the type they deref to, e.g.,
previously

    struct Foo { x: int }

    let a: Arc<Foo> = ...;
    println!("{}", a.x);

would complain the the `x` field of `Arc` was private (since Arc has a
private field called `x`) rather than just ignoring it.

This patch doesn't fix that issue, but does mean one would have to write
`a._ptr` to hit the same error message, which seems far less
common. (This patch `_`-prefixes all private fields of
`Deref`-implementing types.)

cc #12808
2014-05-25 10:23:37 +10:00
Alan Andrade
0cae849595 fix mostly grammar per PR comments 2014-05-24 17:08:00 -07:00
Steven Fackler
3347993264 Changes from feedback 2014-05-24 16:49:47 -07:00
Steven Fackler
864c5016ae Get "make check" to work with unused-attribute
There's a fair number of attributes that have to be whitelisted since
they're either looked for by rustdoc, in trans, or as needed. These can
be cleaned up in the future.
2014-05-24 16:49:46 -07:00
Steven Fackler
24f98c6d7a Whitelist doc attributes
This is a bit overly permissive but should be okay for now.
2014-05-24 16:49:46 -07:00
Steven Fackler
e0648093d8 Port more stuff to mark used attributes 2014-05-24 16:49:46 -07:00
Steven Fackler
50181add04 First sketch of lint pass
Enough attributes are marked to cleanly compile an empty library.
2014-05-24 16:08:36 -07:00
Steven Fackler
c305473d3c Add AttrId to Attribute_ 2014-05-24 16:08:36 -07:00
bors
6304a27b80 auto merge of #14401 : aochagavia/rust/pr4, r=alexcrichton
Some functions implemented for the Ascii struct have the same functionality as other functions implemented for the normal chars. For consistency, I think they should have the same name, so I renamed the functions in Ascii to match the names in the Char trait.

* Renamed `to_lower` to `to_lowercase`
* Renamed `to_upper` to `to_uppercase`
* Renamed `is_alpha` to `is_alphabetic`
* Renamed `is_alnum` to `is_alphanumeric`
* Renamed `is_lower` to `is_lowercase`
* Renamed `is_upper` to `is_uppercase`

[breaking-change]
2014-05-24 14:26:23 -07:00
Alan Andrade
99744653d5 get over bold text madness, changes per PR, brought the "returning pointers" section back to pointers guide 2014-05-24 13:15:48 -07:00
Adolfo Ochagavía
e998958672 Update ascii functions used elsewhere 2014-05-24 22:00:18 +02:00
bors
43f942f886 auto merge of #14378 : huonw/rust/deque-adjustments, r=alexcrichton
Might as well remove the duplication/`forget` call.
2014-05-24 12:51:24 -07:00
Adolfo Ochagavía
9088a56db1 Removed unnecessary macro declaration 2014-05-24 18:11:30 +02:00
bors
39c1ecd411 auto merge of #14396 : vhbit/rust/opaque-mutex, r=alexcrichton
On some systems (iOS for example) mutex is represented by opaque data structure which doesn't play well with simple data copy. Therefore mutex should be initialized from magic static value and filled by OS only when it landed RC.

Initially written for iOS but since landing iOS support might require quite a lot of time I think it is better to split parts which aren't directly related to iOS and merge them in
2014-05-24 04:56:25 -07:00
Huon Wilson
9a8379deb2 std: minor simplification to sync::deque. 2014-05-24 21:44:37 +10:00
Adolfo Ochagavía
f7ccae5f15 Rename functions in Ascii
Some functions implemented for the Ascii struct have the same functionality as other functions implemented for the normal chars. For consistency, I think they should have the same name, so I renamed the functions in Ascii to match the names in the Char trait.

* Renamed `to_lower` to `to_lowercase`
* Renamed `to_upper` to `to_uppercase`
* Renamed `is_alpha` to `is_alphabetic`
* Renamed `is_alnum` to `is_alphanumeric`
* Renamed `is_lower` to `is_lowercase`
* Renamed `is_upper` to `is_uppercase`

[breaking-change]
2014-05-24 12:44:36 +02:00
bors
e72a21b2bb auto merge of #14392 : alexcrichton/rust/mem-updates, r=sfackler
* All of the *_val functions have gone from #[unstable] to #[stable]
* The overwrite and zeroed functions have gone from #[unstable] to #[stable]
* The uninit function is now deprecated, replaced by its stable counterpart,
  uninitialized

[breaking-change]
2014-05-24 03:21:24 -07:00
bors
12467989c3 auto merge of #14389 : Ryman/rust/14303, r=alexcrichton
Closes #14303.
2014-05-24 01:41:25 -07:00
bors
6cf430147e auto merge of #14388 : kballard/rust/nonfatal_lexer_errors, r=alexcrichton
Most errors that arise in the lexer can be recovered from. This allows
for more than one syntax error to be reported at a time.
2014-05-24 00:01:25 -07:00
Valerii Hiora
41b65d39ab Fixes problems on systems with opaque mutex
On some systems (iOS for example) mutex is represented by
opaque data structure which doesn't play well with simple
data copy. Therefore mutex should be initialized from
magic static value and filled by OS only when it landed RC.
2014-05-24 08:01:23 +03:00
Alex Crichton
2fd4841724 core: Finish stabilizing the mem module.
* All of the *_val functions have gone from #[unstable] to #[stable]
* The overwrite and zeroed functions have gone from #[unstable] to #[stable]
* The uninit function is now deprecated, replaced by its stable counterpart,
  uninitialized

[breaking-change]
2014-05-23 20:55:57 -07:00
bors
9c870b3d1c auto merge of #14306 : luqmana/rust/up-llvm, r=alexcrichton
We can now mark arguments and returns as `nonnull` in LLVM. It's still somewhat limited by the fact that LLVM loses this information after inlining but it might help in certain cases.
2014-05-23 19:51:20 -07:00
Kevin Ballard
4c9dace5d5 Make most lexer errors non-fatal
Most errors that arise in the lexer can be recovered from. This allows
for more than one syntax error to be reported at a time.
2014-05-23 19:35:08 -07:00
Luqman Aden
3cae434f5c librustc: Consolidate the attribute handling for tagging function arguments and returns. 2014-05-23 22:32:30 -04:00
Alan Andrade
64dad2cb03 Cleanup lifetime guide
Clean pointers guide
2014-05-23 18:52:06 -07:00
bors
12e80f1a14 auto merge of #14379 : brson/rust/simd, r=alexcrichton
Followup to https://github.com/mozilla/rust/pull/14331 and https://github.com/mozilla/rust/pull/12524
2014-05-23 18:06:19 -07:00
bors
4462687457 auto merge of #14317 : P1start/rust/lifetime-formatting, r=alexcrichton
This changes certain error messages about lifetimes so that they display lifetimes without an `&`.

Fixes #10291.
2014-05-23 16:31:20 -07:00
Brian Anderson
02d1ce830b core: Derive Show on SIMD types 2014-05-23 15:28:30 -07:00
Brian Anderson
eea66e1697 core: Document simd mod 2014-05-23 15:28:30 -07:00
Brian Anderson
8e58ec5b9d std: Move unstable::finally to std::finally. #1457
[breaking-change]
2014-05-23 15:28:27 -07:00
Brian Anderson
1a1e6c8e73 std: Move simd to core::simd and reexport. #1457
[breaking-change]
2014-05-23 15:27:48 -07:00
Brian Anderson
1240197a5b std: Move running_on_valgrind to rt::util. #1457
[breaking-change]
2014-05-23 15:27:48 -07:00
bors
11aa731b38 auto merge of #14368 : tedhorst/rust/master, r=alexcrichton 2014-05-23 14:56:24 -07:00
bors
53db981148 auto merge of #14359 : brson/rust/minordoc, r=alexcrichton 2014-05-23 13:21:25 -07:00
Kevin Butler
da663ccf9f Improve error message for lifetimes after type params.
Closes #14303.
2014-05-23 20:51:21 +01:00
bors
c329a1fcdc auto merge of #14313 : kballard/rust/tuple_dotdot_match_ice, r=cmr
Fixes #14308.
2014-05-23 11:46:26 -07:00
Brian Anderson
807dffde18 Minor library doc copyediting 2014-05-23 10:33:21 -07:00
bors
ad775be8b4 auto merge of #14360 : alexcrichton/rust/remove-deprecated, r=kballard
These have all been deprecated for awhile now, so it's likely time to start removing them.
2014-05-23 09:11:26 -07:00
Alex Crichton
33573bc0aa syntax: Clean out obsolete syntax parsing
All of these features have been obsolete since February 2014, where most have
been obsolete since 2013. There shouldn't be any more need to keep around the
parser hacks after this length of time.
2014-05-23 09:07:28 -07:00
bors
9e244d7084 auto merge of #14372 : neeee/rust/intrinsic-docs, r=brson 2014-05-23 02:06:25 -07:00
bors
33c3eddd11 auto merge of #14362 : zecozephyr/rust/docfixes, r=cmr
extra::arc -> alloc::arc
2014-05-23 00:31:27 -07:00
P1start
e6b23da5a2 Fix lifetime error to print 'a instead of &'a
This changes certain error messages about lifetimes so that they display
lifetimes without an `&`.

Fixes #10291.
2014-05-23 18:22:48 +12:00
Corey Richardson
d8467e23e7 rustc: abstract lint level exporting from EnumSizeVariance 2014-05-22 23:01:47 -07:00
Corey Richardson
c327080ee0 rustc: add a lint for large enum variants
It can be easy to accidentally bloat the size of an enum by making one variant
larger than the others. When this happens, it usually goes unnoticed. This
commit adds a lint that can warn when the largest variant in an enum is more
than 3 times larger than the second-largest variant. This requires a little
bit of rejiggering, because size information is only available in trans, but
lint levels are only available in the lint context.

It is allow by default because it's pretty noisy, and isn't really *that*
undesirable.

Closes #10362
2014-05-22 23:01:47 -07:00
lucy
3d6337079f libcore: Document math intrinsics. 2014-05-23 07:44:03 +02:00
Corey Richardson
f122ad08a5 rustc: middle: ty: use doc comments for the tcx 2014-05-22 22:24:56 -07:00
Corey Richardson
3f8cc1683b rustc: middle: lint: use more doc comments 2014-05-22 22:24:54 -07:00
Ted Horst
2571d42241 updated hash value in reduced benchmark 2014-05-22 23:07:57 -05:00
bors
02117dd1bc auto merge of #14357 : huonw/rust/spelling, r=pnkfelix
The span on a inner doc-comment would point to the next token, e.g. the span for the `a` line points to the `b` line, and the span of `b` points to the `fn`.

```rust
//! a
//! b

fn bar() {}
```
2014-05-22 20:56:18 -07:00
bors
ec0258a381 auto merge of #14314 : alexcrichton/rust/deriving-hash, r=brson
One of the long-term goals of the libstd facade is to move the collections
library underneath the standard library. This would imply that libcollections
today would invert its dependency with libstd.

One of the primary blockers for doing this is the HashMap collection. Of its two
major dependencies, hashing and randomness, this commit is the first step in
dealing with hashing.

When moving the hash module beneath libstd, it must break its primary dependence
on the io::Writer trait (used as the hashing state). The proposed strategy for
breaking this dependence is taking a similar path as core::fmt, which is to have
the hash module define its own "writer trait". This trait would be similar to
std::io::Writer, except that it would not return errors and it would have fewer
convenience methods.

The Hash trait today has its type parameter behind a feature gate (default type
parameters), so this pending change will likely break no code which hasn't opted
in to the feature gate. The SipState struct will lose its implementation of
io::Writer, but it will regain similar methods for dealing with writing data.

This change specifically prepares for the hash migration by modifying
deriving(Hash) to use the std:#️⃣:Writer bound instead of the std::io::Writer
bound. This bound is currently wired to std::io::Writer, but after a snapshot it
will have no need to be wired to the io writer trait.
2014-05-22 18:36:22 -07:00
Luqman Aden
90eeb92e10 Update to LLVM head and mark various ptrs as nonnull. 2014-05-22 21:06:24 -04:00
bors
a0960a1223 auto merge of #14348 : alexcrichton/rust/doc.rust-lang.org, r=huonw 2014-05-22 16:56:23 -07:00
Alex Crichton
711f531b65 doc: Touch up the unsafe guide
* Change ~ references to Box
* Rewrite examples so they can be compiled an run
* Mention libcore
* Update wording about compiler-required functions
2014-05-22 15:14:23 -07:00
Patrick Walton
e878721d70 libcore: Remove all uses of ~str from libcore.
[breaking-change]
2014-05-22 14:42:02 -07:00
Patrick Walton
5633d4641f libstd: Remove all uses of ~str from libstd 2014-05-22 14:42:02 -07:00
Patrick Walton
a9dd903d79 libtime: Remove the tz_zone field from times.
It depends on `~str`.
2014-05-22 14:42:02 -07:00
Patrick Walton
36195eb91f libstd: Remove ~str from all libstd modules except fmt and str. 2014-05-22 14:42:01 -07:00
Jonathan Bailey
12240e5b9e Fixed incorrect module path
extra::arc -> sync::arc
2014-05-22 13:46:52 -07:00
bors
e402e75f4e auto merge of #14350 : zwarich/rust/let-suggestion, r=pcwalton 2014-05-22 13:31:24 -07:00
Alex Crichton
0dd4c1e7bd Remove a slew of old deprecated functions 2014-05-22 11:54:14 -07:00
bors
8d50d6a93c auto merge of #14346 : alexcrichton/rust/rustdoc-external-crates, r=pcwalton
This commit alters rustdoc to crawl the metadata of upstream libraries in order
to fill in default methods for traits implemented in downstream crates. This,
for example, documents the `insert` function on hash maps.

This is a fairly lossy extraction from the metadata. Documentation and
attributes are lost, but they aren't used anyway. Unfortunately, argument names
are also lost because they are not present in the metadata. Source links are
also lost because the spans are not serialized.

While not perfect, it appears that presenting this documentation through rustdoc
is much better than nothing, so I wanted to land this to allow iteration on it
later on.
2014-05-22 10:31:25 -07:00
Alex Crichton
c746c503f0 rustdoc: Fill in external trait methods
This commit alters rustdoc to crawl the metadata of upstream libraries in order
to fill in default methods for traits implemented in downstream crates. This,
for example, documents the `insert` function on hash maps.

This is a fairly lossy extraction from the metadata. Documentation and
attributes are lost, but they aren't used anyway. Unfortunately, argument names
are also lost because they are not present in the metadata. Source links are
also lost because the spans are not serialized.

While not perfect, it appears that presenting this documentation through rustdoc
is much better than nothing, so I wanted to land this to allow iteration on it
later on.
2014-05-22 09:46:22 -07:00
bors
3c9f2a5d0a auto merge of #14354 : EdorianDark/rust/master, r=huonw
It seemed to me, that [T] was deprecated and i am trying to help.
2014-05-22 08:51:20 -07:00
bors
9411cec580 auto merge of #14349 : richo/rust/docs/win64_calling_convention, r=alexcrichton
Wikipedia suggests that windows on x64 has it's own calling convention (Supported by the fact that we implement it)

source: http://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_calling_conventions
2014-05-22 07:16:22 -07:00
Huon Wilson
d3fde8476b syntax: put the correct span on doc-comments inside a module.
The position of the .bump call (before extracting the span fields) was
causing a doc-comment to have the span of the next token, not itself.
2014-05-22 22:58:14 +10:00
Huon Wilson
37bd466e58 Spelling/doc formatting fixes. 2014-05-22 22:55:37 +10:00
bors
9ac9148bbd auto merge of #14335 : tbu-/rust/pr_doc_strsplit, r=pnkfelix
In particular, show examples for splitting the empty string and using `splitn`
with a count of 0.

Fix #14222.
2014-05-22 05:26:22 -07:00
Dirk Leifeld
6787e22c08 Remove allow(deprecated_owned_vector) lint 2014-05-22 13:19:44 +02:00
bors
e7e5e9ce96 auto merge of #14345 : alexcrichton/rust/rustdoc-many-impls, r=pcwalton
Right now, when you look in the "Implementors" section for traits, you only see
implementors within that crate. This commit modifies that section to include
implementors from neighboring crates as well.

For example, the Container trait currently says that it is only implemented by
strings and slices, but it is in fact implemented by nearly all containers.

Implementation-wise, this change generates an "implementors cache" similarly to
the search index where each crate will append implementors to the files. When
the page for a trait is loaded, it will load its specific cache file, rendering
links for all upstream types which implement the trait.
2014-05-22 02:51:21 -07:00
bors
022a7b3cfb auto merge of #14322 : thestinger/rust/secret_santa_heap, r=alexcrichton 2014-05-22 01:06:25 -07:00
Richo Healey
e5d883101c docs: Add win64 calling convention 2014-05-22 00:05:56 -07:00
bors
22e2204c3d auto merge of #14321 : alexcrichton/rust/ices, r=pcwalton
Also adding tests for fixed ICEs
2014-05-21 23:31:27 -07:00
Cameron Zwarich
516a177273 Add a suggestion to use a let binding on some borrowck errors. 2014-05-21 22:04:22 -07:00
Alex Crichton
1ccc51ce3b doc: Fix some broken links 2014-05-21 20:33:00 -07:00
bors
f78eb14341 auto merge of #14307 : kballard/rust/vim_prelude_mutablecloneablevector, r=cmr
Add slice::MutableCloneableVector to the prelude. It's the only slice
trait that's currently missing.

Update rust.vim to match the latest prelude and current set of keywords.
Also teach it to handle box placement expressions specially.
2014-05-21 20:11:27 -07:00
Alex Crichton
799ddba8da Change static.rust-lang.org to doc.rust-lang.org
The new documentation site has shorter urls, gzip'd content, and index.html
redirecting functionality.
2014-05-21 19:55:39 -07:00
bors
257a73ce82 auto merge of #14301 : alexcrichton/rust/remove-unsafe-arc, r=brson
This type can be built with `Arc<Unsafe<T>>` now that liballoc exists.
2014-05-21 17:31:29 -07:00
Alex Crichton
06eb9765fe rustdoc: Show types for traits across crates
Right now, when you look in the "Implementors" section for traits, you only see
implementors within that crate. This commit modifies that section to include
implementors from neighboring crates as well.

For example, the Container trait currently says that it is only implemented by
strings and slices, but it is in fact implemented by nearly all containers.

Implementation-wise, this change generates an "implementors cache" similarly to
the search index where each crate will append implementors to the files. When
the page for a trait is loaded, it will load its specific cache file, rendering
links for all upstream types which implement the trait.
2014-05-21 16:41:58 -07:00
Alex Crichton
fdf935a524 std,green: Mark some queue types as NoShare 2014-05-21 16:36:57 -07:00
Daniel Micay
f1ce693e61 alter exchange_free for sized deallocation
The support for sized deallocation is nearly complete. The only known
missing pieces are `Box<str>`, `Box<[T]>` and `proc`.
2014-05-21 16:16:17 -04:00
Daniel Micay
945019830b migrate from exchange_malloc to allocate
This is now only used internally by the compiler.
2014-05-21 16:16:17 -04:00
bors
83eefa88c1 auto merge of #14328 : Sawyer47/rust/remove-fixmes, r=alexcrichton 2014-05-21 11:36:29 -07:00
Tobias Bucher
dcc2305664 Add examples for edge cases of str.split/str.splitn
In particular, show examples for splitting the empty string and using `splitn`
with a count of 0.

Fix #14222.
2014-05-21 20:05:55 +02:00
bors
96670e9723 auto merge of #14320 : kballard/rust/fix_stdlib_inject_attrs, r=alexcrichton
The #[phase(syntax,link)] attribute on `extern crate std` needs to be an
outer attribute so it can pretty-print properly.

Also add `#![no_std]` and `#[feature(phase)]` so compiling the
pretty-printed source will work.
2014-05-21 09:46:27 -07:00
Alex Crichton
0d4b840523 rustc: Fix an ICE with box-placement syntax
Closes #14084
2014-05-21 09:16:14 -07:00
Alex Crichton
a016aa2405 rustc: Turn a Box ICE into an error
Closes #14092
2014-05-21 09:16:11 -07:00
Alex Crichton
3d268fe666 std: Change hash to reexport its own Writer
One of the long-term goals of the libstd facade is to move the collections
library underneath the standard library. This would imply that libcollections
today would invert its dependency with libstd.

One of the primary blockers for doing this is the HashMap collection. Of its two
major dependencies, hashing and randomness, this commit is the first step in
dealing with hashing.

When moving the hash module beneath libstd, it must break its primary dependence
on the io::Writer trait (used as the hashing state). The proposed strategy for
breaking this dependence is taking a similar path as core::fmt, which is to have
the hash module define its own "writer trait". This trait would be similar to
std::io::Writer, except that it would not return errors and it would have fewer
convenience methods.

The Hash trait today has its type parameter behind a feature gate (default type
parameters), so this pending change will likely break no code which hasn't opted
in to the feature gate. The SipState struct will lose its implementation of
io::Writer, but it will regain similar methods for dealing with writing data.

This change specifically prepares for the hash migration by modifying
deriving(Hash) to use the std:#️⃣:Writer bound instead of the std::io::Writer
bound. This bound is currently wired to std::io::Writer, but after a snapshot it
will have no need to be wired to the io writer trait.
2014-05-21 09:15:23 -07:00
bors
803e92de89 auto merge of #14326 : huonw/rust/tiny-fixes, r=pnkfelix
The changes to flowgraph make invalid invocations slightly more forgiving by (trying to) provide slightly more information and by avoiding the ICE message.
2014-05-21 08:06:27 -07:00
Piotr Jawniak
fe7cc81087 Remove two outdated FIXMEs from complex.rs 2014-05-21 16:04:35 +02:00
bors
1edb0e5364 auto merge of #14324 : zecozephyr/rust/docfix, r=luqmana 2014-05-21 06:21:25 -07:00
Huon Wilson
feb91f3216 rustc: improve error messages from wrong --pretty flowgraph use.
This defers to .fatal and .span_fatal for errors (rather than `fail!`
which prints the ICE message). It also adds the span lookup when an id
doesn't correspond to a block, to show what it is pointing at.

It also makes the argument parser slightly looser, so that passing
`--pretty flowgraph` recognises the `flowgraph` part and suggests to use
an integer.
2014-05-21 22:41:23 +10:00
Huon Wilson
dd5365af2c rustc: ng -> gn, fix a typo in a string. 2014-05-21 21:53:41 +10:00
Huon Wilson
a239663413 rustc: rename the lint level enum for style.
CamelCase all the way!
2014-05-21 21:50:37 +10:00
bors
a400b31ff5 auto merge of #14319 : kballard/rust/rename_rng_choose_option, r=alexcrichton
Rng.choose() is used so rarely that it doesn't necessitate having two
methods, especially since the failing, non-option variant also requires
Clone.

[breaking-change]
2014-05-21 04:26:23 -07:00
Jonathan Bailey
e549601bc8 Updated doc with correct type. 2014-05-21 02:48:23 -07:00
bors
082075d050 auto merge of #14316 : kballard/rust/range_inclusive_no_toprimitive, r=alexcrichton 2014-05-21 02:46:23 -07:00
bors
4605232f26 auto merge of #14315 : kballard/rust/stdreader_isatty, r=alexcrichton
StdWriter has .isatty(). StdReader can trivially vend the same function,
and someone asked today on IRC how to call isatty() on stdin.
2014-05-21 01:11:25 -07:00
bors
4afc15e30c auto merge of #14259 : alexcrichton/rust/core-mem, r=brson
Excluding the functions inherited from the cast module last week (with marked
stability levels), these functions received the following treatment.

* size_of - this method has become #[stable]
* nonzero_size_of/nonzero_size_of_val - these methods have been removed
* min_align_of - this method is now #[stable]
* pref_align_of - this method has been renamed without the
  `pref_` prefix, and it is the "default alignment" now. This decision is in line
  with what clang does (see url linked in comment on function). This function
  is now #[stable].
* init - renamed to zeroed and marked #[stable]
* uninit - marked #[stable]
* move_val_init - renamed to overwrite and marked #[stable]
* {from,to}_{be,le}{16,32,64} - all functions marked #[stable]
* swap/replace/drop - marked #[stable]
* size_of_val/min_align_of_val/align_of_val - these functions are marked
  #[unstable], but will continue to exist in some form. Concerns have been
  raised about their `_val` prefix.
2014-05-20 23:31:30 -07:00
Alex Crichton
19dc3b50bd core: Stabilize the mem module
Excluding the functions inherited from the cast module last week (with marked
stability levels), these functions received the following treatment.

* size_of - this method has become #[stable]
* nonzero_size_of/nonzero_size_of_val - these methods have been removed
* min_align_of - this method is now #[stable]
* pref_align_of - this method has been renamed without the
  `pref_` prefix, and it is the "default alignment" now. This decision is in line
  with what clang does (see url linked in comment on function). This function
  is now #[stable].
* init - renamed to zeroed and marked #[stable]
* uninit - marked #[stable]
* move_val_init - renamed to overwrite and marked #[stable]
* {from,to}_{be,le}{16,32,64} - all functions marked #[stable]
* swap/replace/drop - marked #[stable]
* size_of_val/min_align_of_val/align_of_val - these functions are marked
  #[unstable], but will continue to exist in some form. Concerns have been
  raised about their `_val` prefix.

[breaking-change]
2014-05-20 23:06:54 -07:00
Kevin Ballard
23ca66ecd2 Change std inject attributes to outer attributes
The #[phase(syntax,link)] attribute on `extern crate std` needs to be an
outer attribute so it can pretty-print properly.

Also add `#![no_std]` and `#[feature(phase)]` so compiling the
pretty-printed source will work.
2014-05-20 22:44:58 -07:00
Alex Crichton
4aac621b5a test: Add test for fixed issue #12796
Doesn't close #12796 because the error message is awful.
2014-05-20 21:47:12 -07:00
Alex Crichton
827999cd1f test: Add a test for fixed issue #12567
Closes #12567
2014-05-20 21:44:22 -07:00
Alex Crichton
0089215472 rustc: Avoid an unwrap() in check_match
Closes #12369
2014-05-20 21:42:30 -07:00
bors
feb9f302ca auto merge of #14293 : alexcrichton/rust/weak-lang-items, r=brson
This commit is part of the ongoing libstd facade efforts (cc #13851). The
compiler now recognizes some language items as "extern { fn foo(...); }" and
will automatically perform the following actions:

1. The foreign function has a pre-defined name.
2. The crate and downstream crates can only be built as rlibs until a crate
   defines the lang item itself.
3. The actual lang item has a pre-defined name.

This is essentially nicer compiler support for the hokey
core-depends-on-std-failure scheme today, but it is implemented the same way.
The details are a little more hidden under the covers.

In addition to failure, this commit promotes the eh_personality and
rust_stack_exhausted functions to official lang items. The compiler can generate
calls to these functions, causing linkage errors if they are left undefined. The
checking for these items is not as precise as it could be. Crates compiling with
`-Z no-landing-pads` will not need the eh_personality lang item, and crates
compiling with no split stacks won't need the stack exhausted lang item. For
ease, however, these items are checked for presence in all final outputs of the
compiler.

It is quite easy to define dummy versions of the functions necessary:

    #[lang = "stack_exhausted"]
    extern fn stack_exhausted() { /* ... */ }

    #[lang = "eh_personality"]
    extern fn eh_personality() { /* ... */ }

cc #11922, rust_stack_exhausted is now a lang item
cc #13851, libcollections is blocked on eh_personality becoming weak
2014-05-20 21:36:25 -07:00
Alex Crichton
40d3241a4a rustc: Avoid out of bounds in check_match
Closes #12116
2014-05-20 21:34:10 -07:00
Alex Crichton
1b2dd90f1b test: Add a test for fixed issue #11844
Closes #11844
2014-05-20 21:25:49 -07:00
Alex Crichton
f0a1df692e test: Add test for fixed issue #11736
Closes #11736
2014-05-20 21:24:01 -07:00
Alex Crichton
d3a0471490 test: Add a test for fixed issue #10763
Closes #10763
2014-05-20 21:14:20 -07:00
Alex Crichton
8505b14b00 rustc: Fix a dynamic borrow error in resolve
Closes #8208
Closes #10980
2014-05-20 21:13:50 -07:00
Kevin Ballard
b8270c8db2 Remove Rng.choose(), rename Rng.choose_option() to .choose()
Rng.choose() is used so rarely that it doesn't necessitate having two
methods, especially since the failing, non-option variant also requires
Clone.

[breaking-change]
2014-05-20 20:44:45 -07:00
Alex Crichton
aef1a9c57b rustc: Prevant an out of bounds access in typeck
Closes #7092
2014-05-20 20:39:15 -07:00
Alex Crichton
fd88e2b729 syntax: Parse global paths in patterns
Closes #6449
2014-05-20 20:28:00 -07:00
Kevin Ballard
c7454853d2 Remove useless ToPrimitive bound on range_inclusive() 2014-05-20 20:27:34 -07:00
Kevin Ballard
dc921c1433 Add .isatty() method to StdReader
StdWriter has .isatty(). StdReader can trivially vend the same function,
and someone asked today on IRC how to call isatty() on stdin.
2014-05-20 20:05:05 -07:00
Kevin Ballard
0718259ae0 Fix LLVM error with tuple struct match using (..)
Consider PatEnums constructed with A(..) to be candidates for tuple
struct patterns, not just ones constructed with A(a,b,c). If these
patterns shouldn't be valid tuple struct patterns (as they're equivalent
to _), this needs to be caught before we get to trans.

Fixes #14308.
2014-05-20 19:52:43 -07:00
Kevin Ballard
d5b5aa4d4a Fix ICE regarding tuple struct matches using (..)
Fixes half of #14308.
2014-05-20 19:52:39 -07:00
Kevin Ballard
ebe1d8ec2a Add run-pass case for issue #14308
Enum wildcard patterns in match behave wrong when applied to tuple
structs. They either ICE or cause an LLVM error.
2014-05-20 19:52:24 -07:00
Alex Crichton
54f6eacf34 green: Remove some unsafe code in BasicLoop 2014-05-20 18:51:29 -07:00
bors
e546452727 auto merge of #14305 : tbu-/rust/pr_doc_bytes, r=huonw
Only an example was needed, as the ability to write uints into the string is
already mentioned.

Fix #7102.
2014-05-20 17:36:18 -07:00
bors
6ecf7d97d0 auto merge of #13975 : nikomatsakis/rust/issue-13794-fn-subtyping-and-static, r=pnkfelix
Tweak region inference to ignore constraints like `'a <= 'static`, since they
have no value. This also ensures that we can handle some obscure cases of fn
subtyping with bound regions that we didn't used to handle correctly.

Fixes #13974.
2014-05-20 15:41:20 -07:00
Kevin Ballard
bf0c6d8166 vim: Handle box expressions specially
Attempt to highlight the placement expression in a `box (expr) foo`
expression. Also treat GC as a keyword within the placement expression.

This doesn't work correctly for arbitrary expressions. Notably, this
makes no attempt at balancing delimiters. I believe handling that will
require rewriting the syntax rules to add a region for every pair of
delimiters. That may be a desirable thing to do in the end, because we
can then rewrite our indent rules based on the syntax and get rid of
cindent(), but for the time being, we'll just live with the limitation.
2014-05-20 15:06:53 -07:00
Tobias Bucher
84f43c6acd Add non-utf8 byte to the bytes!() example
Only an example was needed, as the ability to write uints into the string is
already mentioned.

Fix #7102.
2014-05-20 22:53:30 +02:00
Kevin Ballard
229338d6ac Update rust.vim for the latest prelude/keywords 2014-05-20 13:35:51 -07:00
bors
4dff9cbf58 auto merge of #14304 : brson/rust/moredocs, r=kballard
Includes module docs for `cell`.
2014-05-20 13:21:18 -07:00
Kevin Ballard
badde74100 Add slice::MutableCloneableVector to the prelude
Every other trait in slice is in the prelude, so it makes sense to
provide MutableCloneableVector as well.
2014-05-20 12:12:44 -07:00
bors
f9bd6b4e39 auto merge of #14283 : Ryman/rust/commented_compile_fail_error, r=kballard
Edit: This now only covers refactoring to regex.
2014-05-20 11:46:24 -07:00
Brian Anderson
c9ab33a8fd Address review comments 2014-05-20 11:39:40 -07:00
Brian Anderson
26e4680ae5 core: Convert TODOs to FIXMEs 2014-05-20 10:40:14 -07:00
Brian Anderson
1b8deb293e std: Alphabetize crate reexports for rustdoc 2014-05-20 10:38:22 -07:00
Brian Anderson
cea4c27806 core: Spruce up the crate description 2014-05-20 10:38:22 -07:00
Brian Anderson
220313e5e6 core: More concise description for mod ops 2014-05-20 10:38:21 -07:00
Brian Anderson
900b33a4e3 std: Fix broken link 2014-05-20 10:38:21 -07:00
Brian Anderson
8f2a2e2dd8 core: Improve docs for cell 2014-05-20 10:38:21 -07:00
Kevin Butler
66d8c3cb2b compiletest: Refactor compile-fail to regex. 2014-05-20 18:15:34 +01:00
bors
84320a4f4b auto merge of #14277 : pczarn/rust/manual-grammar, r=alexcrichton
The grammar for use declarations was outdated. Corrected some other mistakes.
2014-05-20 10:11:20 -07:00
Piotr Czarnecki
6674913c02 Correct EBNF grammar in the manual
The grammar for use declarations was outdated.
2014-05-20 15:50:03 +02:00
bors
629195582b auto merge of #14296 : kballard/rust/diagnostic_color_newline, r=alexcrichton
When printing colored diagnostics, we need to reset the terminal before
emitting the newline, not after. Otherwise it gets line-buffered and the
color won't reset until the next line is printed or the compiler exits.

Normally this isn't a problem, but when running rustc in parallel with
other processes (e.g. `make -j4`) this can cause the color to leak
to other lines.
2014-05-19 23:41:20 -07:00
bors
ec8ec54192 auto merge of #14289 : TyOverby/rust/master, r=alexcrichton
Closes #14278.

Previously the type signatures of the ordering functions in `core::iter::order` took two iterators, but only if they were the same type of iterator.  This commit loosens that restriction and allows different kinds of iterators (but with the same type of elements) to be compared.
2014-05-19 22:01:21 -07:00
bors
ffe2686063 auto merge of #14265 : Ryman/rust/issue-14254, r=alexcrichton
This is hard coding `Box` into this, as it doesn't seem to parse as `TyUniq` like `~` did. This may not be correct for all usages of the box keyword. 

Closes #14254.
2014-05-19 19:11:24 -07:00
Kevin Ballard
b991bbe2d0 Reset the terminal color before the newline for diagnostics
When printing colored diagnostics, we need to reset the terminal before
emitting the newline, not after. Otherwise it gets line-buffered and the
color won't reset until the next line is printed or the compiler exits.

Normally this isn't a problem, but when running rustc in parallel with
other processes (e.g. `make -j4`) this can cause the color to leak
to other lines.
2014-05-19 18:45:36 -07:00
Alex Crichton
05a453edb3 green: Remove usage of UnsafeArc 2014-05-19 18:12:18 -07:00
Alex Crichton
5e10d373b5 rustuv: Remove usage of UnsafeArc 2014-05-19 18:12:18 -07:00
Alex Crichton
88b322c5fd native: Remove UnsafeArc in favor of just Arc 2014-05-19 18:12:18 -07:00
Alex Crichton
4c8a4d241a std: Remove UnsafeArc
This type has been superseded by Arc<Unsafe<T>>. The UnsafeArc type is a relic
of an era that has long since past, and with the introduction of liballoc the
standard library is able to use the Arc smart pointer. With little need left for
UnsafeArc, it was removed.

All existing code using UnsafeArc should either be reevaluated to whether it can
use only Arc, or it should transition to Arc<Unsafe<T>>

[breaking-change]
2014-05-19 18:12:18 -07:00
Alex Crichton
73729e94c8 std: Move comm primitives away from UnsafeArc
They currently still use `&mut self`, this migration was aimed towards moving
from UnsafeArc<T> to Arc<Unsafe<T>>
2014-05-19 17:50:57 -07:00
TyOverby
3001450f95 core::iter::order functions now take two types of iterators.
Previously the type signatures of the ordering functions in
`core::iter::order` took two iterators, but only if they were
the same type of iterator.  This commit loosens that restriction
and allows different kinds of iterators (but with the same type
of elements) to be compared.
2014-05-19 17:37:39 -07:00
Alex Crichton
d49aef7c02 std: Build Exclusive on Arc<Unsafe<T>>
This removes the usage of UnsafeArc
2014-05-19 17:36:04 -07:00
Alex Crichton
84378b0b5a std: Use Arc instead of UnsafeArc in BlockedTask 2014-05-19 17:33:40 -07:00
Alex Crichton
fe93c3d47e std: Rebuild spsc with Unsafe/&self
This removes the incorrect usage of `&mut self` in a concurrent setting.
2014-05-19 17:32:04 -07:00