]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #19898: Aatch/issue-19684
Alex Crichton [Sun, 21 Dec 2014 08:03:59 +0000 (00:03 -0800)]
rollup merge of #19898: Aatch/issue-19684

#16081 fixed an issue where a nested return statement would cause incorrect behaviour due to the inner return writing over the return stack slot that had already been written too. However, the check was very broad and picked many cases that wouldn't ever be affected by this issue.

As a result, the number of allocas increased dramatically and therefore stack-size increased. LLVM is not able to remove all of the extraneous allocas. Any code that had multiple return values in a compound expression at the end of a function (including loops) would be hit by the issue.

The check now uses a control-flow graph to only consider the case when the inner return is executed conditionally. By itself, this narrowed definition causes #15763 to return, so the control-flow graph is also used to avoid passing the return slot as a destination when the result won't be used.

This change allows the stack-size of the main rustc task to be reduced to 8MB from 32MB.

9 years agorollup merge of #19842: frewsxcv/rm-reexports
Alex Crichton [Sun, 21 Dec 2014 08:03:59 +0000 (00:03 -0800)]
rollup merge of #19842: frewsxcv/rm-reexports

Remove most of the public reexports mentioned in #19253

These are all leftovers from the enum namespacing transition

In particular:

* src/libstd/num/strconv.rs
 * ExponentFormat
 * SignificantDigits
 * SignFormat
* src/libstd/path/windows.rs
 * PathPrefix
* src/libstd/sys/windows/timer.rs
 * Req
* src/libcollections/str.rs
 * MaybeOwned
* src/libstd/collections/hash/map.rs
 * Entry
* src/libstd/collections/hash/table.rs
 * BucketState
* src/libstd/dynamic_lib.rs
 * Rtld
* src/libstd/os.rs
 * MemoryMapKind
 * MapOption
 * MapError
* src/libstd/sys/common/net.rs
 * SocketStatus
 * InAddr
* src/libstd/sys/unix/timer.rs
 * Req

[breaking-change]

9 years agorollup merge of #19838: shepmaster/invariant-lifetime-copy
Alex Crichton [Sun, 21 Dec 2014 08:03:59 +0000 (00:03 -0800)]
rollup merge of #19838: shepmaster/invariant-lifetime-copy

Both ContravariantLifetime and CovariantLifetime are marked as Copy,
so it makes sense for InvariantLifetime to be as well.

9 years agoRemove a ton of public reexports
Corey Farwell [Sat, 13 Dec 2014 16:15:18 +0000 (11:15 -0500)]
Remove a ton of public reexports

Remove most of the public reexports mentioned in #19253

These are all leftovers from the enum namespacing transition

In particular:

* src/libstd/num/strconv.rs
 * ExponentFormat
 * SignificantDigits
 * SignFormat
* src/libstd/path/windows.rs
 * PathPrefix
* src/libstd/sys/windows/timer.rs
 * Req
* src/libcollections/str.rs
 * MaybeOwned
* src/libstd/collections/hash/map.rs
 * Entry
* src/libstd/collections/hash/table.rs
 * BucketState
* src/libstd/dynamic_lib.rs
 * Rtld
* src/libstd/io/net/ip.rs
 * IpAddr
* src/libstd/os.rs
 * MemoryMapKind
 * MapOption
 * MapError
* src/libstd/sys/common/net.rs
 * SocketStatus
 * InAddr
* src/libstd/sys/unix/timer.rs
 * Req

[breaking-change]

9 years agorollup merge of #19823: iKevinY/doc-fixes
Alex Crichton [Sun, 21 Dec 2014 08:03:58 +0000 (00:03 -0800)]
rollup merge of #19823: iKevinY/doc-fixes

I was reading through the Rust Guide (hopefully looking to learn some Rust), and I figured it would be a good idea to open a pull request with some of the errata I noticed along the way. Most of the changes are pretty mundane, but there are a couple that might raise a bit of discussion.

### Punctuation outside of 'key term' quotes

This is something that was inconsistent in the Guide. While the convention in American English is to place punctuation immediately following a quotation mark *inside* the quotation mark, it seems strange to do this with 'key terms', considering they are not a true quotation.

### Changed comment placement in 17.2 code block

This is what the code block in [17.2 — Ownership, borrowing, and lifetimes](http://doc.rust-lang.org/guide.html#ownership,-borrowing,-and-lifetimes) looks like in fullscreened Safari 8:

![screen shot 2014-12-13 at 2 48 47 pm](https://cloud.githubusercontent.com/assets/2434728/5425704/2fff3bf0-82d7-11e4-8c8f-d594acde8937.png)

Some of the comments extend *just* too far, causing them to bleed into the next line, so I moved a few of them above the relevant lines of code to avoid this.

9 years agorollup merge of #19727: lfairy/patch-1
Alex Crichton [Sun, 21 Dec 2014 08:03:58 +0000 (00:03 -0800)]
rollup merge of #19727: lfairy/patch-1

Closes #19323.

9 years agorollup merge of #19651: Gankro/ptr-docs
Alex Crichton [Sun, 21 Dec 2014 08:03:58 +0000 (00:03 -0800)]
rollup merge of #19651: Gankro/ptr-docs

r? @steveklabnik @thestinger

9 years agoauto merge of #19953 : sanxiyn/rust/privacy-span, r=alexcrichton
bors [Sun, 21 Dec 2014 13:22:48 +0000 (13:22 +0000)]
auto merge of #19953 : sanxiyn/rust/privacy-span, r=alexcrichton

Fix #19062.

9 years agoauto merge of #19946 : cgaebel/rust/hashmap-drain-iter, r=gankro
bors [Sun, 21 Dec 2014 07:22:45 +0000 (07:22 +0000)]
auto merge of #19946 : cgaebel/rust/hashmap-drain-iter, r=gankro

It is useful to move all the elements out of a hashmap without deallocating
the underlying buffer. It came up in IRC, and this patch implements it as
`drain`.

r? @Gankro
cc: @frankmcsherry

9 years agoauto merge of #19903 : cgaebel/rust/ringbuf-as-slice, r=Gankro
bors [Sat, 20 Dec 2014 20:00:36 +0000 (20:00 +0000)]
auto merge of #19903 : cgaebel/rust/ringbuf-as-slice, r=Gankro

See: https://github.com/rust-lang/rfcs/pull/509

Not sure if this is allowed to land before the RFC. Either way,
it's here for review.

r? @Gankro
cc: @bfops

9 years agoauto merge of #20073 : nikomatsakis/rust/generalized-where-clause-parser, r=nikomatsakis
bors [Sat, 20 Dec 2014 16:12:37 +0000 (16:12 +0000)]
auto merge of #20073 : nikomatsakis/rust/generalized-where-clause-parser, r=nikomatsakis

This is the same branch as #20002 but with the pretty-printing test fixed.

9 years agoauto merge of #19900 : alexcrichton/rust/compiler-flags, r=cmr
bors [Sat, 20 Dec 2014 13:52:27 +0000 (13:52 +0000)]
auto merge of #19900 : alexcrichton/rust/compiler-flags, r=cmr

This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, `--no-analysis`, and `--pretty` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.
* The top-level `--pretty` flag was moved to a number of `-Z` options.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.

cc https://github.com/rust-lang/rust/issues/19051

9 years agopatch up pretty-printing test
Niko Matsakis [Sat, 20 Dec 2014 13:41:33 +0000 (08:41 -0500)]
patch up pretty-printing test

9 years agoAdd support for multiple region bounds in where clauses
Jared Roesch [Sat, 20 Dec 2014 10:48:43 +0000 (02:48 -0800)]
Add support for multiple region bounds in where clauses

9 years agoAdd parser support for generalized where clauses
Jared Roesch [Sat, 20 Dec 2014 10:29:19 +0000 (02:29 -0800)]
Add parser support for generalized where clauses

Implement support in the parser for generalized where clauses,
as well as the conversion of ast::WherePredicates to
ty::Predicate in `collect.rs`.

9 years agoauto merge of #19511 : eddyb/rust/no-shadow, r=alexcrichton
bors [Sat, 20 Dec 2014 08:10:23 +0000 (08:10 +0000)]
auto merge of #19511 : eddyb/rust/no-shadow, r=alexcrichton

r? @erickt

9 years agoauto merge of #19995 : eddyb/rust/split-resolve, r=nikomatsakis
bors [Sat, 20 Dec 2014 05:52:18 +0000 (05:52 +0000)]
auto merge of #19995 : eddyb/rust/split-resolve, r=nikomatsakis

r? @nikomatsakis

9 years agoFix fallout of removing import_shadowing in tests.
Eduard Burtescu [Fri, 19 Dec 2014 12:02:22 +0000 (14:02 +0200)]
Fix fallout of removing import_shadowing in tests.

9 years agoFix more import_shadowing fallout in collections.
Eduard Burtescu [Thu, 18 Dec 2014 04:15:39 +0000 (06:15 +0200)]
Fix more import_shadowing fallout in collections.

9 years agoFix the fallout of removing feature(import_shadowing).
Eduard Burtescu [Mon, 15 Dec 2014 04:03:00 +0000 (06:03 +0200)]
Fix the fallout of removing feature(import_shadowing).

9 years agorustc_resolve: move export recording into its own module.
Eduard Burtescu [Fri, 19 Dec 2014 07:14:42 +0000 (09:14 +0200)]
rustc_resolve: move export recording into its own module.

9 years agorustc_resolve: move unused import checking into its own module.
Eduard Burtescu [Fri, 19 Dec 2014 07:13:54 +0000 (09:13 +0200)]
rustc_resolve: move unused import checking into its own module.

9 years agoSplit resolve from rustc::middle into rustc_resolve.
Eduard Burtescu [Thu, 18 Dec 2014 22:46:26 +0000 (00:46 +0200)]
Split resolve from rustc::middle into rustc_resolve.

9 years agorustc: middle: move some types from resolve to privacy.
Eduard Burtescu [Thu, 18 Dec 2014 22:26:54 +0000 (00:26 +0200)]
rustc: middle: move some types from resolve to privacy.

9 years agorustc: middle: move TraitItemKind from resolve to def.
Eduard Burtescu [Thu, 18 Dec 2014 22:17:58 +0000 (00:17 +0200)]
rustc: middle: move TraitItemKind from resolve to def.

9 years agorustc: middle: move Export and ExportMap from resolve to def.
Eduard Burtescu [Thu, 18 Dec 2014 22:03:00 +0000 (00:03 +0200)]
rustc: middle: move Export and ExportMap from resolve to def.

9 years agorustc: middle: use cheaper Name in resolve::Export instead of String.
Eduard Burtescu [Thu, 18 Dec 2014 21:21:30 +0000 (23:21 +0200)]
rustc: middle: use cheaper Name in resolve::Export instead of String.

9 years agorustc: middle: move TraitMap from resolve to ty.
Eduard Burtescu [Thu, 18 Dec 2014 19:04:28 +0000 (21:04 +0200)]
rustc: middle: move TraitMap from resolve to ty.

9 years agorustc: middle: move DefMap from resolve to def.
Eduard Burtescu [Thu, 18 Dec 2014 19:03:56 +0000 (21:03 +0200)]
rustc: middle: move DefMap from resolve to def.

9 years agomiddle: resolve: fix inconsistencies around ExportMap and remove the 2 suffix.
Eduard Burtescu [Thu, 18 Dec 2014 18:27:17 +0000 (20:27 +0200)]
middle: resolve: fix inconsistencies around ExportMap and remove the 2 suffix.

9 years agorustc: don't allow(non_camel_case_types) in resolve.
Eduard Burtescu [Thu, 18 Dec 2014 17:17:41 +0000 (19:17 +0200)]
rustc: don't allow(non_camel_case_types) in resolve.

9 years agoRemove feature(import_shadowing) from all crates.
Eduard Burtescu [Wed, 3 Dec 2014 23:58:26 +0000 (01:58 +0200)]
Remove feature(import_shadowing) from all crates.

9 years agoauto merge of #19640 : aliblong/rust/power_of_two_reform, r=Gankro
bors [Sat, 20 Dec 2014 01:12:19 +0000 (01:12 +0000)]
auto merge of #19640 : aliblong/rust/power_of_two_reform, r=Gankro

The `is_power_of_two()` method of the `UnsignedInt` trait currently returns `true` for `self == 0`. Zero is not a power of two, assuming an integral exponent `k >= 0`. I've therefore moved this functionality to the new method `is_power_of_two_or_zero()` and reformed `is_power_of_two()` to return false for `self == 0`.

To illustrate the usefulness of the existence of both functions, consider `HashMap`. Its capacity must be zero or a power of two; conversely, it also requires a (non-zero) power of two for key and val alignment.

Also, added a small amount of documentation regarding #18604.

9 years agoReform power_of_two methods for perf increase & semantic change to consider 0 not...
Aaron Liblong [Mon, 8 Dec 2014 06:03:35 +0000 (01:03 -0500)]
Reform power_of_two methods for perf increase & semantic change to consider 0 not a power of 2.

Vec panics when attempting to reserve capacity > int::MAX (uint::MAX / 2).

9 years agoauto merge of #19463 : kali/rust/master, r=alexcrichton
bors [Fri, 19 Dec 2014 20:22:17 +0000 (20:22 +0000)]
auto merge of #19463 : kali/rust/master, r=alexcrichton

parse_ty() no longer takes a boolean parameter. quote_ty! implementation has not yet been modified accordingly.

As a matter of fact, quote_ty! was not covered by tests. One test (called qquotes) references it, but it has been ignored for nearly one year and now need heavy refactoring.

quote_token.rs seemed like a good place to test quote_ty!, many other quote_*! macros were asserted there.

9 years agorustc: Start "stabilizing" some flags
Alex Crichton [Tue, 16 Dec 2014 00:03:39 +0000 (16:03 -0800)]
rustc: Start "stabilizing" some flags

This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, and `--no-analysis` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.

9 years agoMiscellaneous changes to Rust Guide
Kevin Yap [Sat, 13 Dec 2014 22:36:53 +0000 (14:36 -0800)]
Miscellaneous changes to Rust Guide

- Various grammatical changes
- Place punctuation outside of key term quotes
- Change comment placement in 17.2 code block
- Replace double hyphens with en dashes

9 years agoauto merge of #19867 : japaric/rust/deriving-copy, r=acrichto
bors [Fri, 19 Dec 2014 16:02:31 +0000 (16:02 +0000)]
auto merge of #19867 : japaric/rust/deriving-copy, r=acrichto

r? @alexcrichton

9 years agowindows: remove unused import
Jorge Aparicio [Fri, 19 Dec 2014 13:09:11 +0000 (08:09 -0500)]
windows: remove unused import

9 years agolibtime: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:34:36 +0000 (23:34 -0500)]
libtime: use `#[deriving(Copy)]`

9 years agolibtest: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:34:08 +0000 (23:34 -0500)]
libtest: use `#[deriving(Copy)]`

9 years agolibterm: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:33:35 +0000 (23:33 -0500)]
libterm: use `#[deriving(Copy)]`

9 years agolibsyntax: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:32:24 +0000 (23:32 -0500)]
libsyntax: use `#[deriving(Copy)]`

9 years agolibstd: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:24:36 +0000 (23:24 -0500)]
libstd: use `#[deriving(Copy)]`

9 years agolibserialize: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:20:43 +0000 (23:20 -0500)]
libserialize: use `#[deriving(Copy)]`

9 years agolibrustrt: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:19:48 +0000 (23:19 -0500)]
librustrt: use `#[deriving(Copy)]`

9 years agolibrustdoc: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:17:42 +0000 (23:17 -0500)]
librustdoc: use `#[deriving(Copy)]`

9 years agolibrustc_typeck: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:16:06 +0000 (23:16 -0500)]
librustc_typeck: use `#[deriving(Copy)]`

9 years agolibrustc_trans: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:14:38 +0000 (23:14 -0500)]
librustc_trans: use `#[deriving(Copy)]`

9 years agolibrustc_llvm: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:09:35 +0000 (23:09 -0500)]
librustc_llvm: use `#[deriving(Copy)]`

9 years agolibrustc_driver: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:07:14 +0000 (23:07 -0500)]
librustc_driver: use `#[deriving(Copy)]`

9 years agolibrustc_borrowck: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:06:50 +0000 (23:06 -0500)]
librustc_borrowck: use `#[deriving(Copy)]`

9 years agolibrustc: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 04:03:34 +0000 (23:03 -0500)]
librustc: use `#[deriving(Copy)]`

9 years agolibregex: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 03:46:59 +0000 (22:46 -0500)]
libregex: use `#[deriving(Copy)]`

9 years agolibrbml: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 03:46:05 +0000 (22:46 -0500)]
librbml: use `#[deriving(Copy)]`

9 years agolibrand: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 03:45:18 +0000 (22:45 -0500)]
librand: use `#[deriving(Copy)]`

9 years agoliblog: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 03:43:43 +0000 (22:43 -0500)]
liblog: use `#[deriving(Copy)]`

9 years agolibgetopts: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 03:37:29 +0000 (22:37 -0500)]
libgetopts: use `#[deriving(Copy)]`

9 years agolibfmt_macros: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 03:36:39 +0000 (22:36 -0500)]
libfmt_macros: use `#[deriving(Copy)]`

9 years agolibcore: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 03:35:22 +0000 (22:35 -0500)]
libcore: use `#[deriving(Copy)]`

9 years agolibcollections: use `#[deriving(Copy)]`
Jorge Aparicio [Mon, 15 Dec 2014 03:26:17 +0000 (22:26 -0500)]
libcollections: use `#[deriving(Copy)]`

9 years agoAdd RingBuf::as_slices as per collections reform v2.
Clark Gaebel [Tue, 16 Dec 2014 04:01:58 +0000 (23:01 -0500)]
Add RingBuf::as_slices as per collections reform v2.

See: https://github.com/rust-lang/rfcs/pull/509

Not sure if this is allowed to land before the RFC. Either way,
it's here for review.

r? @Gankro
cc: @bfops

9 years agoack parser.parse_ty change in quote_ty! (+ test)
Mathieu Poumeyrol [Tue, 2 Dec 2014 16:10:07 +0000 (17:10 +0100)]
ack parser.parse_ty change in quote_ty! (+ test)

9 years agoauto merge of #19884 : nikomatsakis/rust/issue-19730-perfect-forwarding, r=pnkfelix
bors [Fri, 19 Dec 2014 13:22:10 +0000 (13:22 +0000)]
auto merge of #19884 : nikomatsakis/rust/issue-19730-perfect-forwarding, r=pnkfelix

Rewrite how the HRTB algorithm matches impls against obligations. Instead of impls providing higher-ranked trait-references, impls now once again only have early-bound regions. The skolemization checks are thus moved out into trait matching itself. This allows to implement "perfect forwarding" impls like those described in #19730. This PR builds on a previous PR that was already reviewed by @pnkfelix.

r? @pnkfelix

Fixes #19730

9 years agoThree random test cases that seem to produce more errors now. I've
Niko Matsakis [Fri, 19 Dec 2014 03:17:16 +0000 (22:17 -0500)]
Three random test cases that seem to produce more errors now.  I've
not dug deeply into what is going on here, although the errors ARE
somewhat surprising.

9 years agoModify the `Bytes` type so that it remains cloneable even
Niko Matsakis [Fri, 19 Dec 2014 03:16:48 +0000 (22:16 -0500)]
Modify the `Bytes` type so that it remains cloneable even
though it includes a `fn()`. This is really a more general
problem but I wanted to ensures that `bytes` in particular
remains working due to #12677.

9 years agoCorrect comment on Binder.
Niko Matsakis [Thu, 18 Dec 2014 15:13:13 +0000 (10:13 -0500)]
Correct comment on Binder.

9 years agoKill some warnings about shadowed lifetimes
Niko Matsakis [Tue, 16 Dec 2014 22:34:47 +0000 (17:34 -0500)]
Kill some warnings about shadowed lifetimes

9 years agoWork around #19982 by rewriting test impls to not use anonymous
Niko Matsakis [Tue, 16 Dec 2014 01:20:15 +0000 (20:20 -0500)]
Work around #19982 by rewriting test impls to not use anonymous
lifetimes. This currently causes an ICE; it should (ideally) work, but
failing that at least give a structured error. For the purposes of
this PR, though, workaround is fine.

9 years agoDocument new algorithm at a high-level.
Niko Matsakis [Mon, 15 Dec 2014 16:40:11 +0000 (11:40 -0500)]
Document new algorithm at a high-level.

9 years agoRemove text on method matching, which is now out of date.
Niko Matsakis [Mon, 15 Dec 2014 10:45:14 +0000 (05:45 -0500)]
Remove text on method matching, which is now out of date.

9 years agoConvert gigantic comment away from `//!` form. It is annoying to
Niko Matsakis [Mon, 15 Dec 2014 10:44:59 +0000 (05:44 -0500)]
Convert gigantic comment away from `//!` form. It is annoying to
read (`//!` is intrusive) and annoying to edit (must maintain a prefix
on every line). Since the only purpose of a `doc.rs` file is to have a
bunch of text, using `/*!` and `*/` without indentations seems
appropriate.

9 years agoImplement "perfect forwarding" for HR impls (#19730).
Niko Matsakis [Sun, 14 Dec 2014 12:17:23 +0000 (07:17 -0500)]
Implement "perfect forwarding" for HR impls (#19730).

9 years agoMake all predicates higher-ranked, not just trait references.
Niko Matsakis [Sat, 13 Dec 2014 10:34:34 +0000 (05:34 -0500)]
Make all predicates higher-ranked, not just trait references.

9 years agoMove `leak_check` into its own method, and ensure that all higher-ranked code is in
Niko Matsakis [Fri, 12 Dec 2014 19:55:07 +0000 (14:55 -0500)]
Move `leak_check` into its own method, and ensure that all higher-ranked code is in
`higher_ranked.rs`.

9 years agoCentralize on using `Binder` to introduce new binding levels, rather than having...
Niko Matsakis [Fri, 12 Dec 2014 16:28:35 +0000 (11:28 -0500)]
Centralize on using `Binder` to introduce new binding levels, rather than having FnSig carry an implicit binding level.  This means that we be more typesafe in general, since things that instantiate bound regions can drop the Binder to reflect that.

9 years agoAdd (currently unused) helper routine for skolemizing bound regions.
Niko Matsakis [Fri, 12 Dec 2014 11:37:42 +0000 (06:37 -0500)]
Add (currently unused) helper routine for skolemizing bound regions.

9 years agoRename the code that replaces unbound variables to "freshen" rather than "skolemize...
Niko Matsakis [Fri, 12 Dec 2014 11:13:42 +0000 (06:13 -0500)]
Rename the code that replaces unbound variables to "freshen" rather than "skolemize" -- strictly speaking, this is not skolemization, because it is not discharging quantifiers. Also, the trait selection code will still be doing true skolemization, so it would be a confusing overlap of names.

9 years agoCreate distinct types for a PolyTraitRef (with bindings) and a normal TraitRef.
Niko Matsakis [Thu, 11 Dec 2014 18:37:37 +0000 (13:37 -0500)]
Create distinct types for a PolyTraitRef (with bindings) and a normal TraitRef.

9 years agoFix a bug in the opt-in-copy work: it was failing to liberate the regions bound in...
Niko Matsakis [Thu, 11 Dec 2014 00:11:15 +0000 (19:11 -0500)]
Fix a bug in the opt-in-copy work: it was failing to liberate the regions bound in the impl before searching for `Copy` implements for all fields, leading to problems in the "copyability check". Basically the copyability check would wind up looking for an impl of `for<'tcx> Foo<&'tcx T>`. The impl that exists however is `impl<T> Copy for Foo<T>` and the current rules do not consider that a match (something I would like to revise in a later PR).

9 years agoExtract leak check into a distinct subroutine.
Niko Matsakis [Wed, 10 Dec 2014 23:27:04 +0000 (18:27 -0500)]
Extract leak check into a distinct subroutine.

9 years agoExtract skolemize_regions() helper function.
Niko Matsakis [Wed, 10 Dec 2014 23:09:50 +0000 (18:09 -0500)]
Extract skolemize_regions() helper function.

9 years agoRecycle skolemization counts and add some comments.
Niko Matsakis [Wed, 10 Dec 2014 16:12:48 +0000 (11:12 -0500)]
Recycle skolemization counts and add some comments.

9 years agoPropagate expected type more widely so that we can rewrite the
Niko Matsakis [Tue, 2 Dec 2014 18:59:27 +0000 (13:59 -0500)]
Propagate expected type more widely so that we can rewrite the
issue-14039 test in a more natural way. Previously the "type we will
cast to" was hidden unless it was an integer.

9 years agoDelete tests that passed in error. We currently do not support a Clone
Niko Matsakis [Tue, 2 Dec 2014 18:58:38 +0000 (13:58 -0500)]
Delete tests that passed in error. We currently do not support a Clone
impl for fn pointer types including bound regions, unfortunately.

9 years agoCleanup type resolution to use type folding infrastructure and not
Niko Matsakis [Mon, 1 Dec 2014 17:27:27 +0000 (12:27 -0500)]
Cleanup type resolution to use type folding infrastructure and not
have such a silly over-engineered interface.

9 years agoFix bug in higher-ranked code that would sometimes leak skolemized regions and/or...
Niko Matsakis [Mon, 1 Dec 2014 15:11:59 +0000 (10:11 -0500)]
Fix bug in higher-ranked code that would sometimes leak skolemized regions and/or cause incorrect results.

9 years agoAdd tests for sub relationship on free/bound regions, revealing a bug.
Niko Matsakis [Sat, 29 Nov 2014 13:06:42 +0000 (08:06 -0500)]
Add tests for sub relationship on free/bound regions, revealing a bug.

9 years agoauto merge of #19654 : aturon/rust/merge-rt, r=alexcrichton
bors [Fri, 19 Dec 2014 08:28:52 +0000 (08:28 +0000)]
auto merge of #19654 : aturon/rust/merge-rt, r=alexcrichton

This PR substantially narrows the notion of a "runtime" in Rust, and allows calling into Rust code directly without any setup or teardown.

After this PR, the basic "runtime support" in Rust will consist of:

* Unwinding and backtrace support
* Stack guards

Other support, such as helper threads for timers or the notion of a "current thread" are initialized automatically upon first use.

When using Rust in an embedded context, it should now be possible to call a Rust function directly as a C function with absolutely no setup, though in that case panics will cause the process to abort. In this regard, the C/Rust interface will look much like the C/C++ interface.

In more detail, this PR:

* Merges `librustrt` back into `std::rt`, undoing the facade. While doing so, it removes a substantial amount of redundant functionality (such as mutexes defined in the `rt` module). Code using `librustrt` can now call into `std::rt` to e.g. start executing Rust code with unwinding support.

* Allows all runtime data to be initialized lazily, including the "current thread", the "at_exit" infrastructure, and the "args" storage.

* Deprecates and largely removes `std::task` along with the widespread requirement that there be a "current task" for many APIs in `std`. The entire task infrastructure is replaced with `std::thread`, which provides a more standard API for manipulating and creating native OS threads. In particular, it's possible to join on a created thread, and to get a handle to the currently-running thread. In addition, threads are equipped with some basic blocking support in the form of `park`/`unpark` operations (following a tradition in some OSes as well as the JVM). See the `std::thread` documentation for more details.

* Channels are refactored to use a new internal blocking infrastructure that itself sits on top of `park`/`unpark`.

One important change here is that a Rust program ends when its main thread does, following most threading models. On the other hand, threads will often be created with an RAII-style join handle that will re-institute blocking semantics naturally (and with finer control).

This is very much a:

[breaking-change]

Closes #18000
r? @alexcrichton

9 years agoDisable at_exit handlers
Aaron Turon [Fri, 19 Dec 2014 07:29:30 +0000 (23:29 -0800)]
Disable at_exit handlers

The [final step](https://github.com/rust-lang/rust/pull/19654) of
runtime removal changes the threading/process model so that the process
shuts down when the main thread exits. But several shared resources,
like the helper thread for timeouts, are shut down when the main thread
exits (but before the process ends), and they are not prepared to be
used after shut down, but other threads may try to access them during
the shutdown sequence of the main thread.

As an interim solution, the `at_exit` cleanup routine is simply skipped.

Ultimately, these resources should be made to safely handle asynchronous
shutdown, usually by panicking if called from a detached thread when the
main thread is ending.

See issue for details https://github.com/rust-lang/rust/issues/20012

This is a [breaking-change] for anyone relying on `at_exit`.

9 years agoRebasing fixes.
Aaron Turon [Fri, 19 Dec 2014 03:41:20 +0000 (19:41 -0800)]
Rebasing fixes.

9 years agoDisable stack overflow test on android, which seems to be failing spuriously.
Aaron Turon [Fri, 19 Dec 2014 02:56:28 +0000 (18:56 -0800)]
Disable stack overflow test on android, which seems to be failing spuriously.

cc https://github.com/rust-lang/rust/issues/20004

9 years agoDelete rest of rustrt
Aaron Turon [Wed, 17 Dec 2014 23:41:16 +0000 (15:41 -0800)]
Delete rest of rustrt

... and address other rebasing fallout.

9 years agostd: Move the panic flag to its own thread local
Alex Crichton [Wed, 17 Dec 2014 22:59:20 +0000 (14:59 -0800)]
std: Move the panic flag to its own thread local

This flag is somewhat tied to the `unwind` module rather than the `thread_info`
module, so this commit moves it into that module as well as allowing the same OS
thread to call `unwind::try` multiple times. Previously once a thread panicked
its panic flag was never reset, even after exiting the panic handler.

9 years agostd: Lower abstractions for thread_local/at_exit
Alex Crichton [Wed, 17 Dec 2014 22:37:38 +0000 (14:37 -0800)]
std: Lower abstractions for thread_local/at_exit

The current implementations use `std::sync` primitives, but these primitives
currently end up relying on `thread_info` and a local `Thread` being available
(mainly for checking the panicking flag).

To get around this, this commit lowers the abstractions used by the windows
thread_local implementation as well as the at_exit_imp module. Both of these
modules now use a `sys::Mutex` and a `static mut` and manage the
allocation/locking manually.

9 years agoRevise std::thread API to join by default
Aaron Turon [Sun, 14 Dec 2014 08:05:32 +0000 (00:05 -0800)]
Revise std::thread API to join by default

This commit is part of a series that introduces a `std::thread` API to
replace `std::task`.

In the new API, `spawn` returns a `JoinGuard`, which by default will
join the spawned thread when dropped. It can also be used to join
explicitly at any time, returning the thread's result. Alternatively,
the spawned thread can be explicitly detached (so no join takes place).

As part of this change, Rust processes now terminate when the main
thread exits, even if other detached threads are still running, moving
Rust closer to standard threading models. This new behavior may break code
that was relying on the previously implicit join-all.

In addition to the above, the new thread API also offers some built-in
support for building blocking abstractions in user space; see the module
doc for details.

Closes #18000

[breaking-change]

9 years agoUpdate doc comment for std::rt
Aaron Turon [Mon, 15 Dec 2014 06:52:55 +0000 (22:52 -0800)]
Update doc comment for std::rt

9 years agoAvoid .take().unwrap() with FnOnce closures
Alex Crichton [Wed, 10 Dec 2014 15:49:45 +0000 (07:49 -0800)]
Avoid .take().unwrap() with FnOnce closures

9 years agoTweak the startup routine to pass on linux
Alex Crichton [Wed, 10 Dec 2014 15:37:56 +0000 (07:37 -0800)]
Tweak the startup routine to pass on linux

We need to be sure to init thread_info before we init args for example because
args is grabbing locks which may entail looking at the local thread eventually.

9 years agoFix compilation on linux
Alex Crichton [Wed, 10 Dec 2014 15:37:33 +0000 (07:37 -0800)]
Fix compilation on linux