Commit Graph

36908 Commits

Author SHA1 Message Date
Keegan McAllister
73806ddd0f Use $crate and macro reexport to reduce duplicated code
Many of libstd's macros are now re-exported from libcore and libcollections.
Their libstd definitions have moved to a macros_stage0 module and can disappear
after the next snapshot.

Where the two crates had already diverged, I took the libstd versions as
they're generally newer and better-tested. See e.g. d3c831b, which was a fix to
libstd's assert_eq!() that didn't make it into libcore's.

Fixes #16806.
2015-01-05 12:00:56 -08:00
Kelvin Ly
87eebd17cd Fixed tests 2015-01-05 14:58:02 -05:00
Jorge Aparicio
4ed2800701 syntax: obsolete the for Sized? syntax 2015-01-05 14:56:49 -05:00
Jorge Aparicio
bbf7e4e58a update comment to reflect new Sized semantics 2015-01-05 14:56:49 -05:00
Jorge Aparicio
eb50d3ee01 undo one for Sized? removal that was in a comment 2015-01-05 14:56:49 -05:00
Jorge Aparicio
c26f5801f5 remove unused Sized imports 2015-01-05 14:56:49 -05:00
Jorge Aparicio
774588fd9d sed -i -s 's/ for Sized?//g' **/*.rs 2015-01-05 14:56:49 -05:00
Alex Crichton
4236c52e34 std: Move Atomic{Int,Uint} back to unstable
The int/uint story is under heavy development, and these types are likely to be
renamed.
2015-01-05 11:39:52 -08:00
Keegan McAllister
1c2fddc6bf Remove unused if_ok! macro 2015-01-05 11:38:12 -08:00
Keegan McAllister
538288176a Implement macro re-export
Fixes #17103.
2015-01-05 11:38:12 -08:00
Keegan McAllister
e2a9c04e19 Allow leading :: in use items 2015-01-05 11:38:12 -08:00
Keegan McAllister
ad7c647773 Add a special macro nonterminal $crate 2015-01-05 11:38:12 -08:00
Keegan McAllister
5e5924b799 Replace LetSyntaxTT with MacroRulesTT
The implementation of LetSyntaxTT was specialized to macro_rules! in various
ways. This gets rid of the false generality and simplifies the code.
2015-01-05 11:38:12 -08:00
Keegan McAllister
d1cf1b1e6b Don't test codegen-units errors on stage1 (c.f. #20184) 2015-01-05 11:38:11 -08:00
Kelvin Ly
7e42338dc5 Added two tests for pretty printing optimized enums 2015-01-05 13:49:33 -05:00
Brian Anderson
c548b879ef Typo 2015-01-05 10:29:09 -08:00
Brian Anderson
edbb7c3ed1 0.13.0 -> 1.0.0 2015-01-05 10:26:10 -08:00
Brian Anderson
40bd1c245f Put version number in beta channel artifacts 2015-01-05 10:25:49 -08:00
Chase Southwood
faf07b1365 Update reexports in vim syntax file 2015-01-05 12:21:47 -06:00
Michael Neumann
66da36f6ee Ensure that LLVM is rebuilt with recent changes 2015-01-05 18:40:41 +01:00
Michael Neumann
5488ddb307 Segmented stack support for DragonFly 2015-01-05 18:39:40 +01:00
Steve Klabnik
a56e7aee81 Add lifetime elision information to the ownership guide.
Fixes #19662.
2015-01-05 11:51:52 -05:00
Andrew Paseltiner
61bb6ac9de remove unnecessary Default bound from Hash{Map,Set}'s Extend impl 2015-01-05 11:40:39 -05:00
Niko Matsakis
5caf847b3f Add a test for issue #18865. Fixes #18865. 2015-01-05 11:31:37 -05:00
Niko Matsakis
540a7777b8 Don't ICE just because an impl is missing an associated type. Trust in the other compiler passes.
Fixes #17359.
2015-01-05 11:31:37 -05:00
Alex Crichton
ec7a50d20d std: Redesign c_str and c_vec
This commit is an implementation of [RFC 494][rfc] which removes the entire
`std::c_vec` module and redesigns the `std::c_str` module as `std::ffi`.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0494-c_str-and-c_vec-stability.md

The interface of the new `CString` is outlined in the linked RFC, the primary
changes being:

* The `ToCStr` trait is gone, meaning the `with_c_str` and `to_c_str` methods
  are now gone. These two methods are replaced with a `CString::from_slice`
  method.
* The `CString` type is now just a wrapper around `Vec<u8>` with a static
  guarantee that there is a trailing nul byte with no internal nul bytes. This
  means that `CString` now implements `Deref<Target = [c_char]>`, which is where
  it gains most of its methods from. A few helper methods are added to acquire a
  slice of `u8` instead of `c_char`, as well as including a slice with the
  trailing nul byte if necessary.
* All usage of non-owned `CString` values is now done via two functions inside
  of `std::ffi`, called `c_str_to_bytes` and `c_str_to_bytes_with_nul`. These
  functions are now the one method used to convert a `*const c_char` to a Rust
  slice of `u8`.

Many more details, including newly deprecated methods, can be found linked in
the RFC. This is a:

[breaking-change]
Closes #20444
2015-01-05 08:00:13 -08:00
FakeKane
05c5b5f033 reverting other changes 2015-01-05 10:25:22 -05:00
Niko Matsakis
c8868942e8 Treat associated types the same as type parameters when it comes to region bounding. Fixes #20303.
Strictly speaking, this is a [breaking-change] (if you are using
associated types). You are no longer free to wantonly violate the type
system rules by closing associated types into objects without any form
of region bound. Instead you should add region bounds like `T::X :
'a`, just as you would with a normal type parameter.
2015-01-05 10:14:35 -05:00
bors
03268bbf35 auto merge of #20514 : alexcrichton/rust/serialize-associated-type, r=aturon
This commit moves the libserialize crate (and will force the hand of the
rustc-serialize crate) to not require the `old_orphan_check` feature gate as
well as using associated types wherever possible. Concretely, the following
changes were made:

* The error type of `Encoder` and `Decoder` is now an associated type, meaning
  that these traits have no type parameters.

* The `Encoder` and `Decoder` type parameters on the `Encodable` and `Decodable`
  traits have moved to the corresponding method of the trait. This movement
  alleviates the dependency on `old_orphan_check` but implies that
  implementations can no longer be specialized for the type of encoder/decoder
  being implemented.

Due to the trait definitions changing, this is a:

[breaking-change]
2015-01-05 14:51:03 +00:00
Piotr Czarnecki
156a1c3134 Implement a few methods for RingBuf
* shrink_to_fit
* swap_back_remove
* swap_front_remove
* truncate
* resize
2015-01-05 15:48:58 +01:00
Niko Matsakis
928bb2be8f Improve test to include a projection, per @huonw's suggestion. 2015-01-05 09:14:03 -05:00
Niko Matsakis
57aaa9bf87 Make supertrait references work in object types too. 2015-01-05 07:11:48 -05:00
Niko Matsakis
7ee5863202 Minor code formatting cleanups. 2015-01-05 07:11:48 -05:00
Niko Matsakis
9989288438 Permit bindings of (and references to) associated types defined in supertraits. 2015-01-05 07:11:48 -05:00
Niko Matsakis
2ccab193af Introduce a CollectCtxt and impl AstConv on *that*. Also make all fns
in collect private except the public entry point.
2015-01-05 07:11:47 -05:00
Niko Matsakis
95ee339bd1 Stop writing code that is (unnecessarily) generic over any AstConv in collect,
just hard-code the ccx.
2015-01-05 07:11:47 -05:00
Niko Matsakis
94c345b66c Convert astconv and friends to use object types, not generics. No need to compile
all that stuff twice. Also, code reads so much nicer.
2015-01-05 07:11:47 -05:00
bors
8e83af6e87 auto merge of #20451 : brson/rust/installer, r=alexcrichton
This fixes a mostly harmless syntax error in the install script.
2015-01-05 11:10:57 +00:00
Simonas Kazlauskas
6ca1f0c6ea Add tests for ChaCha and Isaac Clone impls 2015-01-05 13:10:31 +02:00
Simonas Kazlauskas
f677deeab3 Implement Clone for PRNGs 2015-01-05 13:10:27 +02:00
Laurence Tratt
2c44195895 Make temporary directory names non-deterministic.
The previous scheme made it possible for another user/attacker to cause the
temporary directory creation scheme to panic. All you needed to know was the pid
of the process you wanted to target ('other_pid') and the suffix it was using
(let's pretend it's 'sfx') and then code such as this would, in essence, DOS it:

    for i in range(0u, 1001) {
        let tp = &Path::new(format!("/tmp/rs-{}-{}-sfx", other_pid, i));
        match fs::mkdir(tp, io::USER_RWX) { _ => () }
    }

Since the scheme retried only 1000 times to create a temporary directory before
dying, the next time the attacked process called TempDir::new("sfx") after that
would typically cause a panic. Of course, you don't necessarily need an attacker
to cause such a DOS: creating 1000 temporary directories without closing any of
the previous would be enough to DOS yourself.

This patch broadly follows the OpenBSD implementation of mkstemp. It uses the
operating system's random number generator to produce random directory names
that are impractical to guess (and, just in case someone manages to do that, it
retries creating the directory for a long time before giving up; OpenBSD
retries INT_MAX times, although 1<<31 seems enough to thwart even the most
patient attacker).

As a small additional change, this patch also makes the argument that
TempDir::new takes a prefix rather than a suffix. This is because 1) it more
closely matches what mkstemp and friends do 2) if you're going to have a
deterministic part of a filename, you really want it at the beginning so that
shell completion is useful.
2015-01-05 10:19:19 +00:00
Seo Sanghyeon
537285e707 Fix -Z no-analysis 2015-01-05 18:27:29 +09:00
Huon Wilson
3e9d5938cc Remove uses of default_type_params feature gate from tests. 2015-01-05 20:00:10 +11:00
Huon Wilson
b98a589e23 Remove use of globs feature gate from tests. 2015-01-05 20:00:10 +11:00
Huon Wilson
4016c729f1 Remove use of associated_types feature gate from tests. 2015-01-05 20:00:10 +11:00
Huon Wilson
6e3d78f06f Ungate default type parameters.
These are in scope for 1.0, and this is good to e.g. find as many bugs
as possible.
2015-01-05 20:00:10 +11:00
Huon Wilson
6795148169 Ungate globs.
These are in scope for 1.0, so this is good to e.g. make it easier find
bugs.
2015-01-05 20:00:10 +11:00
Huon Wilson
82a96a11ab Ungate associated types.
They work pretty well now, and the stdlib is using them everywhere so
they're impossible to avoid anyway.
2015-01-05 20:00:10 +11:00
Jared Roesch
c02fac471a Refactor struct parsing and add tests 2015-01-05 00:46:01 -08:00
Zbigniew Siciarz
73019ac10e Fix misleading name in AsciiExt docs 2015-01-05 08:44:18 +01:00