Commit Graph

29312 Commits

Author SHA1 Message Date
bors
36c2c56277 auto merge of #14535 : sfackler/rust/bitv-show, r=alexcrichton
Closes #14531
2014-05-30 08:26:36 -07:00
bors
874b56d337 auto merge of #14524 : ahmedcharles/rust/to_string, r=alexcrichton 2014-05-30 06:01:41 -07:00
bors
32b6fc1eff auto merge of #14522 : aturon/rust/make_unique, r=alexcrichton,alexcrichton,me
This patch makes `Arc::make_unique` examine the number of weak
references as well as strong references, which is required for safety.

It also adds a `make_unique` method to the `Rc` type for consistency.

Closes #14521.
2014-05-30 04:21:41 -07:00
bors
3a105464fb auto merge of #14517 : lucy/rust/issue-14499, r=alexcrichton
Fixes #8537
Fixes #14499 (duplicate of #8537)

Old:
```rust
test.rs:2 	pub extern "xxxxx" fn add(x: int, y: int) -> int {
          	                   ^~
```

New:
```rust
test.rs:2 	pub extern "xxxxx" fn add(x: int, y: int) -> int {
          	           ^~~~~~~
```
2014-05-30 02:11:45 -07:00
bors
25951b2242 auto merge of #14514 : Randati/rust/patch-1, r=huonw 2014-05-30 00:31:44 -07:00
bors
af7c030310 auto merge of #14511 : Sawyer47/rust/osrng-rename, r=alexcrichton
According to Rust's style guide acronyms in type names should be
CamelCase.

[breaking-change]
2014-05-29 22:56:44 -07:00
Piotr Jawniak
aa7b215f04 Rename OSRng to OsRng
According to Rust's style guide acronyms in type names should be
CamelCase.

[breaking-change]
2014-05-30 06:37:31 +02:00
Steven Fackler
8e8f6a0372 Implement Show for Bitv{,Set}
Closes #14531
2014-05-29 21:29:06 -07:00
bors
d0b0f16c3f auto merge of #14512 : Heather/rust/patch-1, r=alexcrichton 2014-05-29 21:16:41 -07:00
bors
6510527e15 auto merge of #14510 : kballard/rust/rename_strallocating_into_owned, r=alexcrichton
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-29 19:31:42 -07:00
bors
81c022317a auto merge of #14427 : alexcrichton/rust/librand, r=huonw
This commit shuffles around some of the `rand` code, along with some
reorganization. The new state of the world is as follows:

* The librand crate now only depends on libcore. This interface is experimental.
* The standard library has a new module, `std::rand`. This interface will
  eventually become stable.

Unfortunately, this entailed more of a breaking change than just shuffling some
names around. The following breaking changes were made to the rand library:

* Rng::gen_vec() was removed. This has been replaced with Rng::gen_iter() which
  will return an infinite stream of random values. Previous behavior can be
  regained with `rng.gen_iter().take(n).collect()`

* Rng::gen_ascii_str() was removed. This has been replaced with
  Rng::gen_ascii_chars() which will return an infinite stream of random ascii
  characters. Similarly to gen_iter(), previous behavior can be emulated with
  `rng.gen_ascii_chars().take(n).collect()`

* {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all
  relied on being able to use an OSRng for seeding, but this is no longer
  available in librand (where these types are defined). To retain the same
  functionality, these types now implement the `Rand` trait so they can be
  generated with a random seed from another random number generator. This allows
  the stdlib to use an OSRng to create seeded instances of these RNGs.

* Rand implementations for `Box<T>` and `@T` were removed. These seemed to be
  pretty rare in the codebase, and it allows for libcore to not depend on
  liballoc.  Additionally, other pointer types like Rc<T> and Arc<T> were not
  supported.  If this is undesirable, librand can depend on liballoc and regain
  these implementations.

* The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`,
   but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice
   structure now has a lifetime associated with it.

cc #13851

[breaking-change]
2014-05-29 16:41:42 -07:00
Alex Crichton
925ff65118 std: Recreate a rand module
This commit shuffles around some of the `rand` code, along with some
reorganization. The new state of the world is as follows:

* The librand crate now only depends on libcore. This interface is experimental.
* The standard library has a new module, `std::rand`. This interface will
  eventually become stable.

Unfortunately, this entailed more of a breaking change than just shuffling some
names around. The following breaking changes were made to the rand library:

* Rng::gen_vec() was removed. This has been replaced with Rng::gen_iter() which
  will return an infinite stream of random values. Previous behavior can be
  regained with `rng.gen_iter().take(n).collect()`

* Rng::gen_ascii_str() was removed. This has been replaced with
  Rng::gen_ascii_chars() which will return an infinite stream of random ascii
  characters. Similarly to gen_iter(), previous behavior can be emulated with
  `rng.gen_ascii_chars().take(n).collect()`

* {IsaacRng, Isaac64Rng, XorShiftRng}::new() have all been removed. These all
  relied on being able to use an OSRng for seeding, but this is no longer
  available in librand (where these types are defined). To retain the same
  functionality, these types now implement the `Rand` trait so they can be
  generated with a random seed from another random number generator. This allows
  the stdlib to use an OSRng to create seeded instances of these RNGs.

* Rand implementations for `Box<T>` and `@T` were removed. These seemed to be
  pretty rare in the codebase, and it allows for librand to not depend on
  liballoc.  Additionally, other pointer types like Rc<T> and Arc<T> were not
  supported.  If this is undesirable, librand can depend on liballoc and regain
  these implementations.

* The WeightedChoice structure is no longer built with a `Vec<Weighted<T>>`,
  but rather a `&mut [Weighted<T>]`. This means that the WeightedChoice
  structure now has a lifetime associated with it.

* The `sample` method on `Rng` has been moved to a top-level function in the
  `rand` module due to its dependence on `Vec`.

cc #13851

[breaking-change]
2014-05-29 16:18:26 -07:00
bors
0935beba71 auto merge of #14486 : michaelwoerister/rust/unified_enum_rep, r=luqmana
So far the DWARF information for enums was different for regular enums, univariant enums, Option-like enums, etc. Regular enums were encoded as unions of structs, while the other variants were encoded as bare structs. With the changes in this PR all enums are encoded as unions so that debuggers can reconstruct if something originally was a struct, a univariant enum, or an Option-like enum.  For the latter case, information about the *Null* variant is encoded into the union field name. This information can then be used by the debugger to print a `None` value actually as `None` instead of `Some(0x0)`.

The changes in this PR should also fix the regression reported in #14385 and #14411, but I want to close these only after I have confirmation from the original reporters that the issues are actually fixed for them.
2014-05-29 14:41:42 -07:00
Aaron Turon
7889c95124 Make Arc::make_unique check weak refs; add make_unique to Rc
This patch makes `Arc::make_unique` examine the number of weak
references as well as strong references, which is required for safety.

It also adds a `make_unique` method to the `Rc` type for consistency.

Closes #14521.
2014-05-29 13:26:23 -07:00
Ahmed Charles
2dfad3bf52 Change to_owned() to to_string(). 2014-05-29 12:28:08 -07:00
bors
729ee20338 auto merge of #14483 : ahmedcharles/rust/patbox, r=alexcrichton 2014-05-29 12:11:40 -07:00
lucy
1b3a030092 syntax: Fix span on illegal ABI errors
Fixes #8537
Fixes #14499
2014-05-29 19:09:46 +02:00
bors
50b8528970 auto merge of #14492 : alexcrichton/rust/totaleq, r=pnkfelix
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-29 10:01:37 -07:00
bors
c631d3d804 auto merge of #14488 : SimonSapin/rust/patch-11, r=alexcrichton
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-29 07:51:40 -07:00
bors
bee4e6adac auto merge of #14487 : arielb1/rust/fix-13933, r=alexcrichton
Fix issue #13933 in a few files. A more complete fix would require core::raw::MutSlice.
2014-05-29 06:11:39 -07:00
Michael Woerister
eea329b0f7 debuginfo: Make DWARF representation of enums uniform.
So far the DWARF information for enums was different
for regular enums, univariant enums, Option-like enums,
etc. Regular enums were encoded as unions of structs,
while the other variants were encoded as bare structs.

With the changes in this PR all enums are encoded as
unions so that debuggers can reconstruct if something
originally was a struct, a univariant enum, or an
Option-like enum. For the latter case, information
about the Null variant is encoded into the union field
name. This information can then be used by the
debugger to print a None value actually as None
instead of Some(0x0).
2014-05-29 14:21:03 +02:00
Michael Woerister
138089355d debuginfo: Add documentation comments to debuginfo.rs
Conflicts:
	src/librustc/middle/trans/debuginfo.rs
2014-05-29 14:19:57 +02:00
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
d35a380870 auto merge of #14506 : luqmana/rust/fc, r=alexcrichton
This used to be clang only but accidentally became the default for everyone.
2014-05-29 01:51:51 -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
Heather
918e285d60 remove /build from .gitignore since there is build/ 2014-05-28 23:39:14 -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
Luqman Aden
3b56724c21 Don't enable libcpp for llvm by default. 2014-05-28 19:54:58 -07:00
bors
812785e01a auto merge of #14476 : luqmana/rust/docs, r=alexcrichton
We were still generating compiler docs even with --disable-docs passed.

cc @pnkfelix
2014-05-28 18:21:34 -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
bors
98c2b4b4ac auto merge of #13738 : buttslol/rust/armv7-support, r=alexcrichton
This was required to get ./configure to work on my armv7 test machine.

I haven't found anything sane to feature gate `hf` on that's pokable from the context of the configure script.

It also seems that gcc doesn't work on armv7 by default (rust wants to pass it `-m32` which isn't supported), would it be preferential to make the default `--enable-clang` on arm, or remove the `-m32` flag on that platform?
2014-05-28 11:06:42 -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