Commit Graph

23722 Commits

Author SHA1 Message Date
Alex Crichton
e203f30bc7 Register new snapshots 2013-10-29 15:56:16 -07:00
bors
611c94d984 auto merge of #10134 : reedlepee123/rust/priv_fields, r=brson 2013-10-29 15:11:30 -07:00
bors
886819cca1 auto merge of #10140 : brson/rust/comm, r=alexcrichton
Just putting this public trait into the correct module.
2013-10-29 13:37:08 -07:00
bors
67d7be0ff1 auto merge of #10136 : hatahet/rust/master, r=alexcrichton
Fixes #10077
2013-10-29 12:02:59 -07:00
bors
fed48cc861 auto merge of #10132 : pcwalton/rust/proc, r=pcwalton
the feature gate for `once fn` if used with the `~` sigil.

r? @brson
2013-10-29 10:52:25 -07:00
Patrick Walton
7e77bf1769 librustc: Implement the proc type as sugar for ~once fn and proc
notation for closures, and disable the feature gate for `once fn` if
used with the `~` sigil.
2013-10-29 10:34:17 -07:00
bors
52f42f1638 auto merge of #10058 : alexcrichton/rust/uv-crate, r=brson
This is one of the final steps needed to complete #9128. It still needs a little bit of polish before closing that issue, but it's in a pretty much "done" state now.

The idea here is that the entire event loop implementation using libuv is now housed in `librustuv` as a completely separate library. This library is then injected (via `extern mod rustv`) into executable builds (similarly to how libstd is injected, tunable via `#[no_uv]`) to bring in the "rust blessed event loop implementation."

Codegen-wise, there is a new `event_loop_factory` language item which is tagged on a function with 0 arguments returning `~EventLoop`. This function's symbol is then inserted into the crate map for an executable crate, and if there is no definition of the `event_loop_factory` language item then the value is null.

What this means is that embedding rust as a library in another language just got a little harder. Libraries don't have crate maps, which means that there's no way to find the event loop implementation to spin up the runtime. That being said, it's always possible to build the runtime manually. This request also makes more runtime components public which should probably be public anyway. This new public-ness should allow custom scheduler setups everywhere regardless of whether you follow the `rt::start `path.
2013-10-29 09:36:47 -07:00
Jed Davis
c0190a9cfb Prevent unoptimized rustpkg tests from running out of stack.
The actual fix would be to make rustpkg use `rustc::monitor` so it picks
up anything special that rustc needs, but for now let's keep the tests
from breaking.
2013-10-29 09:09:20 -07:00
Jed Davis
49f851c2c9 Fix type_of for enums to not lose data in some cases when immediate.
The previous implementation, when combined with small discriminants and
immediate types, caused problems for types like `Either<u8, i16>` which
are now small enough to be immediate and can have fields intersecting
the highest-alignment variant's alignment padding (which LLVM doesn't
preserve).  So let's not do that.
2013-10-29 09:09:20 -07:00
Jed Davis
ac4644d7de Add another discriminant-size-related test, this time with fields. 2013-10-29 09:09:20 -07:00
Jed Davis
472d798dc1 Work around const_eval issues by changing signed integer min_values.
Otherwise, run-pass/deriving-primitive.rs breaks on 32-bit platforms,
because `int::min_value` is `0xffffffff7fffffff` when evaluated for the
discriminant declaration.
2013-10-29 09:09:20 -07:00
Jed Davis
de9bb9738d Add tests for enum discriminant sizing. 2013-10-29 09:09:20 -07:00
Jed Davis
afab3307a0 C-like enums are not always immediate 2013-10-29 09:09:20 -07:00
Jed Davis
fcfbfde0b7 Adjust reflection for the possibility of discriminants larger than int.
Not only can discriminants be smaller than int now, but they can be
larger than int on 32-bit targets.  This has obvious implications for the
reflection interface.  Without this change, things fail with LLVM
assertions when we try to "extend" i64 to i32.
2013-10-29 09:09:20 -07:00
Jed Davis
92109b1202 Yet more neatening 2013-10-29 09:09:20 -07:00
Jed Davis
727731f89e Assorted cleanups suggested by reviewers. 2013-10-29 09:09:20 -07:00
Jed Davis
01097cbab0 Unbreak the debuginfo tests.
The variant used in debug-info/method-on-enum.rs had its layout changed
by the smaller discriminant, so that the `u32` no longer overlaps both
of the `u16`s, and thus the debugger is printing partially uninitialized
data when it prints the wrong variant.

Thus, the test runner is modified to accept wildcards (using a string
that should be unlikely to occur literally), to allow for this.
2013-10-29 09:09:20 -07:00
Jed Davis
a027f164bc Check repr attribute consistency at check time, not translation.
Note that raising an error during trans doesn't stop the compile or cause
rustc to exit with a failure status, currently, so this is of more than
cosmetic importance.
2013-10-29 09:09:20 -07:00
Jed Davis
c8c08763ec Add repr attributes in various places that need them. 2013-10-29 09:09:20 -07:00
Jed Davis
ac311ecaab Fix multiple mistakes in adt::is_ffi_safe 2013-10-29 09:09:20 -07:00
Jed Davis
25f953437d Lint non-FFI-safe enums. 2013-10-29 09:09:20 -07:00
Jed Davis
01740acd5a Initial implementation of enum discrimnant sizing.
Allows an enum with a discriminant to use any of the primitive integer
types to store it.  By default the smallest usable type is chosen, but
this can be overridden with an attribute: `#[repr(int)]` etc., or
`#[repr(C)]` to match the target's C ABI for the equivalent C enum.

This commit breaks a few things, due to transmutes that now no longer
match in size, or u8 enums being passed to C that expects int, or
reflection; later commits on this branch fix them.
2013-10-29 09:09:19 -07:00
Jed Davis
f1124a2f55 Add parser for #[repr(...)]; nothing uses it yet.
Also export enum attrs into metadata, and add a convenient interface for
obtaining the repr hint from either a local or remote definition.
2013-10-29 09:09:19 -07:00
reedlepee
b5e073830b removed extra line 2013-10-29 21:16:02 +05:30
reedlepee
697813747a Indentation 2013-10-29 21:16:02 +05:30
reedlepee
33b9afac4a updated the places where the struct is created #7427 2013-10-29 21:16:02 +05:30
reedlepee
6e07377715 Changed name to non_copyable #7427 2013-10-29 21:16:02 +05:30
reedlepee
b7e9b0ce32 Added the comment #7427 2013-10-29 21:16:02 +05:30
reedlepee
83cdae63e8 Replaced empty destructors with NonCopyable #7427
closes #7427
2013-10-29 21:16:01 +05:30
Alex Crichton
201cab84e8 Move rust's uv implementation to its own crate
There are a few reasons that this is a desirable move to take:

1. Proof of concept that a third party event loop is possible
2. Clear separation of responsibility between rt::io and the uv-backend
3. Enforce in the future that the event loop is "pluggable" and replacable

Here's a quick summary of the points of this pull request which make this
possible:

* Two new lang items were introduced: event_loop, and event_loop_factory.
  The idea of a "factory" is to define a function which can be called with no
  arguments and will return the new event loop as a trait object. This factory
  is emitted to the crate map when building an executable. The factory doesn't
  have to exist, and when it doesn't then an empty slot is in the crate map and
  a basic event loop with no I/O support is provided to the runtime.

* When building an executable, then the rustuv crate will be linked by default
  (providing a default implementation of the event loop) via a similar method to
  injecting a dependency on libstd. This is currently the only location where
  the rustuv crate is ever linked.

* There is a new #[no_uv] attribute (implied by #[no_std]) which denies
  implicitly linking to rustuv by default

Closes #5019
2013-10-29 08:39:22 -07:00
bors
e6650c87a3 auto merge of #10142 : pythonesque/rust/issue-8263, r=catamorphism
This is, I think, the minimal change required.  I would have included a test but as far as I can tell there is currently no way to precisely test that the span for an error underlines the correct word.  I did verify it manually.
2013-10-29 07:41:48 -07:00
bors
fc766efd16 auto merge of #10141 : kmcallister/rust/current_stack_segment, r=alexcrichton
This was done in 2145de8c and reverted in 0ada7c7f, but Servo needs it.

Closes #10065.

r? @brson
2013-10-29 06:36:43 -07:00
Chris Morgan
1ad8dbe42e Fix Vim indent for wrapped function arguments. 2013-10-30 00:27:15 +11:00
Chris Morgan
c20186bde5 Update prelude items in Vim syntax file. 2013-10-30 00:26:25 +11:00
bors
73091583dd auto merge of #10135 : alexcrichton/rust/snapshots, r=thestinger
Plus some migration from `let mut this = self` to `mut self` (yay!)
2013-10-29 02:01:50 -07:00
Guillaume Pinot
4ca32e1bfc rewrite shootout-binarytrees.rs to match shootout directives
The old version didn't follow shootout's directives: no memory were
deallocated.  At the same time, parallelisation of the computation.

fix #2913
2013-10-29 08:56:16 +01:00
Joshua Yanovski
a71665798b #8263 part 2: Adding struct name. 2013-10-28 23:51:10 -07:00
Joshua Yanovski
01ab8542fb Field identifiers now include specific spans (Closes #8263). 2013-10-28 22:57:34 -07:00
bors
671ab42a3b auto merge of #10127 : thestinger/rust/cold, r=pcwalton
This allows a function to marked as infrequently called, resulting in
any branch calling it to be considered colder.
2013-10-28 22:51:51 -07:00
Keegan McAllister
f6b236b9d2 rt::task: Make current_stack_segment public again
This was done in 2145de8c and reverted in 0ada7c7f, but Servo needs it.

Closes #10065.
2013-10-28 20:59:45 -07:00
bors
dba6070080 auto merge of #10117 : huonw/rust/dead-visits, r=sanxiyn
Used nowhere, and these are likely incorrect anyway: self needs to be
dereferenced once more otherwise the method calls will be reusing the
current impl... bam! Infinite recursion.
2013-10-28 20:51:30 -07:00
Brian Anderson
e6fa2d09de std: Move the SendDeferred trait to std::comm 2013-10-28 19:51:28 -07:00
Ziad Hatahet
3797f2bfe6 Capitalize statics in f32 and f64 mods
Fixes #10077
2013-10-28 19:35:56 -07:00
bors
c0222cda27 auto merge of #10133 : alexcrichton/rust/another-error, r=thestinger
This cropped up on the bsd bot, and if it's an error that gets thrown then it's
fine to just whitelist another type of error in the test.
2013-10-28 19:26:23 -07:00
Alex Crichton
2290131543 Register new snapshots 2013-10-28 16:56:24 -07:00
bors
8852cb7713 auto merge of #10113 : thestinger/rust/expect, r=cmr
LLVM is unable to determine this for most cases.

http://llvm-reviews.chandlerc.com/D2034 needs to land upstream before
this is going to have an effect. It's harmless to start generating the
expect hint now.
2013-10-28 16:07:14 -07:00
bors
cd6e9f4f83 auto merge of #10110 : catamorphism/rust/rustpkg-dependency-build-dir, r=metajack
r? @metajack When invoked with the --rust-path-hack flag, rustpkg was correctly building
the package into the default workspace (and not into the build/ subdirectory of the
parent directory of the source directory), but not correctly putting the output
for any dependencies into the default workspace as well.

Spotted by Jack.
2013-10-28 13:51:39 -07:00
Alex Crichton
5dd1583c57 Make some more rt components public
Primarily this makes the Scheduler and all of its related interfaces public. The
reason for doing this is that currently any extern event loops had no access to
the scheduler at all. This allows third-party event loops to manipulate the
scheduler, along with allowing the uv event loop to live inside of its own
crate.
2013-10-28 13:14:42 -07:00
Daniel Micay
541e5f84d7 add support for the cold function attribute
This allows a function to marked as infrequently called, resulting in
any branch calling it to be considered colder.
2013-10-28 15:34:50 -04:00
bors
2ab4a6fab0 auto merge of #10095 : huonw/rust/master, r=cmr
Currently each line is a separate bullet point in a list: http://static.rust-lang.org/doc/master/std/task/fn.spawn_sched.html
2013-10-28 12:06:26 -07:00