]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agoAuto merge of #21304 - lifthrasiir:htmldocck, r=alexcrichton
bors [Tue, 20 Jan 2015 06:45:02 +0000 (06:45 +0000)]
Auto merge of #21304 - lifthrasiir:htmldocck, r=alexcrichton

The script is intended as a tool for doing every sort of verifications amenable to Rustdoc's HTML output. For example, link checkers would go to this script. It already parses HTML into a document tree form (with a slight caveat), so future tests can make use of it.

As an example, relevant `rustdoc-*` run-make tests have been updated to use `htmldocck.py` and got their `verify.sh` removed. In the future they may go to a dedicated directory with htmldocck running by default. The detailed explanation of test scripts is provided as a docstring of htmldocck.

cc #19723

9 years agoAuto merge of #21287 - alexcrichton:issue-19872, r=huonw
bors [Tue, 20 Jan 2015 04:23:28 +0000 (04:23 +0000)]
Auto merge of #21287 - alexcrichton:issue-19872, r=huonw

cc #19872, this may help give some insight

9 years agoAuto merge of #21257 - alexcrichton:issue-20064, r=pnkfelix
bors [Tue, 20 Jan 2015 02:23:49 +0000 (02:23 +0000)]
Auto merge of #21257 - alexcrichton:issue-20064, r=pnkfelix

These two attributes are used to change the entry point into a Rust program, but
for now they're being put behind feature gates until we have a chance to think
about them a little more. The #[start] attribute specifically may have its
signature changed.

This is a breaking change to due the usage of these attributes generating errors
by default now. If your crate is using these attributes, add this to your crate
root:

    #![feature(start)] // if you're using the #[start] attribute
    #![feature(main)]  // if you're using the #[main] attribute

cc #20064

9 years agoAuto merge of #21165 - alexcrichton:second-pass-type-id, r=aturon
bors [Mon, 19 Jan 2015 23:35:12 +0000 (23:35 +0000)]
Auto merge of #21165 - alexcrichton:second-pass-type-id, r=aturon

This commit aims to stabilize the `TypeId` abstraction by moving it out of the
`intrinsics` module into the `any` module of the standard library. Specifically,

* `TypeId` is now defined at `std::any::TypeId`
* `TypeId::hash` has been removed in favor of an implementation of `Hash`.

This commit also performs a final pass over the `any` module, confirming the
following:

* `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely
  never require this, and the `Any` trait does not need to be implemented for
  any other types. As a result, this implementation detail can remain unstable
  until associated statics are implemented.
* `Any::downcast_ref` is now stable
* `Any::downcast_mut` is now stable
* `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today
  it does not allow downcasting of trait objects like `Box<Any + Send>` (those
  returned from `Thread::join`). This is covered by #18737.
* `BoxAny::downcast` is now stable.

9 years agoAuto merge of #19490 - oli-obk:json_non_string_key_maps, r=alexcrichton
bors [Mon, 19 Jan 2015 21:37:52 +0000 (21:37 +0000)]
Auto merge of #19490 - oli-obk:json_non_string_key_maps, r=alexcrichton

importing object type string key maps is still supported
writing them should be explicit, and can be done as follows

```rust
let some_tree_map : TreeMap<String, Json> = ...;
Json::Object(some_tree_map).to_writer(&mut writer);
```

related to #8335, #9028, #9142

9 years agoAuto merge of #21278 - thchittenden:issue-21033-struct-var-pattern-fix, r=alexcrichton
bors [Mon, 19 Jan 2015 19:40:51 +0000 (19:40 +0000)]
Auto merge of #21278 - thchittenden:issue-21033-struct-var-pattern-fix, r=alexcrichton

Closes #21033. The new strategy for parsing a field pattern is to look 1 token ahead and if it's a colon, parse as "fieldname: pat", otherwise parse the shorthand form "(box) (ref) (mut) fieldname)". The previous strategy was to parse "(ref) (mut) fieldname" then if we encounter a colon, throw an error if either "ref" or "mut" were encountered.

9 years agoAuto merge of #20082 - pczarn:btree-bounded-iter, r=Gankro
bors [Mon, 19 Jan 2015 17:43:47 +0000 (17:43 +0000)]
Auto merge of #20082 - pczarn:btree-bounded-iter, r=Gankro

Part of collections reform v1, #18424
Also, iteration is simplified:
```
before
test btree::map::bench::iter_1000                          ... bench:     17177 ns/iter (+/- 6302)
test btree::map::bench::iter_100000                        ... bench:   1735731 ns/iter (+/- 23908)
test btree::map::bench::iter_20                            ... bench:       386 ns/iter (+/- 148)
after
test btree::map::bench::iter_1000                          ... bench:     15777 ns/iter (+/- 346)
test btree::map::bench::iter_100000                        ... bench:   1602604 ns/iter (+/- 73629)
test btree::map::bench::iter_20                            ... bench:       339 ns/iter (+/- 91)
```
cc @gereeter @cgaebel
r? @Gankro

9 years agoFixes #21033 with accompanying test.
Tom Chittenden [Mon, 19 Jan 2015 16:58:01 +0000 (11:58 -0500)]
Fixes #21033 with accompanying test.

9 years agoImplement range and range_mut for BTree
Piotr Czarnecki [Tue, 13 Jan 2015 20:55:44 +0000 (21:55 +0100)]
Implement range and range_mut for BTree

Simplify BTree's iterators, too.

9 years agoAuto merge of #21269 - alexcrichton:issue-6936, r=pnkfelix
bors [Mon, 19 Jan 2015 15:44:41 +0000 (15:44 +0000)]
Auto merge of #21269 - alexcrichton:issue-6936, r=pnkfelix

This commit modifies resolve to prevent conflicts with typedef names in the same
method that conflits are prevented with enum names. This is a breaking change
due to the differing semantics in resolve, and any errors generated on behalf of
this change require that a conflicting typedef, module, or structure to be
renamed so they do not conflict.

[breaking-change]
Closes #6936

9 years agougly hack to convert BadHashMapKey error to general fmt::Error
Oliver 'ker' Schneider [Sat, 10 Jan 2015 09:13:11 +0000 (10:13 +0100)]
ugly hack to convert BadHashMapKey error to general fmt::Error

9 years agoadd unit test for non string/numeric map keys
Oliver 'ker' Schneider [Sat, 10 Jan 2015 09:14:38 +0000 (10:14 +0100)]
add unit test for non string/numeric map keys

9 years agolower FnMut to FnOnce since json-hack is no longer required
Oliver 'ker' Schneider [Sat, 10 Jan 2015 09:14:32 +0000 (10:14 +0100)]
lower FnMut to FnOnce since json-hack is no longer required

Conflicts:
src/libserialize/serialize.rs

9 years agojson-encoder: report error when hash map key is not string or numeric
Oliver 'ker' Schneider [Sat, 10 Jan 2015 09:14:19 +0000 (10:14 +0100)]
json-encoder: report error when hash map key is not string or numeric

9 years agoAuto merge of #21282 - Aatch:init-memzero, r=alexcrichton
bors [Mon, 19 Jan 2015 12:17:07 +0000 (12:17 +0000)]
Auto merge of #21282 - Aatch:init-memzero, r=alexcrichton

LLVM gets overwhelmed when presented with a zeroinitializer for a large
type. In unoptimised builds, it generates a long sequence of stores to
memory. In optmised builds, it manages to generate a standard memset of
zero values, but takes a long time doing so.

Call out to the `llvm.memset` function to zero out the memory instead.

Fixes #21264

9 years agoAuto merge of #20874 - klutzy:windows-dynamic-lib, r=alexcrichton
bors [Mon, 19 Jan 2015 10:19:23 +0000 (10:19 +0000)]
Auto merge of #20874 - klutzy:windows-dynamic-lib, r=alexcrichton

This is a [breaking-change] since `std::dynamic_lib::dl` is now
private.

When `LoadLibraryW()` fails, original code called `errno()` to get error
code.  However, there was local allocation of `Vec` before
`LoadLibraryW()`, and it drops before `errno()`, and the drop
(deallocation) changed `errno`! Therefore `dynamic_lib::open()` thought
it always succeeded.
This commit fixes the issue.

This commit also sets Windows error mode during `LoadLibrary()` to
prevent "dll load failed" dialog.

9 years agoAuto merge of #21099 - sanxiyn:opt-return-ty, r=alexcrichton
bors [Mon, 19 Jan 2015 08:22:58 +0000 (08:22 +0000)]
Auto merge of #21099 - sanxiyn:opt-return-ty, r=alexcrichton

This avoids having ast::Ty nodes which have no counterpart in the source.

9 years agostd: Stabilize TypeId and tweak BoxAny
Alex Crichton [Thu, 15 Jan 2015 00:08:07 +0000 (16:08 -0800)]
std: Stabilize TypeId and tweak BoxAny

This commit aims to stabilize the `TypeId` abstraction by moving it out of the
`intrinsics` module into the `any` module of the standard library. Specifically,

* `TypeId` is now defined at `std::any::TypeId`
* `TypeId::hash` has been removed in favor of an implementation of `Hash`.

This commit also performs a final pass over the `any` module, confirming the
following:

* `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely
  never require this, and the `Any` trait does not need to be implemented for
  any other types. As a result, this implementation detail can remain unstable
  until associated statics are implemented.
* `Any::downcast_ref` is now stable
* `Any::downcast_mut` is now stable
* `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today
  it does not allow downcasting of trait objects like `Box<Any + Send>` (those
  returned from `Thread::join`). This is covered by #18737.
* `BoxAny::downcast` is now stable.

9 years agoFix typedef/module name conflicts in the compiler
Alex Crichton [Fri, 16 Jan 2015 22:27:43 +0000 (14:27 -0800)]
Fix typedef/module name conflicts in the compiler

9 years agorustc_resolve: Do not allow mods to shadow types
Alex Crichton [Fri, 16 Jan 2015 22:25:45 +0000 (14:25 -0800)]
rustc_resolve: Do not allow mods to shadow types

This commit modifies resolve to prevent conflicts with typedef names in the same
method that conflits are prevented with enum names. This is a breaking change
due to the differing semantics in resolve, and any errors generated on behalf of
this change require that a conflicting typedef, module, or structure to be
renamed so they do not conflict.

[breaking-change]
Closes #6936

9 years agorustc_resolve: De-indent by breaking out of match
Alex Crichton [Fri, 16 Jan 2015 20:57:20 +0000 (12:57 -0800)]
rustc_resolve: De-indent by breaking out of match

Helps reduce some rightward drift

9 years agoAuto merge of #21267 - danslapman:master, r=alexcrichton
bors [Mon, 19 Jan 2015 01:45:36 +0000 (01:45 +0000)]
Auto merge of #21267 - danslapman:master, r=alexcrichton

This patch fixes IP_ADD_MEMBERSHIP problem described here: https://github.com/rust-lang/rust/issues/20381

I've tested on my ProbeR project, everything seems ok.

9 years agoReduce size of array in test case to 1MB
James Miller [Sun, 18 Jan 2015 20:22:54 +0000 (09:22 +1300)]
Reduce size of array in test case to 1MB

9 years agoAdd test to catch performance regressions
James Miller [Sat, 17 Jan 2015 08:26:25 +0000 (21:26 +1300)]
Add test to catch performance regressions

9 years agoUse `zero_mem` instead of a zerointializer for `init` intrinsic
James Miller [Sat, 17 Jan 2015 04:04:15 +0000 (17:04 +1300)]
Use `zero_mem` instead of a zerointializer for `init` intrinsic

LLVM gets overwhelmed when presented with a zeroinitializer for a large
type. In unoptimised builds, it generates a long sequence of stores to
memory. In optmised builds, it manages to generate a standard memset of
zero values, but takes a long time doing so.

Call out to the `llvm.memset` function to zero out the memory instead.

9 years agorustdoc: Improve diagnostics on lockfile failures
Alex Crichton [Sat, 17 Jan 2015 07:28:26 +0000 (23:28 -0800)]
rustdoc: Improve diagnostics on lockfile failures

cc #19872, this may help give some insight

9 years agostd::dynamic_lib: Fix Windows error handling
klutzy [Sat, 10 Jan 2015 13:53:22 +0000 (22:53 +0900)]
std::dynamic_lib: Fix Windows error handling

This is a [breaking-change] since `std::dynamic_lib::dl` is now
private.

When `LoadLibraryW()` fails, original code called `errno()` to get error
code.  However, there was local allocation of `Vec` before
`LoadLibraryW()`, and it drops before `errno()`, and the drop
(deallocation) changed `errno`! Therefore `dynamic_lib::open()` thought
it always succeeded.
This commit fixes the issue.

This commit also sets Windows error mode during `LoadLibrary()` to
prevent "dll load failed" dialog.

9 years agoMake output type in ast::FnDecl optional
Seo Sanghyeon [Sun, 18 Jan 2015 13:49:19 +0000 (22:49 +0900)]
Make output type in ast::FnDecl optional

9 years agoauto merge of #20901 : dgrunwald/rust/update-token-can-begin-expr, r=sanxiyn
bors [Sun, 18 Jan 2015 11:28:53 +0000 (11:28 +0000)]
auto merge of #20901 : dgrunwald/rust/update-token-can-begin-expr, r=sanxiyn

 * add `Token::AndAnd` (double borrow)
 * add `Token::DotDot` (range notation)
 * remove `Token::Pound` and `Token::At`

This fixes a syntax error when parsing `fn f() -> RangeTo<i32> { return ..1; }`.

Also, remove `fn_expr_lookahead`.
It's from the `fn~` days and seems to no longer be necessary.

9 years agoauto merge of #21276 : huonw/rust/trait-suggestion-nits, r=nikomatsakis
bors [Sun, 18 Jan 2015 09:21:42 +0000 (09:21 +0000)]
auto merge of #21276 : huonw/rust/trait-suggestion-nits, r=nikomatsakis

Follow up to #21008.

r? @nikomatsakis

9 years agoauto merge of #21288 : brson/rust/snaps, r=alexcrichton
bors [Sun, 18 Jan 2015 05:48:56 +0000 (05:48 +0000)]
auto merge of #21288 : brson/rust/snaps, r=alexcrichton

This fixes the issues mentioned in https://github.com/rust-lang/rust/pull/21236, as well as the one https://github.com/rust-lang/rust/issues/21230 where `CFG_BOOTSTRAP_KEY` was being set to simply 'N'. It changes the build such that `RUSTC_BOOTSTRAP_KEY` is only exported on -beta and -stable, so that the behavior of the -dev, -nightly, and snapshot compilers is the same everywhere.

Haven't run it completely through 'make check' yet, but the I have verified that the aforementioned issues are fixed.

r? @alexcrichton cc @eddyb

9 years agotests: Warn on the trailing backslash in the template.
Kang Seonghoon [Sun, 18 Jan 2015 04:23:34 +0000 (13:23 +0900)]
tests: Warn on the trailing backslash in the template.

9 years agoauto merge of #21330 : JeffBelgum/rust/collections-reform-issue-19986-add-append...
bors [Sun, 18 Jan 2015 03:11:42 +0000 (03:11 +0000)]
auto merge of #21330 : JeffBelgum/rust/collections-reform-issue-19986-add-append-and-split-off, r=Gankro

Please review carefully. Contains unsafe and is my first commit to Rust.

Uses ptr::copy_nonoverlapping_memory. Attempts to handle zero-size types correctly.

9 years agoAdd allow(unstable) to librustc_privacy
Brian Anderson [Sat, 17 Jan 2015 17:13:48 +0000 (09:13 -0800)]
Add allow(unstable) to librustc_privacy

9 years agoAdd allow(unstable) to more tests
Brian Anderson [Sat, 17 Jan 2015 08:58:06 +0000 (00:58 -0800)]
Add allow(unstable) to more tests

9 years agoAdd allow(unstable) to driver.rs
Brian Anderson [Sat, 17 Jan 2015 08:11:19 +0000 (00:11 -0800)]
Add allow(unstable) to driver.rs

9 years agoAdd allow(unstable) to tests that need it
Brian Anderson [Sat, 17 Jan 2015 07:35:44 +0000 (23:35 -0800)]
Add allow(unstable) to tests that need it

9 years agoconfigure: Use a more portable 'date' command to create the bootstrap key
Brian Anderson [Sat, 17 Jan 2015 06:39:04 +0000 (22:39 -0800)]
configure: Use a more portable 'date' command to create the bootstrap key

9 years agoSet allow(unstable) in crates that use unstable features
Brian Anderson [Sat, 17 Jan 2015 06:33:24 +0000 (22:33 -0800)]
Set allow(unstable) in crates that use unstable features

Lets them build with the -dev, -nightly, or snapshot compiler

9 years agomk: Don't set RUSTC_BOOTSTRAP_KEY on -dev and -nightly. Not needed
Brian Anderson [Sat, 17 Jan 2015 06:33:00 +0000 (22:33 -0800)]
mk: Don't set RUSTC_BOOTSTRAP_KEY on -dev and -nightly. Not needed

9 years agomk: Revert hack to pull the bootstrap key from the snapshot bins
Brian Anderson [Sat, 17 Jan 2015 06:31:31 +0000 (22:31 -0800)]
mk: Revert hack to pull the bootstrap key from the snapshot bins

9 years agoRegister new snapshots.
Eduard Burtescu [Fri, 16 Jan 2015 15:01:02 +0000 (17:01 +0200)]
Register new snapshots.

9 years agoadd append to vec with tests
Jeff Belgum [Sat, 17 Jan 2015 22:30:16 +0000 (14:30 -0800)]
add append to vec with tests

9 years agoauto merge of #21300 : steveklabnik/rust/rollup, r=steveklabnik
bors [Sat, 17 Jan 2015 20:31:08 +0000 (20:31 +0000)]
auto merge of #21300 : steveklabnik/rust/rollup, r=steveklabnik

manual rollup to fix some conflicts and diagnose why the test is failing...

9 years agoFix more rollup problems
Steve Klabnik [Sat, 17 Jan 2015 20:25:42 +0000 (15:25 -0500)]
Fix more rollup problems

9 years agofix rollup
Steve Klabnik [Sat, 17 Jan 2015 18:58:54 +0000 (13:58 -0500)]
fix rollup

9 years agotests: Tidy and allows multi-line htmldocck commands.
Kang Seonghoon [Sat, 17 Jan 2015 18:23:52 +0000 (03:23 +0900)]
tests: Tidy and allows multi-line htmldocck commands.

9 years agotests: Add htmldocck.py script for the use of Rustdoc tests.
Kang Seonghoon [Sat, 17 Jan 2015 17:24:04 +0000 (02:24 +0900)]
tests: Add htmldocck.py script for the use of Rustdoc tests.

The script is intended as a tool for doing every sort of verifications
amenable to Rustdoc's HTML output. For example, link checkers would go
to this script. It already parses HTML into a document tree form (with
a slight caveat), so future tests can make use of it.

As an example, relevant `rustdoc-*` run-make tests have been updated
to use `htmldocck.py` and got their `verify.sh` removed. In the future
they may go to a dedicated directory with htmldocck running by default.
The detailed explanation of test scripts is provided as a docstring of
htmldocck.

cc #19723

9 years agodocs: grammar fix
Alfie John [Sat, 17 Jan 2015 13:19:21 +0000 (13:19 +0000)]
docs: grammar fix

9 years agodoc: Remove extra whitespace in the middle of lines to provide alignment
Nick Howell [Sun, 4 Jan 2015 17:31:02 +0000 (12:31 -0500)]
doc: Remove extra whitespace in the middle of lines to provide alignment

"Idiomatic code should not use extra whitespace in the middle of a line to provide alignment."
http://aturon.github.io/style/whitespace.html

I realize the linked page still needs an RFC, but the docs should be written in accordance with the guidelines nevertheless.

9 years agostd: Move the bitflags! macro to a gated crate
Alex Crichton [Fri, 16 Jan 2015 20:20:03 +0000 (12:20 -0800)]
std: Move the bitflags! macro to a gated crate

In accordance with [collections reform part 2][rfc] this macro has been moved to
an external [bitflags crate][crate] which is [available though
crates.io][cratesio]. Inside the standard distribution the macro has been moved
to a crate called `rustc_bitflags` for current users to continue using.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0509-collections-reform-part-2.md
[crate]: https://github.com/rust-lang/bitflags
[cratesio]: http://crates.io/crates/bitflags

The major user of `bitflags!` in terms of a public-facing possibly-stable API
today is the `FilePermissions` structure inside of `std::io`. This user,
however, will likely no longer use `bitflags!` after I/O reform has landed. To
prevent breaking APIs today, this structure remains as-is.

Current users of the `bitflags!` macro should add this to their `Cargo.toml`:

    bitflags = "0.1"

and this to their crate root:

    #[macro_use] extern crate bitflags;

Due to the removal of a public macro, this is a:

[breaking-change]

9 years agoBeef up Copy documentation
Steve Klabnik [Fri, 16 Jan 2015 21:21:06 +0000 (16:21 -0500)]
Beef up Copy documentation

Fixes #21249
Fixes #11540

9 years agoAdd C -> Rust example to FFI chapter of the book.
Steve Klabnik [Fri, 16 Jan 2015 20:27:44 +0000 (15:27 -0500)]
Add C -> Rust example to FFI chapter of the book.

Fixes #10489.

9 years agoUpdate syntax of ignored test.
Steve Klabnik [Fri, 16 Jan 2015 21:42:53 +0000 (16:42 -0500)]
Update syntax of ignored test.

9 years agoFix up titles of TRPL chapters
Steve Klabnik [Fri, 16 Jan 2015 20:30:27 +0000 (15:30 -0500)]
Fix up titles of TRPL chapters

9 years agoMake Index trait example clearer
Volker Mische [Fri, 16 Jan 2015 20:29:43 +0000 (21:29 +0100)]
Make Index trait example clearer

The example of the `Index` and `IndexMut` trait contained too much `Foo`.
It now contains a bit more `Bar` to make things clearer which parts are
defining the type of the index.

9 years agoFix typo.
Ms2ger [Fri, 16 Jan 2015 18:08:08 +0000 (19:08 +0100)]
Fix typo.

9 years agoBump LICENSE copyright year
Corey Farwell [Fri, 16 Jan 2015 17:09:49 +0000 (12:09 -0500)]
Bump LICENSE copyright year

9 years agoIntpocalypse, book edition.
Steve Klabnik [Tue, 13 Jan 2015 15:40:18 +0000 (10:40 -0500)]
Intpocalypse, book edition.

Fix all usage of int/uint/i/u in the book.

9 years agoEvaluate # fn in docs
Steve Klabnik [Mon, 12 Jan 2015 21:59:34 +0000 (16:59 -0500)]
Evaluate # fn in docs

I searched for times when we were hiding functions with # in the documentation,
and fixed them to not use it unless neccesary.

I also made random improvements whenever I changed something. For example,
I changed Example to Examples, for consistency.

Fixes #13423

9 years agoRemove segmented stack info from the FFI chapter of the book.
Steve Klabnik [Mon, 12 Jan 2015 18:41:37 +0000 (13:41 -0500)]
Remove segmented stack info from the FFI chapter of the book.

Fixes #20071.

9 years agoReplace obsolete constructions in into examples
Andrew Barchuk [Wed, 14 Jan 2015 20:28:48 +0000 (22:28 +0200)]
Replace obsolete constructions in into examples

Replace deprecated integer suffixes. Remove integer type notations
altogether where possible. Replace uses of deprecated `range()`
function with range notation.

9 years agoRemove Thread::detach() call from intro example
Andrew Barchuk [Wed, 14 Jan 2015 19:59:46 +0000 (21:59 +0200)]
Remove Thread::detach() call from intro example

The mentioned method are no longer part of Thread. Spawned threads are
detached by default as of now.

9 years agoFix intro concurrency examples compilation warns
Andrew Barchuk [Tue, 13 Jan 2015 21:22:32 +0000 (23:22 +0200)]
Fix intro concurrency examples compilation warns

* Use range notation instead of deprecated `range()`

* Remove deprecated `u` integer suffixes used in ranges

* Replace deprecated `i` integer suffixes with `is` for vector numbers

`Thread::spawn()` still gives "use of unstable item" warning which I
hadn't found a way to fix.

9 years agoRevert stability for Bitv and BitvSet
Simonas Kazlauskas [Thu, 15 Jan 2015 20:56:53 +0000 (22:56 +0200)]
Revert stability for Bitv and BitvSet

The collections were promoted to stable by mistake and do not match RFC 509.
This reverts the stability back to unstable.

[breaking-change] since previously stable API became unstable.

Fixes #21193

9 years agoAdd enum discriminats to the reference.
Steve Klabnik [Mon, 12 Jan 2015 21:07:44 +0000 (16:07 -0500)]
Add enum discriminats to the reference.

Fixes #15755

9 years agoAdd note about libc::exit's unsafety.
Steve Klabnik [Mon, 12 Jan 2015 18:13:01 +0000 (13:13 -0500)]
Add note about libc::exit's unsafety.

Fixes #19245.

9 years agoauto merge of #21233 : huonw/rust/simd-size, r=Aatch
bors [Sat, 17 Jan 2015 10:58:43 +0000 (10:58 +0000)]
auto merge of #21233 : huonw/rust/simd-size, r=Aatch

This stops the compiler ICEing on the use of SIMD types in FFI signatures. It emits correct code for LLVM intrinsics, but I am quite unsure about the ABI handling in general so I've added a new feature gate `simd_ffi` to try to ensure people don't use it without realising there's a non-trivial risk of codegen brokenness.

Closes #20043.

9 years agoauto merge of #21205 : alexcrichton/rust/issue-21202, r=nikomatsakis
bors [Sat, 17 Jan 2015 08:51:38 +0000 (08:51 +0000)]
auto merge of #21205 : alexcrichton/rust/issue-21202, r=nikomatsakis

Loading methods from external crates was erroneously using the type's privacy
for each method instead of each method's privacy. This commit fixes that.

Closes #21202

This commit also moves privacy to its own crate because I thought that was where the bug was. Turns out it wasn't, but it helped me iterate at least!

9 years agoauto merge of #21132 : sfackler/rust/wait_timeout, r=alexcrichton
bors [Sat, 17 Jan 2015 03:51:34 +0000 (03:51 +0000)]
auto merge of #21132 : sfackler/rust/wait_timeout, r=alexcrichton

**The implementation is a direct adaptation of libcxx's condition_variable implementation.**

I also added a wait_timeout_with method, which matches the second overload in C++'s condition_variable. The implementation right now is kind of dumb but it works. There is an outstanding issue with it: as is it doesn't support the use case where a user doesn't care about poisoning and wants to continue through poison.

r? @alexcrichton @aturon

9 years agoAddress nits in trait suggestions.
Huon Wilson [Sat, 17 Jan 2015 01:29:26 +0000 (12:29 +1100)]
Address nits in trait suggestions.

9 years agoFeature gate SIMD in FFI, due to unknown ABIs.
Huon Wilson [Thu, 15 Jan 2015 23:16:20 +0000 (10:16 +1100)]
Feature gate SIMD in FFI, due to unknown ABIs.

I don't know if this handling of SIMD types is correct for the C ABI on
all platforms, so lets add an even finer feature gate than just the
`simd` one.

The `simd` one can be used with (relatively) little risk of complete
nonsense, the reason for it is that it is likely that things will
change. Using the types in FFI with an incorrect ABI will at best give
absolute nonsense results, but possibly cause serious breakage too, so
this is a step up in badness, hence a new feature gate.

9 years agoAdd comprehensive test for no-ICE behaviour of SIMD FFI.
Huon Wilson [Thu, 15 Jan 2015 22:23:18 +0000 (09:23 +1100)]
Add comprehensive test for no-ICE behaviour of SIMD FFI.

This just compiles a test using SIMD in FFI (mostly importing LLVM
intrinsics) for almost all rustc's supported platforms, but not linking
it or running it, so there's absolutely no guarantee that this is correct.

9 years agosyntax: Feature gate #[start] and #[main]
Alex Crichton [Fri, 16 Jan 2015 18:55:24 +0000 (10:55 -0800)]
syntax: Feature gate #[start] and #[main]

These two attributes are used to change the entry point into a Rust program, but
for now they're being put behind feature gates until we have a chance to think
about them a little more. The #[start] attribute specifically may have its
signature changed.

This is a breaking change to due the usage of these attributes generating errors
by default now. If your crate is using these attributes, add this to your crate
root:

    #![feature(start)] // if you're using the #[start] attribute
    #![feature(main)]  // if you're using the #[main] attribute

cc #20064

9 years agoauto merge of #21008 : huonw/rust/trait-suggestions, r=nikomatsakis
bors [Fri, 16 Jan 2015 22:41:16 +0000 (22:41 +0000)]
auto merge of #21008 : huonw/rust/trait-suggestions, r=nikomatsakis

For a call like `foo.bar()` where the method `bar` can't be resolved,
the compiler will search for traits that have methods with name `bar` to
give a more informative error, providing a list of possibilities.

Closes #7643.

9 years agoFixes `join_multicast` on Windows #20381
Daniil Smirnov [Fri, 16 Jan 2015 22:37:07 +0000 (01:37 +0300)]
Fixes `join_multicast` on Windows #20381

9 years agoauto merge of #21113 : alexcrichton/rust/plug-a-hole, r=brson
bors [Fri, 16 Jan 2015 19:17:30 +0000 (19:17 +0000)]
auto merge of #21113 : alexcrichton/rust/plug-a-hole, r=brson

With the addition of separate search paths to the compiler, it was intended that
applications such as Cargo could require a `--extern` flag per `extern crate`
directive in the source. The system can currently be subverted, however, due to
the `existing_match()` logic in the crate loader.

When loading crates we first attempt to match an `extern crate` directive
against all previously loaded crates to avoid reading metadata twice. This "hit
the cache if possible" step was erroneously leaking crates across the search
path boundaries, however. For example:

    extern crate b;
    extern crate a;

If `b` depends on `a`, then it will load crate `a` when the `extern crate b`
directive is being processed. When the compiler reaches `extern crate a` it will
use the previously loaded version no matter what. If the compiler was not
invoked with `-L crate=path/to/a`, it will still succeed.

This behavior is allowing `extern crate` declarations in Cargo without a
corresponding declaration in the manifest of a dependency, which is considered
a bug.

This commit fixes this problem by keeping track of the origin search path for a
crate. Crates loaded from the dependency search path are not candidates for
crates which are loaded from the crate search path.

9 years agoRewrite Condvar::wait_timeout and make it public
Steven Fackler [Wed, 14 Jan 2015 05:24:26 +0000 (21:24 -0800)]
Rewrite Condvar::wait_timeout and make it public

**The implementation is a direct adaptation of libcxx's
condition_variable implementation.**

pthread_cond_timedwait uses the non-monotonic system clock. It's
possible to change the clock to a monotonic via pthread_cond_attr, but
this is incompatible with static initialization. To deal with this, we
calculate the timeout using the system clock, and maintain a separate
record of the start and end times with a monotonic clock to be used for
calculation of the return value.

9 years agorustc: Fix a leak in dependency= paths
Alex Crichton [Tue, 6 Jan 2015 16:46:07 +0000 (08:46 -0800)]
rustc: Fix a leak in dependency= paths

With the addition of separate search paths to the compiler, it was intended that
applications such as Cargo could require a `--extern` flag per `extern crate`
directive in the source. The system can currently be subverted, however, due to
the `existing_match()` logic in the crate loader.

When loading crates we first attempt to match an `extern crate` directive
against all previously loaded crates to avoid reading metadata twice. This "hit
the cache if possible" step was erroneously leaking crates across the search
path boundaries, however. For example:

    extern crate b;
    extern crate a;

If `b` depends on `a`, then it will load crate `a` when the `extern crate b`
directive is being processed. When the compiler reaches `extern crate a` it will
use the previously loaded version no matter what. If the compiler was not
invoked with `-L crate=path/to/a`, it will still succeed.

This behavior is allowing `extern crate` declarations in Cargo without a
corresponding declaration in the manifest of a dependency, which is considered
a bug.

This commit fixes this problem by keeping track of the origin search path for a
crate. Crates loaded from the dependency search path are not candidates for
crates which are loaded from the crate search path.

As a result of this fix, this is a likely a breaking change for a number of
Cargo packages. If the compiler starts informing that a crate can no longer be
found, it likely means that the dependency was forgotten in your Cargo.toml.

[breaking-change]

9 years agorustc_resolve: Correctly record privacy of methods
Alex Crichton [Thu, 15 Jan 2015 18:49:47 +0000 (10:49 -0800)]
rustc_resolve: Correctly record privacy of methods

Loading methods from external crates was erroneously using the type's privacy
for each method instead of each method's privacy. This commit fixes that.

Closes #21202

9 years agorustc: Move the privacy pass to its own crate
Alex Crichton [Thu, 15 Jan 2015 18:47:17 +0000 (10:47 -0800)]
rustc: Move the privacy pass to its own crate

9 years agoauto merge of #21162 : apasel422/rust/issue-16530, r=huonw
bors [Fri, 16 Jan 2015 16:21:06 +0000 (16:21 +0000)]
auto merge of #21162 : apasel422/rust/issue-16530, r=huonw

This fixes #16530 by hashing nullary structs [the same way as the empty tuple] (https://github.com/rust-lang/rust/blob/master/src/libcore/hash/mod.rs#L185). Other approaches are possible, but this was the simplest.

9 years agoauto merge of #20972 : FlaPer87/rust/oibit-send-and-friends, r=nikomatsakis
bors [Fri, 16 Jan 2015 13:10:59 +0000 (13:10 +0000)]
auto merge of #20972 : FlaPer87/rust/oibit-send-and-friends, r=nikomatsakis

This PR adds rules for negative implementations. It follows pretty much what the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/0019-opt-in-builtin-traits.md) says with 1 main difference:

Instead of positive implementations override negative implementations, this have been implemented in a way that a negative implementation of `Trait` for `T` will overlap with a positive implementation, causing a coherence error.

@nikomatsakis r?

cc #13231

[breaking-change]

9 years agoPrefer implemented traits in suggestions.
Huon Wilson [Fri, 16 Jan 2015 11:27:40 +0000 (22:27 +1100)]
Prefer implemented traits in suggestions.

If `a.method();` can't be resolved, we first look for implemented traits
globally and suggest those. If there are no such traits found, we only
then fall back to suggesting from the unfiltered list of traits.

9 years agoPut vector types in regs for arm & mips FFI.
Huon Wilson [Thu, 15 Jan 2015 03:43:24 +0000 (14:43 +1100)]
Put vector types in regs for arm & mips FFI.

This seems to match what clang does on arm, but I cannot do any
experimentation with mips, but it matches how the LLVM intrinsics are
defined in any case...

9 years agoSupport SSE with integer types in x86-64 FFI.
Huon Wilson [Thu, 15 Jan 2015 02:49:41 +0000 (13:49 +1100)]
Support SSE with integer types in x86-64 FFI.

Unlike the intrinics in C, this types the SSE values base on integer
size. This matches the LLVM intrinsics which have concrete vector types
(`<4 x i32>` etc.), and is no loss of expressivity: if one is using a C
function that really takes an untyped integral SSE value, just give it
whatever Rust type makes most sense.

9 years agoAdd `Type::int_width` for retrieving integer's bit width.
Huon Wilson [Wed, 14 Jan 2015 14:08:22 +0000 (01:08 +1100)]
Add `Type::int_width` for retrieving integer's bit width.

9 years agoSupport SSE types in extern {} better.
Huon Wilson [Wed, 14 Jan 2015 13:27:38 +0000 (00:27 +1100)]
Support SSE types in extern {} better.

This seems to work on x86-64, but I am not able to test on other
platforms.

cc #20043

9 years agofix pretty test fallout
Flavio Percoco [Fri, 16 Jan 2015 10:47:48 +0000 (11:47 +0100)]
fix pretty test fallout

9 years agoDocs fallout
Flavio Percoco [Fri, 16 Jan 2015 07:18:39 +0000 (08:18 +0100)]
Docs fallout

9 years agopopulate impls *before* clonning the impls vec
Flavio Percoco [Thu, 15 Jan 2015 09:09:00 +0000 (10:09 +0100)]
populate impls *before* clonning the impls vec

9 years agofix latest changes fallout
Flavio Percoco [Wed, 14 Jan 2015 07:50:56 +0000 (08:50 +0100)]
fix latest changes fallout

9 years agoaddressed comments
Flavio Percoco [Tue, 13 Jan 2015 19:21:19 +0000 (20:21 +0100)]
addressed comments

9 years agoAllow negative impls just for Send and Sync
Flavio Percoco [Mon, 12 Jan 2015 09:59:22 +0000 (10:59 +0100)]
Allow negative impls just for Send and Sync

9 years agoDon't use NoSend/NoSync in tests
Flavio Percoco [Sun, 11 Jan 2015 12:14:39 +0000 (13:14 +0100)]
Don't use NoSend/NoSync in tests

9 years agoFix coherence for negative implementations
Flavio Percoco [Wed, 7 Jan 2015 18:27:01 +0000 (19:27 +0100)]
Fix coherence for negative implementations

9 years agoadd a run-pass test that used to fail
Flavio Percoco [Sun, 11 Jan 2015 14:51:52 +0000 (15:51 +0100)]
add a run-pass test that used to fail

9 years agoDon't use NoSend/NoSync in libstd
Flavio Percoco [Sun, 11 Jan 2015 10:10:04 +0000 (11:10 +0100)]
Don't use NoSend/NoSync in libstd

9 years agoDon't use NoSend/NoSync in liballoc
Flavio Percoco [Sun, 11 Jan 2015 10:09:53 +0000 (11:09 +0100)]
Don't use NoSend/NoSync in liballoc

9 years agoRemove NoSend/NoSync
Flavio Percoco [Sun, 11 Jan 2015 10:09:31 +0000 (11:09 +0100)]
Remove NoSend/NoSync