Commit Graph

28549 Commits

Author SHA1 Message Date
Alex Crichton
7192452545 core: Inherit the char module 2014-05-07 08:13:24 -07:00
Alex Crichton
d9708539af core: Inherit the container module 2014-05-07 08:13:24 -07:00
Alex Crichton
2ad98fbb27 core: Inherit the ty module 2014-05-07 08:13:24 -07:00
Alex Crichton
ead6e16a60 core: Inherit the ops module 2014-05-07 08:13:06 -07:00
Alex Crichton
ec8a805b6d core: Inherit the kinds module 2014-05-07 08:13:06 -07:00
Alex Crichton
28624661c3 core: Inherit the cast module 2014-05-07 08:13:06 -07:00
Alex Crichton
645b157564 core: Inherit the ptr module 2014-05-07 08:13:06 -07:00
Alex Crichton
dca8a0d6e4 core: Inherit the mem module 2014-05-07 08:12:48 -07:00
Alex Crichton
5b75e44fb0 core: Inherit the intrinsics module 2014-05-07 08:12:48 -07:00
Alex Crichton
836d4b96a9 mk: Add libcore 2014-05-07 08:12:48 -07:00
bors
ef6daf9935 auto merge of #13958 : pcwalton/rust/detilde, r=pcwalton
for `~str`/`~[]`.

Note that `~self` still remains, since I forgot to add support for
`Box<self>` before the snapshot.

r? @brson or @alexcrichton or whoever
2014-05-07 05:16:48 -07:00
bors
4a5d39001b auto merge of #13914 : alexcrichton/rust/pile-o-rustdoc-fixes, r=brson
Lots of assorted things here and there, all the details are in the commits.

Closes #11712
2014-05-07 03:21:47 -07:00
bors
897b96a2e2 auto merge of #13836 : jbcrail/rust/add-bitv-doc, r=alexcrichton 2014-05-07 01:56:48 -07:00
Patrick Walton
090040bf40 librustc: Remove ~EXPR, ~TYPE, and ~PAT from the language, except
for `~str`/`~[]`.

Note that `~self` still remains, since I forgot to add support for
`Box<self>` before the snapshot.

How to update your code:

* Instead of `~EXPR`, you should write `box EXPR`.

* Instead of `~TYPE`, you should write `Box<Type>`.

* Instead of `~PATTERN`, you should write `box PATTERN`.

[breaking-change]
2014-05-06 23:12:54 -07:00
bors
2dcbad5bc4 auto merge of #13754 : alexcrichton/rust/net-experimental, r=brson
The underlying I/O objects implement a good deal of various options here and
there for tuning network sockets and how they perform. Most of this is a relic
of "whatever libuv provides", but these options are genuinely useful.

It is unclear at this time whether these options should be well supported or
not, or whether they have correct names or not. For now, I believe it's better
to expose the functionality than to not, but all new methods are added with
an #[experimental] annotation.
2014-05-06 22:01:43 -07:00
Joseph Crail
2fc3b3a48f Add documentation for Bitv. 2014-05-06 23:34:19 -04:00
bors
24f6f26e63 auto merge of #13892 : alexcrichton/rust/mixing-rlib-dylib-deps, r=brson
Currently, rustc requires that a linkage be a product of 100% rlibs or 100%
dylibs. This is to satisfy the requirement that each object appear at most once
in the final output products. This is a bit limiting, and the upcoming libcore
library cannot exist as a dylib, so these rules must change.

The goal of this commit is to enable *some* use cases for mixing rlibs and
dylibs, primarily libcore's use case. It is not targeted at allowing an
exhaustive number of linkage flavors.

There is a new dependency_format module in rustc which calculates what format
each upstream library should be linked as in each output type of the current
unit of compilation. The module itself contains many gory details about what's
going on here.

cc #10729
2014-05-06 19:46:44 -07:00
bors
b299231d12 auto merge of #13982 : alexcrichton/rust/more-logging, r=nikomatsakis
This was accidentally left out of the recent logging improvements.
2014-05-06 16:31:39 -07:00
Alex Crichton
be71d809bd log: Use writeln!() instead of write!()
This was accidentally left out of the recent logging improvements.
2014-05-06 15:08:16 -07:00
bors
df621acf5f auto merge of #13960 : brandonw/rust/master, r=alexcrichton
Update the example to make the usage of `pub mod foo;` much more
apparent, as well as using an example where setting the visibility of
the module is actually necessary.
2014-05-06 15:06:52 -07:00
bors
cf6857b9e9 auto merge of #13897 : aturon/rust/issue-6085, r=bjz
The `std::bitflags::bitflags!` macro did not provide support for
adding attributes to the generates structure, due to limitations in
the parser for macros. This patch works around the parser limitations
by requiring a `flags` keyword in the `bitflags!` invocations:

    bitflags!(
        #[deriving(Hash)]
        #[doc="Three flags"]
        flags Flags: u32 {
            FlagA       = 0x00000001,
            FlagB       = 0x00000010,
            FlagC       = 0x00000100
        }
    )

The intent of `std::bitflags` is to allow building type-safe wrappers
around C-style flags APIs. But in addition to construction these flags
from the Rust side, we need a way to convert them from the C
side. This patch adds a `from_bits` function, which is unsafe since
the bits in question may not represent a valid combination of flags.

Finally, this patch changes `std::io::FilePermissions` from an exposed
`u32` representation to a typesafe representation (that only allows valid
flag combinations) using the `std::bitflags`.

Closes #6085.
2014-05-06 12:41:55 -07:00
bors
1f6db7f4f6 auto merge of #13822 : EdorianDark/rust/master, r=cmr
New attempt to generalize stats, after #12606.
Since #12355 did not get merged, i want go get first get my change done and the try to fix sum.
2014-05-06 10:16:40 -07:00
Brandon Waskiewicz
949143e17a Update multiple file use statement example
Update the example to make the usage of `pub mod foo;` much more
apparent, as well as using an example where setting the visibility of
the module is actually necessary.
2014-05-06 11:11:52 -04:00
bors
c600dc0f53 auto merge of #13962 : luqmana/rust/al, r=alexcrichton 2014-05-06 08:06:45 -07:00
bors
061db52b2b auto merge of #13961 : richo/rust/richo-author, r=alexcrichton
Shamelessly adds myself as a contributor.
2014-05-06 01:36:34 -07:00
bors
0605f05e42 auto merge of #13952 : aaronraimist/rust/patch-1, r=thestinger 2014-05-06 00:11:37 -07:00
Luqman Aden
feb2be6bd1 Lower armhf target feature to v6. 2014-05-06 02:05:05 -04:00
bors
5c16cf975d auto merge of #13939 : richo/rust/docs/composability, r=thestinger
While there are various references to the work compositionality on the web, I can't find any reference to it being an actual word. My understanding is that composability is what's actually meant here anyway.
2014-05-05 22:46:35 -07:00
bors
cba66bc920 auto merge of #13925 : kballard/rust/vim_indent_bracket_fix, r=thestinger
If an unbalanced [ exists in a string or comment, this should not be
considered when calculating the indent at the top level.

Similarly, when testing for ({/}) to see if we're at the top level to
begin with, strings and comments should be skipped.
2014-05-05 21:21:34 -07:00
Richo Healey
809a2f8a7b Add Richo Healey to contributors 2014-05-05 20:49:50 -07:00
bors
a1ca57237b auto merge of #13946 : pnkfelix/rust/fsk-cleanup-proc-comment-in-guide-tasks, r=alexcrichton
Followup to some recent feedback in PR #13676.
2014-05-05 19:56:33 -07:00
bors
acf9d42146 auto merge of #13940 : edwardw/rust/refutable-match, r=pcwalton
By carefully distinguishing falling back to the default arm from moving
on to the next pattern, this patch adjusts the codegen logic for range
and guarded arms of pattern matching expression. It is a more
appropriate way of fixing #12582 and #13027 without causing regressions
such as #13867.
    
Closes #13867
2014-05-05 18:31:33 -07:00
bors
bd3fb81e5e auto merge of #13934 : huonw/rust/transmute-mut, r=alexcrichton
Turning a `&T` into an `&mut T` is undefined behaviour, and needs to be
done very very carefully. Providing a convenience function for exactly
this task is a bad idea, just tempting people into doing the wrong
thing.

(The right thing is to use types like `Cell`, `RefCell` or `Unsafe`.)

cc https://github.com/mozilla/rust/issues/13933
2014-05-05 16:51:30 -07:00
bors
7583544fb5 auto merge of #13912 : seanmonstar/rust/logrecord, r=alexcrichton
The logging macros now create a LogRecord, and pass that to the Logger. This will allow custom loggers to change the formatting, and possible filter on more properties of the log record.

DefaultLogger's formatting was taken from Python's default formatting:
`LEVEL:from: message`

Also included: fmt::Arguments now implement Show, so they can be used to
extend format strings.

@alexcrichton r?
2014-05-05 15:26:31 -07:00
Aaron Turon
8d1d7d9b5f Change std::io::FilePermission to a typesafe representation
This patch changes `std::io::FilePermissions` from an exposed `u32`
representation to a typesafe representation (that only allows valid
flag combinations) using the `std::bitflags`, thus ensuring a greater
degree of safety on the Rust side.

Despite the change to the type, most code should continue to work
as-is, sincde the new type provides bit operations in the style of C
flags. To get at the underlying integer representation, use the `bits`
method; to (unsafely) convert to `FilePermissions`, use
`FilePermissions::from_bits`.

Closes #6085.

[breaking-change]
2014-05-05 15:24:36 -07:00
Aaron Turon
c00d8fd9a0 Add (unsafe) coercion from bits to std::bitflags
The intent of `std::bitflags` is to allow building type-safe wrappers
around C-style flags APIs. But in addition to construction these flags
from the Rust side, we need a way to convert them from the C
side. This patch adds a `from_bits` function, which is unsafe since
the bits in question may not represent a valid combination of flags.
2014-05-05 15:24:36 -07:00
Aaron Turon
b733df0fc7 Allow attributes in std::bitflags::bitflags!
The `std::bitflags::bitflags!` macro did not provide support for
adding attributes to the generated structure or flags, due to
limitations in the parser for macros. This patch works around the
parser limitations by requiring a `flags` keyword in the overall
`bitflags!` invocation, and a `static` keyword for each flag:

    bitflags!(
        #[deriving(Hash)]
        #[doc="Three flags"]
        flags Flags: u32 {
            #[doc="The first flag"]
            static FlagA       = 0x00000001,
            static FlagB       = 0x00000010,
            static FlagC       = 0x00000100
        }
    )
2014-05-05 15:24:36 -07:00
bors
600507d538 auto merge of #13782 : alexcrichton/rust/issue-13775, r=pcwalton
These often crop up when using default methods that don't actually bind their
argument names.

Closes #13775
2014-05-05 13:46:31 -07:00
Aaron Raimist
ea46a7406a Updated CONTRIBUTING.md for 2014 2014-05-05 15:46:10 -05:00
bors
d943b0fee8 auto merge of #13907 : iliekturtles/rust/tutorial, r=alexcrichton
Some minor clarifications and fixes.
2014-05-05 12:21:36 -07:00
Sean McArthur
ceb29314a7 log: Logger receiveis a LogRecord
The logging macros now create a LogRecord, and pass that to the
Logger, instead of passing a `level` and `args`. The new signature is:

    trait Logger {
        fn log(&mut self, record: &LogRecord);
    }

The LogRecord includes additional values that may be useful to custom
loggers, and also allows for further expansion if not values are found
useful.

DefaultLogger's formatting was taken from Python's default formatting:
`LEVEL:from: message`

Also included: fmt::Arguments now implement Show, so they can be used to
extend format strings.

[breaking-change]
2014-05-05 11:18:53 -07:00
bors
fd625dda9a auto merge of #13271 : stepancheg/rust/align, r=pcwalton
This patch fixes issue #13186.

When generating constant expression for enum, it is possible that
alignment of expression may be not equal to alignment of type.  In that
case space after last struct field must be padded to match size of value
and size of struct. This commit adds that padding.

See detailed explanation in src/test/run-pass/trans-tag-static-padding.rs
2014-05-05 10:06:39 -07:00
bors
2be738ae36 auto merge of #13935 : thestinger/rust/noalias, r=pcwalton
This was removed because these could alias with `&const T` or `@mut T`
and those are now gone from the language. There are still aliasing
issues within local scopes, but this is correct for function parameters.

This also removes the no-op `noalias` marker on proc (not a pointer) and
leaves out the mention of #6750 because real type-based alias analysis
is not within the scope of best effort usage of the `noalias` attribute.

Test case:

    pub fn foo(x: &mut &mut u32) {
        **x = 5;
        **x = 5;
    }

Before:

    define void @_ZN3foo20h0ce94c9671b0150bdaa4v0.0E(i32** nocapture readonly) unnamed_addr #0 {
    entry-block:
      %1 = load i32** %0, align 8
      store i32 5, i32* %1, align 4
      %2 = load i32** %0, align 8
      store i32 5, i32* %2, align 4
      ret void
    }

After:

    define void @_ZN3foo20h0ce94c9671b0150bdaa4v0.0E(i32** noalias nocapture readonly) unnamed_addr #0 {
    entry-block:
      %1 = load i32** %0, align 8
      store i32 5, i32* %1, align 4
      ret void
    }

Closes #12436
2014-05-05 08:41:39 -07:00
Mike Boutin
055cbdeee0 doc: Corrected example in 17.8 Deriving implementations for traits
Corrected example to to use Rand trait referenced in preceding
description and included an example using the Show trait to print ABC.
2014-05-05 11:25:16 -04:00
Mike Boutin
e65aea522c doc: Minor example formatting in 11 References 2014-05-05 11:24:00 -04:00
Mike Boutin
81bc32d975 doc: Clarified 4.2 Pattern matching
Combined redundant paragraphs about the match expression and removed a
redundant example.
2014-05-05 11:24:00 -04:00
bors
ecc18f3444 auto merge of #13749 : pnkfelix/rust/add-libgraphviz-crate, r=alexcrichton
Add a `graphviz` crate for making .dot files to layout and render graphs.

(This is a precursor to other work to render control-flow graphs from within rustc itself; but this crate should be independently usable, since it abstracts over the client's graph-representation and labeling method.)
2014-05-05 05:36:37 -07:00
Felix S. Klock II
67307d4e08 Placate rustdocs testable-by-default code blocks. 2014-05-05 14:31:06 +02:00
Edward Wang
90449abcb3 Adjust codegen logic for range and guarded arms
By carefully distinguishing falling back to the default arm from moving
on to the next pattern, this patch adjusts the codegen logic for range
and guarded arms of pattern matching expression. It is a more
appropriate way of fixing #12582 and #13027 without causing regressions
such as #13867.

Closes #13867
2014-05-05 20:17:59 +08:00
Edward Wang
7adc48527f Reverse #13034
It has been found that #13034 was flawed and caused regression #13867.
This patch reveres the changes made by it except the companion tests.
2014-05-05 20:16:18 +08:00